Jump to content

User:Animum/moveRV.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Animum (talk | contribs) at 21:39, 14 September 2008 (update). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:Animum/urlparameters.js');
importScript('User:Animum/formatresponse.js');
importScript('User:Animum/moveRV-movefunc.js');

function zeroPad(str) {
    return ("0" + str).slice(-2);
}

var isSysop = /sysop/.test(wgUserGroups);

function doMoveRV() {
    var domove = confirm("All of the moves listed on this page will be reverted" + (isSysop ? ", and the resulting redirects will be deleted" : "") + ".\n\nClick \"OK\" to proceed or \"Cancel\" to abort.");
    if(domove) {
        revertmoves(); //Function contained in moveRV-movefunc.js
    } else {
        return;
    }
}

addOnloadHook(function() {
    if(wgNamespaceNumber == -1 && wgCanonicalSpecialPageName == "Log" && (UrlParameters["type"] == "move" || location.href.substring(location.href.indexOf("title=") + 6).split("/")[1] == "move" || location.href.substring(location.href.indexOf("/wiki/") + 6).split("?")[0].split("/")[1] == "move") && (UrlParameters["user"] || location.href.substring(location.href.indexOf("user=") + 5))) {
        addPortletLink("p-cactions", "javascript:doMoveRV()", "pagemove", "ca-pagemove");
    }
});