User:Seresin/monobook.js

From Wikipedia, the free encyclopedia
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:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinkleprod.js');
importScript('User:AzaToth/twinklexfd.js');
importScript('User:AzaToth/twinkledeprod.js');
importScript('User:AzaToth/twinklediff.js');
importScript('User:AzaToth/twinkleunlink.js');


TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'tab',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       " using [[WP:TWINKLE|TW]]",
        deletionSummaryAd               :       " using [[WP:TWINKLE|TW]]",
        protectionSummaryAd             :       " using [[WP:TWINKLE|TW]]",
        watchSpeedyPages                :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchProdPages                  :       true,
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ 'agf', 'norm', 'vand', 'torev' ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
        deleteTalkPageOnDelete          :       false,
        watchWarnings                   :       true,
        markAIVReportAsMinor            :       true,
        markSpeedyPagesAsMinor          :       false,
        markProdPagesAsMinor            :       true,
        confirmUsernameToAIV            :       true,
        toolboxButtons                  :       [ ],
showRollbackLinks : [ 'diff', 'contribs' ]
};

//end twinkle

//<pre><nowiki>
function countedit() {
  countuser = mw.config.get('wgTitle').split( '/' )[0];
  if( mw.config.get('wgNamespaceNumber') == '-1' && mw.config.get('wgTitle') == 'Contributions' )
    countuser = document.getElementById( 'contentSub' ).getElementsByTagName( 'a' )[0].getAttribute('title').split(':')[1];
  alert("Please remember that Editcountitis can be fatal and that WikiProject \n User Scripts can not be held responsible :p");
  location.href = 'http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=' + countuser + '&site=en.wikipedia.org'
}
 
function addcountedit() { 
  if( mw.config.get('wgNamespaceNumber') == '2' || mw.config.get('wgNamespaceNumber') == '3' ) { 
  mw.util.addPortletLink('p-cactions', 'javascript:countedit()', "edit count"); } 
  if( mw.config.get('wgNamespaceNumber') == '-1' && mw.config.get('wgTitle') == 'Contributions' ) {
  mw.util.addPortletLink('p-cactions', 'javascript:countedit()', "edit count"); }
 
}
 
$(addcountedit);
 
$(function() {
  //add to tb: {{fullurl:Wikipedia:Articles for deletion/Log/{{CURRENTYEAR}}_{{CURRENTMONTHNAME}}_{{CURRENTDAY}}|action=edit}}
  var now = new Date(); var url = '';
  var mn = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  url += mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Wikipedia:Articles_for_deletion/Log/';
  url += now.getUTCFullYear() + '_' + mn[now.getUTCMonth()] + '_' + now.getUTCDate();
  mw.util.addPortletLink('p-tb', url, 'AFD/today', 'ca-afd', 'AFD for today');
})

//</nowiki></pre>

//use search start—————————

if(mw.config.get('wgNamespaceNumber')==2||wgNamespaceNumber==3) addOnloadHook(function() {
  var n = mw.config.get('wgTitle');
  if(n.indexOf('/')!=-1)  n = n.substring(0,mw.config.get('wgTitle').indexOf('/'))
  mw.util.addPortletLink('p-tb', mw.config.get('wgScript') + '?title=Special:Listusers&username=' + n,'User Search','t-usersearch','Special:Listusers&username=' + n);
})

//user search end—————————


importScript('User:Gracenotes/rollback.js');

importScript('User:Mr.Z-man/closeAFD.js');

//mass delete start————————————
//s
function doMassDelete() {
    document.getElementById("wpMassDeleteSubmit").disabled = true;
    var articles = document.getElementById("wpMassDeletePages").value.split("\n");
    for(i=0;i<articles.length;i++) {
        var article = articles[i];
        if(article.length > 0) {
            var req = new XMLHttpRequest();
            req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json&action=query&prop=info&intoken=delete&titles=" + article, false);
            req.send(null);
            var response = eval("(" + req.responseText + ")").query.pages;
            for(var index in response) {
                var info = response[index];
                var deletetoken = info.deletetoken;
                var postdata = "wpReason=" + (document.getElementById("wpMassDeleteReasons").value == "other" ? document.getElementById("wpMassDeleteReason").value : document.getElementById("wpMassDeleteReasons").value)
                             + "&wpEditToken=" + encodeURIComponent(deletetoken);
                var req = new XMLHttpRequest();
                req.open("POST", mw.config.get('wgScript') + "?title=" + article + "&action=delete", false);
                req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                req.setRequestHeader("Content-length", postdata.length);
                req.send(postdata);
                var deleted = parseInt(parseInt(i)+1);
                document.getElementById("wpMassDeleteSubmit").value = "(" + deleted + ")";
            }
        }
        if(!articles[i+1]) {
            document.getElementById("wpMassDeleteSubmit").value = "Done (" + deleted + ")";
        }
    }
}
 
function massdeleteform() {
    var bodyContent = (skin == "cologneblue" ? "article" : "bodyContent");
    document.getElementsByTagName("h1")[0].textContent = "Animum's mass-deletion tool";
    document.title = "Animum's mass-deletion tool - Wikipedia, the free encyclopedia";
    document.getElementById(bodyContent).innerHTML = '<h3 id="siteSub">From Wikipedia, the free encyclopedia</h3><br /><br />'
        + '<form id="wpMassDelete" name="wpMassDelete">'
        + '<b>If you abuse this tool, it\'s <i>your</i> fault, not mine.</b>'
        + '<br /><br />'
            + 'Pages to delete (one on each line, please):<br />'
                + '<textarea tabindex="1" accesskey="," name="wpMassDeletePages" id="wpMassDeletePages" rows="10" cols="80"></textarea>'
            + '<br /><br /><table style="background-color:transparent">'
                + '<tr><td>Common reasons:</td>'
                    + '<td><select id="wpMassDeleteReasons">'
                        + '<optgroup label="Other reason">'
                            + '<option value="other">Other reason</option>'
                        + '</optgroup>'
                        + '<optgroup label="Criteria for speedy deletion">'
                            + '<optgroup label="General criteria">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G1|Criterion G1]]: [[Wikipedia:Patent nonsense|Patent nonsense]]">G1: Patent nonsense</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G2|Criterion G2]]: Test page">G2: Test page</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G3|Criterion G3]]: Pure [[Wikipedia:Vandalism|vandalism]], including the redirects created from the cleanup of page-move vandalism">G3: Vandalism</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G4|Criterion G4]]: Recreation of material previously deleted per an XfD">G4: Repost</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G5|Criterion G5]]: Page created by a [[Wikipedia:List of banned users|banned user]]">G5: Banned</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G6|Criterion G6]]: Non-controversial maintenance, including deleting a page to merge histories, or to make way for an uncontroversial move">G6: Maintenance</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G7|Criterion G7]]: Only one editor has made significant edits to this page, and he or she has blanked it or requested its deletion">G7: Author</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G8|Criterion G8]]: Talk page whose corresponding article does not exist">G8: Talkpage</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G10|Criterion G10]]: [[Wikipedia:Attack page|Attack page]]">G10: Attack page</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G11|Criterion G11]]: [[Wikipedia:Spam|Blatant advertising]]">G11: Advertising</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#G12|Criterion G12]]: Blatant [[Wikipedia:Copyrights|copyright]] infringement">G12: Copyvio</option>'
                            + '</optgroup>'
                            + '<optgroup label="Articles">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A1|Criterion A1]]: Very short article providing little or no context">A1: No context</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A2|Criterion A2]]: Article written in a foreign language that exists on another Wikimedia project">A2: Foreign</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A3|Criterion A3]]: No content except possibly external links, a \'See also\' section, category tags, or attempts to correspond with the article\'s subject">A3: No content</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A5|Criterion A5]]: Properly transwikied elsewhere">A5: Transwiki</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A7|Criterion A7]]: Biographical article that did not assert the [[Wikipedia:Notability (people)|significance]] of its subject">A7: Non-notable person</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A7|Criterion A7]]: Article about a web site or other online forum that did not assert the [[Wikipedia:Notability (web)|significance]] of its subject">A7: Non-notable website</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A7|Criterion A7]]: Article about a company that did not assert the [[Wikipedia:Notability (organizations and companies)|significance]] of its subject">A7: Non-notable corporation</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A7|Criterion A7]]: Article about a club or group that did not assert the significance of its subject">A7: Non-notable club</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#A7|Criterion A7]]: Article about a band that did not assert the [[Wikipedia:Notability (music)|significance]] of its subject">A7: Non-notable band</option>'
                            + '</optgroup>'
                            + '<optgroup label="Redirects">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#R1|Criterion R1]]: Redirect to non-existent page">R1: Non-existent</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#R2|Criterion R2]]: Redirect to the \'Talk:\', \'User talk:\', or \'User:\' namespaces from the mainspace">R2: Cross-namespace</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#R3|Criterion R3]]: Redirect based on an implausible typo">R3: Implausible typo</option>'
                            + '</optgroup>'
                            + '<optgroup label="Images and other media">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I1|Criterion I1]]: Exact copy of a preexisting image">I1: Copy</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I2|Criterion I2]]: Corrupt or empty image">I2: Corrupt or empty</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I3|Criterion I3]]: Licensed for non-commercial use only, non-derivative use or used with permission, uploaded on or after May 19, 2005, and does not meet the non-free content criteria">I3: Non-commercial</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I4|Criterion I4]]: Image that has lacked sources or licensing information for more than seven days">I4: Unknown source</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I5|Criterion I5]]: Unfree image that has not been used in an article for more than seven days">I5: Unfree and unused</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I6|Criterion I6]]: No [[Wikipedia:Non-free use rationale guideline|justification]] given for fair use for more than seven days">I6: No rationale</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I7|Criterion I7]]: Bad [[Wikipedia:Non-free use rationale guideline|justification]] given for fair use and the uploader was notified more than 48 hours ago">I7: Bad fair use rationale</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I8|Criterion I8]]: Identical copy of this image exists on Wikimedia Commons">I8: On Commons</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I9|Criterion I9]]: Uploader claims that this image is under a free license, but obviously is not">I9: Image copyvio</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I10|Criterion I10]]: Image was neither image, sound, nor video, and has no foreseeable encyclopedic use">I10: Useless image</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#I11|Criterion I11]]: Permission has not been verified within seven days of the uploader\'s notification">I11: No permission</option>'
                            + '</optgroup>'
                            + '<optgroup label="Categories">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#C1|Criterion C1]]: Category has been unpopulated for at least 4 days">C1: Empty</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#C2|Criterion C2]]: Eligible for [[Wikipedia:Categories for discussion/Speedy#Speedy criteria|speedy renaming]]">C2: Speedy rename</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#C3|Criterion C3]]: Category was populated solely by a template, and that template has been deleted per deletion policy">C3: Populating template was deleted</option>'
                            + '</optgroup>'
                            + '<optgroup label="User namespace">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#U1|Criterion U1]]: User or user subpage of which the corresponding user requests deletion">U1: User requests deletion</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#U2|Criterion U2]]: Userpage of a non-existent user">U2: Non-existent user</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#U3|Criterion U3]]: Userpage that is primarily a gallery of fair-use images">U3: Fair use gallery</option>'
                            + '</optgroup>'
                            + '<optgroup label="Templates">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#T1|Criterion T1]]: Divisive or inflammatory template">T1: Inflammatory</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#T2|Criterion T2]]: Blatant misrepresentation of established policy">T2: Blatant misrepresentation</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#T3|Criterion T3]]: Template was not employed in any useful fashion, either a substantial duplicate or a hardcoded instance of a preexisting template, and was tagged for seven days">T3: Duplicate</option>'
                            + '</optgroup>'
                            + '<optgroup label="Portals">'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#P1|Criterion P1]]: Portal that would be subject to deletion as an article">P2: Deletion as article</option>'
                                + '<option value="[[Wikipedia:Criteria for speedy deletion#P2|Criterion P2]]: Underpopulated portal">P2: Underpopulated</option>'
                            + '</optgroup>'
                        + '</optgroup>'
                    + '</select></td></tr>'
            + '<tr><td>Other reason:</td>'
                + '<td><input type="text" id="wpMassDeleteReason" name="wpMassDeleteReason" maxlength="255" /></td></tr>'
                + '<tr><td><input type="button" id="wpMassDeleteSubmit" name="wpMassDeleteSubmit" value="Delete" onclick="doMassDelete()" /></td>'
        + '</form>';
}
 
