User:KarlRankin/monobook.js

// // User:Lupin/popups.js

mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'             + '&action=raw&ctype=text/javascript&dontcountme=s');

popupAdminLinks=true;

// Filter changes live // User:Lupin/recent2.js - please include this line document.write(' ');

// Useful stuff from WikiProject_User_scripts

function addToolboxLink(url, name, id){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, url, name, id); }

function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) { if(key && title) ta[id] = [key, title]; else if(key)    ta[id] = [key, '']; else if(title)  ta[id] = ['', title]; } // re-render the title and accesskeys from existing code in wikibits.js  akeytt; return li; }

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; addlilink(tabs, url, name, id, title, key); }

function addPurge{ ta['ca-purge'] = ['g', 'Purge the internal cache for this page']; var x = document.getElementById('ca-history'); if(!x) return; if(x.children) x = x.children[0].href; else x = x.childNodes[0].href; addTab(x.replace(/=history/, "=purge"), 'purge', 'ca-purge'); akeytt; }

// culled from User:Lupin/popups.js

function nichalp_articleFromURL(h) { if (typeof h != 'String') h=String(h); h=decodeURI(h); var m=RegExp('[^:]*://en\\.wikipedia\\.org/(wiki/|w/index\\.php\\?title=)([^&?]*)').exec(h); if(m===null) return null; return m[2]; }

function nichalp_isIpUser(user) { return RegExp('(User:)?' +                '((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}' +                 '(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])') .test(user); }

