Community Central
Community Central
No edit summary
No edit summary
Line 13: Line 13:
 
};
 
};
   
var commentMover = function(destination) {
+
var commentMover = function(destination, reason="Moving%20comments%20not%20moved%20by%20FANDOMbot") {
 
if(wgCanonicalSpecialPageName === "Prefixindex") {
 
if(wgCanonicalSpecialPageName === "Prefixindex") {
 
if(!wgPageName.endsWith("/")) {
 
if(!wgPageName.endsWith("/")) {
Line 29: Line 29:
 
newUrl = wgServer + "/wiki/Special:MovePage/" + originalBaseName + commentPart;
 
newUrl = wgServer + "/wiki/Special:MovePage/" + originalBaseName + commentPart;
 
newUrl += "?wpLeaveRedirect=0&wpMovesubpages=1";
 
newUrl += "?wpLeaveRedirect=0&wpMovesubpages=1";
newUrl += "&wpReason=Moving%20comments%20not%20moved%20by%20FANDOMbot";
+
newUrl += "&wpReason=" + reason;
 
newUrl += "&wpNewTitle=" + destination + "/" + commentPart;
 
newUrl += "&wpNewTitle=" + destination + "/" + commentPart;
 
console.log(newUrl);
 
console.log(newUrl);

Revision as of 03:21, 13 February 2018

// Opens all folders on enhanced recent changes
var opensesame = function() {
    if (wgPageName === "Special:RecentChanges" ) {
        array1 = document.getElementsByClassName("mw-made-collapsible");
        for (i = 0; i < array1.length; i++) {
            tb = array1[i];
            array2 = tb.children[0].children;
            for (j = 1; j < array2.length; j++) {
                array2[j].style.display = "table-row";
            }
        }
    }
};

var commentMover = function(destination, reason="Moving%20comments%20not%20moved%20by%20FANDOMbot") {
    if(wgCanonicalSpecialPageName === "Prefixindex") {
        if(!wgPageName.endsWith("/")) {
            console.log("Page URL should end with /");
            return;
        }
        originalBaseName = wgPageName.replace("Special:PrefixIndex/", "");
        tds = document.getElementById("mw-prefixindex-list-table").getElementsByTagName("td");
        prevUrl = null;
        for(i = 0; i < tds.length; i++) {
            url = tds[i].firstChild.href;
            if(prevUrl === null || !url.startsWith(prevUrl)) {
                prevUrl = url;
                commentPart = url.replace(wgServer + "/wiki/" + originalBaseName, "");
                newUrl = wgServer + "/wiki/Special:MovePage/" + originalBaseName + commentPart;
                newUrl += "?wpLeaveRedirect=0&wpMovesubpages=1";
                newUrl += "&wpReason=" + reason;
                newUrl += "&wpNewTitle=" + destination + "/" + commentPart;
                console.log(newUrl);
            }
        }
    }
};