$(function() {
    if(mw.config.get('wgNamespaceNumber') == -1 && (mw.config.get('wgPageName') == "Special:Massdelete" || mw.config.get('wgPageName') == "Special:MassDelete") && RegExp("sysop", "i").test(mw.config.get('wgUserGroups'))) {
        massdeleteform();
        document.getElementById("wpMassDeleteReasons").onchange = function() {
            document.getElementById("wpMassDeleteReason").disabled = (document.getElementById("wpMassDeleteReasons").value != "other"); //If the "Other reason" option isn't selected, disable the "Other reason" input box.
        }
    }
});
//endmassdelete—————————
//startdeleterevision
importScript('User:Animum/urlparameters.js');
importScript('User:Animum/formatresponse.js');
 
function makeLink(color, link, text, br) {
    var span = document.createElement("span");
    span.id = "delete-revision";
    var b = document.createElement("b");
    b.appendChild(document.createTextNode(" ["));
    span.appendChild(b);
    var na = document.createElement("a");
    na.href = link;
    var span2 = document.createElement("span");
    span2.style.color = color;
    span2.style.fontWeight = "bold";
    span2.appendChild(document.createTextNode(text));
    na.appendChild(span2);
    span.appendChild(na);
    var b2 = document.createElement("b");
    b2.appendChild(document.createTextNode("]"));
    span.appendChild(b2);
 
    return span;
}
 
