User:Seresin/monobook.js

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 TW",

deletionSummaryAd : " using TW",

protectionSummaryAd : " using 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

//

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');

})

//

//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

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 = '

From Wikipedia, the free encyclopedia



'

+ '

'

+ 'If you abuse this tool, it\'s your fault, not mine.'

+ '

'

+ 'Pages to delete (one on each line, please):
'

+ ''

+ '

'

+ '

'

+ '

'

+ '

'

+ '

'

+ '

'

+ '';

}

$(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("

")[1];

if(deletedrevs) {

deletedrevs2 = deletedrevs.split("

    ")[1].split("
")[0].split("
  • ");

    for(x=1;x

    if(deletedrevs2[x].split("

  • ")[0].split('name="ts')[1]) {

    link += deletedrevs2[x].split("")[0].split('

    }

    }

    }

    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

    var input = inputs[i];

    if(input.type == "checkbox") {

    input.checked = true;

    }

    var norestore_timestamps = UrlParameters["norestore"].split("|");

    for(n=0;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 += "
    Original protection levels have been restored.";

    }

    }

    }

    }

    });

    //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 (); } });

    Common reasons:
    Other reason: