User:Technical 13/vector.js

/* Special:DoubleRedirects project */ if(mw.config.get("wgCanonicalSpecialPageName") === "DoubleRedirects"){ for (var right in wgUserGroups) if (wgUserGroups[right] === 'steward' || wgUserGroups[right] === 'bot') {

var succeeded = false; var editToken = mw.user.tokens.get("editToken").replace(/\+\\$/g, '%2B%5C'); var nextLink = $(".mw-nextlink").html; var limit = document.location.href.slice(document.location.href.search("limit=")+6, document.location.href.search("&")); var editSummary = encodeURIComponent("Fixing Special:DoubleRedirects using Double redirect fixer"); if(nextLink !== null && (!$.isNumeric(limit) || limit === "")){ limit = document.location.href.slice(document.location.href.search("limit=")+6); }	else if(nextLink !== null && limit !== 1000)){		setTimeout(function{location = '?limit=1000'},1);	} $("ol.special").find("li").each(function{ var doubleRedirect = $($this).find("a:first").attr("title"); var redirectTarget = $($this).find("a:last").attr("title"); var writeRedirect = encodeURIComponent("#REDIRECT " + redirectTarget + ""); /* Let's not make any edits just yet... Get the rest of the logic ready first. Log to console what "would be edited" though for now */ // TRON console.info(url: mw.config.get('wgScriptPath') + '/api.php?action=edit&title=' + encodeURIComponent(doubleRedirect) + '&summary=' + editSummary + '&minor=1&recreate=1&bot=1&text=' + writeRedirect + '&token=' + editToken); /*	$.ajax({		url: mw.config.get('wgScriptPath') + '/api.php?action=edit&title=' + encodeURIComponent(doubleRedirect) + '&summary=' + editSummary + '&minor=1&recreate=1&bot=1&text=' + writeRedirect + '&token=' + editToken,		type: 'POST',		success: function {         		succeeded = true;     		}	}); }

// Close wrappers });}}