function deleteRevision(title_, timestamp) {
    var req = sajax_init_object();
    req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json&action=query&prop=info&inprop=protection&titles=" + title_, false);
    req.send(null);
    var info = formatResponse(eval("(" + req.responseText + ")"));
    var protlevels = {};
    if(info.protection) {
        for(a=0;a<2;a++) {
            if(info.protection[a]) {
                var protection = info.protection[a];
                protlevels[protection.type] = protection.level;
                protlevels["expiry"] = protection.expiry;
            }
        }
    }
    var addition = new Date();
    addition = new Date(addition.getTime() + 1000*25);
    if(protlevels.edit || protlevels.move) { 
        document.cookie = "protectionparams=" + (protlevels.edit ? "mwProtect-level-edit=" + protlevels.edit : "")
                        + (protlevels.move ? (protlevels.edit ? "&" : "") + "mwProtect-level-move=" + protlevels.move : "")
                        + "&mwProtect-reason=" + encodeURIComponent("Restoring original protection levels")
                        + (protlevels.expiry == "infinity" ? "" : "&mwProtect-expiry=" + protlevels.expiry)
                        + "; path=/; expires=" + addition.toGMTString() + ";";
    }
    document.cookie = "protectiontitles=" + title_ + "; path=/; expiry=" + addition.toGMTString() + ";";
    var link = mw.config.get('wgScript') + "?title=Special:Undelete/" + title_ + "&page=" + title_ + "&norestore=";
    var req = sajax_init_object();
    req.open("GET", mw.config.get('wgScript') + "?title=Special:Undelete/" + title_, false);
    req.send(null);
    var deletedrevs = req.responseText.split("<fieldset>")[1];
    if(deletedrevs) {
        deletedrevs2 = deletedrevs.split("<ul>")[1].split("</ul>")[0].split("<li>");
        for(x=1;x<deletedrevs2.length;x++) {
            if(deletedrevs2[x].split("</li>")[0].split('name="ts')[1]) {
                link += deletedrevs2[x].split("</li>")[0].split('<input name="ts')[1].split('"')[0] + "|";
            }
        }
    }
    var req = sajax_init_object();
    req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json&action=query&prop=info&intoken=delete&titles=" + title_, false);
    req.send(null);
    var deletetoken = formatResponse(eval("(" + req.responseText + ")")).deletetoken;
    var reason = prompt("Optional reason (leave blank for default):");
    var postdata = "wpReason=" + (reason.length > 0 ? encodeURIComponent(reason) : encodeURIComponent("Deleting to expunge a revision from this page's history."))
                 + "&wpEditToken=" + encodeURIComponent(deletetoken);
    var req = sajax_init_object();
    req.open("POST", mw.config.get('wgScript') + "?title=" + title_ + "&action=delete", true);
    req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    req.setRequestHeader("Content-length", postdata.length);
    req.send(postdata);
    req.onreadystatechange = function() {
        if(req.status == 200 && req.readyState == 4) {
            location.href = link + timestamp;
        }
    }
}
 