function nichalp_removeAnchor(article) { // is there a #? if not, we're done var i=article.indexOf('#'); if (i == -1) return article; return article.substring(0,i); }

function nichalp_userName(article) { var i=article.indexOf('User'); var j=article.indexOf(':'); if (i != 0 || j == -1) return null; var k=article.indexOf('/'); if (k==-1) return article.substring(j+1); else return article.substring(j+1,k); }

// do it

function nichalp_customLinks { addPurge; var article=nichalp_articleFromURL(document.location.href); if (!article) return; var user=nichalp_userName(article); if(!user) return; user=nichalp_removeAnchor(user); if (!nichalp_isIpUser(user)) { addToolboxLink('http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki&user='+user, user+"'s edit count", 'toolbox_katestool'); } var special='http://en.wikipedia.org/w/index.php?title=Special:'; addToolboxLink(special + 'Log&user='+user, user+"'s log", 'toolbox_userlog'); addToolboxLink(special + 'Blockip&ip='+user, 'Block '+user, 'toolbox_blockuser'); addToolboxLink(special + 'Ipblocklist&action=unblock&ip='+user, 'Unblock '+user, 'toolbox_unblockuser'); }

// make it all happen on page load

if (window.addEventListener) window.addEventListener("load",nichalp_customLinks,false); else if (window.attachEvent) window.attachEvent("onload",nichalp_customLinks); else { window._old_nichalp_onload = window.onload; window.onload = function { window._old_nichalp_onload; nichalp_customLinks; } }

// Add a "Kate" link to your monobook "personal menu" list at the very // top of the page. // // Indicate where you would like "Kate" to appear: //   pt-userpage, pt-mytalk, pt-preferences, //   pt-watchlist, pt-mycontris, pt-logout // gsKateInsertBefore = 'pt-mycontris'; // leave blank to append after "logout"

function KateLink {  var user = document.getElementById( 'pt-userpage').firstChild.firstChild.data; var li = document.createElement( 'li' ); li.id = 'pt-kate'; var a = document.createElement( 'a' ); a.appendChild( document.createTextNode( 'Interiot\'s Tool' ) ); // eh, the css makes the text lowercase a.href = 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=enwiki_p&user=' + user;

li.appendChild( a ); if ( ! gsKateInsertBefore ) // append to end (right) of list {     document.getElementById( 'pt-logout' ).parentNode.appendChild( li ); }  else {      var before = document.getElementById( gsKateInsertBefore ); before.appendChild( li, before ); } } if ( window.addEventListener ) window.addEventListener( 'load', KateLink, false ); else if ( window.attachEvent ) window.attachEvent( 'onload', KateLink );

//this helps automate AfD closing by adding a 'close' tab to AfD debates //written by User:Johnleemk based on WikiProject User scripts/Scripts/test-n.js by User:Celestianpower

function afdaddlilink(url, name) { var na = document.createElement('a'); na.setAttribute('href', url);

var txt = document.createTextNode(name); na.appendChild(txt);

var li = document.createElement('li'); li.appendChild(na); return li; }

function result { var close = prompt("Result of debate?") var f = document.editform, t = f.wpTextbox1; t.value = " " + close + ". " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value; if (t.value.length > 0) t.value += '\n'; t.value += ""; f.wpSummary.value = "Close as " + close; }

function relist { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "~" + "~" + "~" + "~"; f.wpSummary.value = "Relisting debate"; }

function keep { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD"; }

function no_consensus { var date = prompt("Nomination was made when?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article survived AfD with no consensus"; }

function redirect { var date = prompt("Nomination was made when?") var redirect = prompt("Redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article redirected to " + redirect + " as per AfD"; }

function merge { var date = prompt("Nomination was made when?") var redirect = prompt("Merge and redirect to?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "Article merged and redirected to " + redirect + " as per AfD"; }

function other { var date = prompt("Nomination was made when?") var result = prompt("Result was?") var votepage = prompt("Vote page is? (Enter 'd' for default.)") var f = document.editform, t = f.wpTextbox1;

// If default votepage... if (votepage=="d") {       var temp = document.editform.action.split("/w/index.php?title="); var temp = temp[1].split("&action=submit"); var temp = temp[0].substring(5); var votepage = temp; }

t.value = "" + '\n' + '\n' + t.value; f.wpSummary.value = "AfDed; result was " + result; }

function add_afd_tabs { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

// Only add for pages with the right string somewhere in the title if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1) {     tabs.appendChild(afdaddlilink('javascript:result',"close")); tabs.appendChild(afdaddlilink('javascript:relist',"relist")); } if (document.title.indexOf("Editing Talk:") != -1) {     tabs.appendChild(afdaddlilink('javascript:keep',"keep")); tabs.appendChild(afdaddlilink('javascript:no_consensus',"no consensus")); tabs.appendChild(afdaddlilink('javascript:redirect',"redirect")); tabs.appendChild(afdaddlilink('javascript:merge',"merge")); tabs.appendChild(afdaddlilink('javascript:other',"other")); } }

$(add_afd_tabs);

//end AfD closing script

////////////////////////////////////////// // Tabs by Korath // returns  name ///////////////////////////////////////// function addlilink(url, name) { var na = document.createElement('a'); na.setAttribute('href', url);

var txt = document.createTextNode(name); na.appendChild(txt);

var li = document.createElement('li'); li.appendChild(na); return li; }

// appends msg to the currently-editted page, sets the summary to summ, // and marks or unmarks the Watch this page checkbox according to watch. function edit_summary_watch(msg, summ, watch) { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += msg; f.wpSummary.value = summ; }

function test { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += " -" + " " + "~" + "~" + "~" + "~"; f.wpSummary.value = "Thanks for testing out Wikipedia!"; }

function testn(number) { var page = prompt("Vandalism to which article?") var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "" + page + " -" + " " + "~" + "~" + "~" + "~"; if (t.value > 2) f.wpSummary.value = "Vandalism to " + page + " - warning " + number; else f.wpSummary.value = "Please stop vandalising " + page + "."; }

function blankwarn(number) { var page = prompt("Vandalism to which article?") var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "" + page + " -" + " " + "~" + "~" + "~" + "~"; f.wpSummary.value = "Please stop blanking " + page + "."; }

function bvn(number) { var page = prompt("Vandalism to which article?") var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "" + page + " -" + " " + "~" + "~" + "~" + "~"; f.wpSummary.value = "Stop vandalising " + page + "."; }

// adds various tabs to call the above function add_tabs { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

if (document.title.indexOf("Editing ") != -1) {   tabs.appendChild(addlilink('javascript:protect',"(fp)")); tabs.appendChild(addlilink('javascript:sprotect',"(sp)")); } // Only add for pages with "Editing User talk:" somewhere in the title if (document.title.indexOf("Editing User talk:") != -1) {     //change "move" tab to "m" for more room if(document.getElementById('ca-move')) document.getElementById('ca-move').firstChild.innerHTML = 'm'; if(document.getElementById('ca-history')) document.getElementById('ca-history').firstChild.innerHTML = 'h';

//change "user page" tab to "anon" to put them in their place, HA! if(document.getElementById('ca-nstab-user')) document.getElementById('ca-nstab-user').firstChild.innerHTML = 'anon';

//tabs.appendChild(addlilink('javascript:edit_summary_watch(" -" + " " + "~" + "~" + "~" + "~", "", false, 0)',"Anon")); //tabs.appendChild(addlilink('javascript:edit_summary_watch(" -" + " " + "~" + "~" + "~" + "~", "Welcome!", false, 0)',"Welcome!")); tabs.appendChild(addlilink('javascript:test',"1")); tabs.appendChild(addlilink('javascript:testn(2)',"t2")); tabs.appendChild(addlilink('javascript:blankwarn(2)',"2a")); tabs.appendChild(addlilink('javascript:testn(3)',"t3")); tabs.appendChild(addlilink('javascript:testn(4)',"t4"));

tabs.appendChild(addlilink('javascript:bvn(1)',"bv"));

tabs.appendChild(addlilink('javascript:edit_summary_watch(": -" + " " + "~" + "~" + "~" + "~", "Blocked user!", true, 1)',"5")); } if (document.title.indexOf("Editing Wikipedia:Articles for deletion") != -1) {       tabs.appendChild(addlilink('javascript:closeafd("keep", "")', 'Keep', '')); tabs.appendChild(addlilink('javascript:closeafd("delete", "")', 'Delete', '')); tabs.appendChild(addlilink('javascript:closeafd(prompt("Result?"), "")', 'Other', '')); } }

function protect { document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = '+'; window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Protected_page#Full_protection',             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes'); }

function sprotect { document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value = '+'; window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Protected_page#Semi-protection',             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes'); }

function addEditSection0 { ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page']; if (!document.getElementById) return; x = document.getElementById('ca-edit'); if(!x) return; y = document.createElement('LI'); y.id = 'ca-edit-0'; if (x.className == 'selected') { if (/&action=edit&section=0$/.test(window.location.href)) { x.className = 'istalk'; y.className = 'selected'; } else { x.className = 'selected istalk'; } } else if (x.className == 'selected istalk') { if (/&action=edit&section=0$/.test(window.location.href)) { x.className = 'istalk'; y.className = 'selected istalk'; } else { y.className = 'istalk'; } } else { y.className = x.className; x.className = 'istalk'; } z = document.createElement('A'); if (x.children) { z.href = x.children[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling); } else { z.href = x.childNodes[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling); } }

function shortTabs { if(document.getElementById('ca-edit')) document.getElementById('ca-edit').firstChild.innerHTML = 'edit';

if(document.getElementById('ca-protect')) document.getElementById('ca-protect').firstChild.innerHTML = 'pro';

if(document.getElementById('ca-talk')) document.getElementById('ca-talk').firstChild.innerHTML = 'talk';

if(document.getElementById('ca-delete')) document.getElementById('ca-delete').firstChild.innerHTML = 'del';

if(document.getElementById('ca-unwatch')) document.getElementById('ca-unwatch').firstChild.innerHTML = 'unw';

if(document.getElementById('ca-watch')) document.getElementById('ca-watch').firstChild.innerHTML = 'w'; }

// ***** Window Load ******

window.onload = Main;

function Main { shortTabs; add_tabs;

if (document.title.indexOf("Editing User talk:") = -1) addEditSection0; }

topaz.statuschanger = new Object;

/* configuration */ // change these to whatever you'd like to show up on your status page. topaz.statuschanger.statuscode = { online:'', busy:'', offline:'' }; /* end configuration */

topaz.statuschanger.oldonload = window.onload; window.onload = function { if (typeof topaz.statuschanger.oldonload == "function") topaz.statuschanger.oldonload; topaz.wputil.addsidepanel("tz-statuschanger", "status changer"); topaz.wputil.addsidepanelbutton("tz-statuschanger", "Online",     'javascript:topaz.statuschanger.setstatus("online")'  ); topaz.wputil.addsidepanelbutton("tz-statuschanger", "Busy",     'javascript:topaz.statuschanger.setstatus("busy")'  ); topaz.wputil.addsidepanelbutton("tz-statuschanger", "Offline",     'javascript:topaz.statuschanger.setstatus("offline")'  ); };

// User:Quarl/autowarn.js - application for warning bad users.

// Interface for selecting the best warning. Parses a user's contribution // history and presents checkboxes to select which edits to reference in the // warning.

// (Version 1, a more basic implementation, is archived at // User:Quarl/autowarn_basic.js)

// depends: wikipage.js, wikiedit.js, wikitabs.js // enhanced by: advanced_sig.js

// quarl 2006-02-10 version 2 - contribution parsing and such

//

/* TODO

add warn links to history

add warn tab if relevantUser

insert an opening div as with redirector

option for referencing pages vs diffs. default page.

if reqWithPage:  reference first page; then bullets for others if altWithPage and pages: reference first page; then bullets for others

extra parameters

*/

autowarn = new Object;

autowarn.warnings = [ { heading: "Generic testing or vandalism", warnings: [ [ "selftest", "Thanks for reverting your test; use sandbox", {altWithPage:"selftest-n"} ], [ "test1", "Your test worked, and has been reverted", {altWithPage:"test-n"} ], [ "test2", "Stop adding nonsense", {altWithPage:"test2-n"} ], [ "test3", "Stop vandalizing, or face block", {altWithPage:"test3-n"} ], [ "test4", "Last warning, will be blocked", {altWithPage:"test4-n"} ], [ "test4im", "This is your ONLY WARNING, will be blocked" ], [ "test5", "You have been temporarily BLOCKED", {altWithPage:"test5-n"} ], [ "test6", "You have been BLOCKED for repeated vandalism" ], [ "bv", "Blatant vandal" ] ]},   { heading: "Testing - removing content", warnings: [ [ "test1a", "Please don't remove content" ], [ "test2a", "Stop removing content" ] ]},   { heading: "Blanking", warnings: [ [ "blank2", "Don't blank; blanks are harmful" ], [ "blank3", "Stop blanking, or face block" ], [ "blank4", "Last warning, will be blocked" ], [ "blank5", "You have been BLOCKED for blanking" ] ]},   { heading: "Page move vandalism", warnings: [ [ "test2m", "Please do not move to nonsensical" ] ]},   { heading: "Non-notable", warnings: [ [ "nn-test", "Welcome; edits considered non-notable and reverted" ] ]},   { heading: "Bad-faith errors", warnings: [ [ "verror2", "Please stop deliberately introducing errors" ], [ "verror3", "Please stop, or face block" ], [ "verror4", "Last warning, will be blocked" ] ]},   { heading: "Spam", warnings: [ [ "spam1", "Please don't add commercial links" ], [ "spam2", "Please stop spamming" ], [ "spam3", "Last warning, will be blocked" ], [ "spam4", "You have been BLOCKED for spamming" ], ] },   { heading: "3RR", warnings: [ [ "3RR", "Please don't revert more than 3 times in 24 hours" ], [ "3RR2", "Danger of violating 3RR; may be blocked" ], [ "3RR3", "You have been temporarily BLOCKED for violation of 3RR" ] ]},   { heading: "Civility", warnings: [ [ "civil1", "Please be civil; no personal attacks" ], [ "civil2", "Please be civil! No edit wars!" ]         ]},    { heading: "Copyright violation", warnings: [ [ "nothanks", "Please, no copyrighted work", {reqWithPage:"1"} ], [ "nothanks-sd", "Please, no copyright violation of URL - speedy deletion", {reqWithPage:"pg", params:["url"]} ] ]},   { heading: "Miscellaneous", warnings: [ [ "newvoter", "New voter: Your vote may be discounted", {reqWithPage:"1"} ], [ "tilde", "Please sign your posts on Talk pages" ], [ "wr", "Please do not remove warnings" ], ]}   ];

autowarn.run = function {

}

// autowarn.warn = function(template) { //    var pagenames = prompt("Vandalism to which article(s) (separate using &&)?"); //    if (typeof pagenames != 'string') return;

//    wikiPage.getEditorAsync(autowarn._edit, template, pagenames); // }

// autowarn._englishJoin = function(words) { //    if (words.length == 0) { //        return ''; //    } else if (words.length == 1) { //        return words[0]; //    } else if (words.length == 2) { //        return words[0] + ' and ' + words[1]; //    } else { //        words[words.length-1] = 'and ' + words[words.length-1]; //        return words.join(', '); //    } // }

// autowarn._splitPageNames = function(s) { //    var words = s.split('&&'); //    var pages = []; //    for (var i in words) { //        var word = trimspaces(words[i]); //        if (!word) continue; //        word = word.replace(/^\[\[/, ''); //        word = word.replace(/\]\]$/, ''); //        pages.push( + word + ); //    } //     return pages; // }

// autowarn._edit = function(editor, template, pagenames) { //    if (typeof(template) != 'string') { alert("autowarn Internal error 5f95d195-b1c8-4f7e-b751-740230b1926a"); return; }

//    var pagesw = autowarn._splitPageNames(pagenames); //    var pages = autowarn._englishJoin(pagesw);

//    var text = ' ~\n';

//    if (pages) { //        text = ('This message concerns the ' + (pagesw.length==1?'page':'pages') + ' ' + //                 pages + '.  ' + text); //    } //     text = '\n\n' + text;

//    var summary = "Warning "; //    if (pages) { //        summary += ", concerning " + pages; //    }

//    // if (editor.refuseCreate) return; //    editor.wpTextbox1 = trim_lines(editor.wpTextbox1) + text; //    editor.wpSummary = summary; //    editor.submit; // }

autowarn._load = function { if (wikiDoc.relevantUser) { autowarn.tab = wikitabs.addTab('Warn', 'javascript:autowarn.run', 'ca-autowarn', 'Warn a mis-behaving user'); } }

$(autowarn._load);

//

//