Content deleted Content added
create copy of User:Ais523/stubtagtab2.js |
"modernize" code |
||
Line 3:
// ([[User:ais523/stubtagtab2.js]])
// <source lang="javascript">
if (mw.config.get("wgNamespaceNumber") === 0 && mw.config.get("wgAction") === "view") {
if (document.getElementById("ca-edit")) mw.util.addPortletLink('p-cactions', 'javascript:stubtagtab()', 'Stub', 'ca-stubtag', 'Add a stub tag to this page', '');
}
if (___location.href.indexOf("&autoaddstubtag=") !== -1 && document.getElementById('wpTextbox1') != null) {
var x = decodeURIComponent(___location.href.split("&autoaddstubtag=")[1]);
if (x.indexOf("-stub") === -1) x += "-stub";
document.getElementById('wpTextbox1').value += "\n{" + "{" + x + "}}"; // add to the end of the article
document.getElementById('wpSummary').value = "Tagging with {" + "{" + x + "}} using [[WP:US/S|user scripts]]";
document.getElementById('wpPreview').click();
Line 26:
i++;
}
h += "</div><div id='stubtagmenudiv' style='color: #000000; background-color: #fffff8;'></div>";
document.getElementById("contentSub").innerHTML = h;
}
function stubtagmenurender(
▲ var s = a.responseText.split('<text xml:space="preserve">')[1].split("</text>")[0];
s = s.split("<").join("<").split(">").join(">");
s = s.split(""").join('"').split("&").join('&');
Line 48 ⟶ 44:
function stubtagmenu(x) {
// Fetch the relevant subpage of the WikiProject
$.ajax({
dataType: "text", // "xml"
success: stubtagmenurender
};
}
function stubtagwith(x) {
if (x == null || x === "") return;
___location.href = mw.config.get("wgServer") + mw.config.get("wgScript") + "?title=" + encodeURIComponent(mw.config.get("wgPageName")) + "&action=edit&autoaddstubtag=" + encodeURIComponent(x);
}
|