User:MC10/stubtagtab.js: Difference between revisions

Content deleted Content added
re-indent a, add error function
more fixing up with script
Line 43:
var $parseData = $(data.parse.text["*"]);
$parseData.find("a").each(function () {
var $link = $(this).attr("href"),
index = $link.indexOf("Template:")
if (index === -1) {
$(this).attr({
Line 55:
});
} else {
$(this).attr("href", mw.config.get("wgServer") + mw.config.get("wgScript")
+ "?title=" + encodeURIComponent(mw.config.get("wgPageName"))
+ "&action=edit&autoaddstubtag=" + encodeURIComponent($link.slice(index + 9)));
}
});
Line 80 ⟶ 81:
 
$(function () {
if (mw.config.get("wgNamespaceNumber") === 0 && mw.config.get("wgAction") === "view"
&& document.getElementById$("ca-edit") !== 0) {
var portletLink = mw.util.addPortletLink('p-cactions', '#', 'Stub', 'ca-stubtag', 'Add a stub tag to this page', '');
$(portletLink).click(function (e) {
Line 88 ⟶ 90:
});
}
if (___location.href.indexOf("&autoaddstubtag=") !== -1 && document.getElementById$('"#wpTextbox1'").length !== null0) {
var x = decodeURIComponent(___location.href.split("&autoaddstubtag=")[1]);
if (x.indexOf("-stub") === -1) x += "-stub";