$(function() {
    if(/[?&]diff=/.test(location.href)) {
        if(document.getElementById("mw-diff-ntitle1")) {
            var article = document.getElementById("mw-diff-ntitle1").getElementsByTagName("a")[0].href.split("?title=")[1].split("&")[0];
            var oldid = document.getElementById("mw-diff-ntitle1").getElementsByTagName("a")[0].href.split("oldid=")[1].split("&")[0];
            var req = sajax_init_object();
            req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json&action=query&prop=revisions&rvlimit=2&rvstartid=" + oldid + "&titles=" + article, false);
            req.send(null);
            var info = formatResponse(eval("(" + req.responseText + ")"));
            if(info.revisions) {
                var timestamp = info.revisions[0].timestamp.replace(/[^0-9]/g, "");
 
                var link = makeLink("#FF7133", "javascript:deleteRevision(\"" + article + "\", '" + timestamp + "')", "delete revision", true);
                getElementsByClassName(document, "td", "diff-ntitle")[0].insertBefore(link, document.getElementById("mw-diff-ntitle4"));
            }
        }
    }
    if(mw.config.get('wgPageName') == "Special:Undelete") {
        if(UrlParameters["norestore"]) {
            var inputs = document.getElementsByTagName("input");
            for(i=0;i<inputs.length;i++) {
                var input = inputs[i];
                if(input.type == "checkbox") {
                    input.checked = true;
                }
                var norestore_timestamps = UrlParameters["norestore"].split("|");
                for(n=0;n<norestore_timestamps.length;n++) {
                    if(input.name.indexOf("ts" + norestore_timestamps[n]) != -1 || input.checked == false) {
                        input.checked = false;
                    }
                }
            }
            document.getElementById("wpComment").value = "Expunging revision from page history.";
            document.getElementById("mw-undelete-submit").click();
        }
        if(UrlParameters["action"] == "submit" && document.cookie.search(/protectionparams/) != -1 && document.cookie.search(/protectiontitles/) != -1) {
            var title_ = document.cookie.split("protectiontitles=")[1].split(";")[0];
            var req = sajax_init_object();
            req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json&action=query&prop=info&intoken=protect&titles=" + title_, false);
            req.send(null);
            var info = formatResponse(eval("(" + req.responseText + ")"));
            var postdata = document.cookie.split("protectionparams=")[1].split(";")[0] + "&wpEditToken=" + encodeURIComponent(info.protecttoken) + "&wpProtectReasonSelection=other";
            var req = sajax_init_object();
            req.open("POST", mw.config.get('wgScript') + "?title=" + title_ + "&action=protect", true);
            req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            req.setRequestHeader("Content-length", postdata.length);
            req.send(postdata);
            req.onreadystatechange = function() {
                if(req.status == 200 && req.readyState == 4) {
                    document.getElementById("contentSub").innerHTML += "<br /><b>Original protection levels have been restored.</b>";
                }
            }
        }
    }
});
//enddeleterevision—————————
//startrevertmove—————————
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(mw.config.get('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;
    }
}
 
$(function() {
    if(mw.config.get('wgNamespaceNumber') == -1 && mw.config.get('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))) {
        mw.util.addPortletLink("p-cactions", "javascript:doMoveRV()", "pagemove", "ca-pagemove");
    }
});
//endrevert
//startsecurelink
$(function() {
	if (mw.config.get('wgServer') != 'https://secure.wikimedia.org') return;
 
	var re = /^http\:\/\/(.*?)\.wikipedia\.org(\/.*?)$/;
	var links = document.getElementsByTagName('a');
	for (var i = links.length; i--;) {
		var link = links[i];
		if (matches = link.href.match(re)) {
			if (matches[1] == 'mail') continue;
			if (matches[2] == '/') matches[2] = '/wiki/';
			var n = 'https://secure.wikimedia.org/wikipedia/' + matches[1] + matches[2];
			link.href = n; link.title = n;
			if (link.innerHTML.match(re)) link.innerHTML = n;
		}
	}
});


importScript('User:Ale_jrb/Scripts/csdhelper.js');  //[[User:Ale_jrb/Scripts]]

importScript('User:Ale_jrb/Scripts/userhist.js');  //[[User:Ale_jrb/Scripts]]

hookEvent ( 'load', function () { if ( typeof Ethnio !== 'undefined' ) { Ethnio.set_cookie (); } });