User:Sir Nicholas de Mimsy-Porpington 2/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');

/* */

/* Some of these tools are documented at User:Trilobite/Tools. */ /* Many are based on those employed by User:ABCD. */ /* This set-up is tailored to my monobook.css, but that shouldn't make much difference. */ /* Only tested in Firefox so far. */

/* change the names of personal tools links and the edit tab */ function changelinks { if(!document.getElementById) return; document.getElementById('pt-mytalk').firstChild.innerHTML = 'Talk page'; document.getElementById('pt-preferences').firstChild.innerHTML = 'Preferences'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'Watchlist'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'Contributions'; document.getElementById('pt-logout').firstChild.innerHTML = 'Log out'; if(document.getElementById('ca-edit')) document.getElementById('ca-edit').firstChild.innerHTML = 'edit'; }

/* this function is used to add extra tabs and links */ function addlilink(tabs, url, name, id) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); tabs.appendChild(li); return li; }

/* add links to the sidebar toolbox */ function addtoolboxlinks { var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Special:Newpages', 'New pages', ''); addlilink(tb, '/wiki/Category:Candidates_for_speedy_deletion', 'Speedy deletions', ''); addlilink(tb, '/wiki/Wikipedia:Articles_for_deletion/Old', 'VfD backlog', ''); addlilink(tb, '/wiki/Wikipedia:Vandalism_in_progress', 'Vandalism', ''); addlilink(tb, '/wiki/Special:Blockip', 'Block IP', ''); addlilink(tb, '/wiki/Wikipedia:Village_pump_%28all%29', 'Village pump', ''); addlilink(tb, '/wiki/Wikipedia:Administrators%27_noticeboard', 'Noticeboard', ''); addlilink(tb, '/wiki/Wikipedia:Administrators%27_noticeboard/Incidents', 'Incidents', ''); }

/* add a purge tab */ function addpurge { ta['ca-purge'] = ['g', 'Purge the internal cache for this page']; if(!document.getElementById) return; var x = document.getElementById('ca-history'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(!x) return; if(x.children) x = x.children[0]; else x = x.childNodes[0]; addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge'); }

/* add a replace tab in edit mode */ function replace { var s = prompt("Search regexp?"); if(s) { var r = prompt("Replace regexp?"); if(!r && r != '') return; var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); } }

/* add an unverified tab when editing image descriptions */ function unverified { document.editform.wpSummary.value = 'needs a source and copyright tag - see Image copyright tags'; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; txt.focus; } function pui { document.editform.wpSummary.value = 'PUI'; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; txt.focus; }

/* add tabs to warn vandals */ function vandal(tmplt) { var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ' '; txt.focus; txt = document.editform.wpSummary; txt.value = tmplt document.editform.wpWatchthis.checked = false; }

/* add tabs to fill in deletion summaries */ function speedy (criterion) { var form = document.forms.deleteconfirm; form.wpReason.value = criterion; }

/* add a tab to fill in deletion summaries with a link to VfD */ function vfddelete { var form = document.forms.deleteconfirm; form.wpReason.value = 'Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')) + ''; }

/* add tabs to close VfD discussions */ function closevfd(bold, notbold) { var txt = document.editform.wpTextbox1; txt.value = " " + bold + "" + notbold + ". ~\n" + txt.value + "\n\n"; txt = document.editform.wpSummary; txt.value = "close discussion: " + bold + notbold; document.editform.wpWatchthis.checked = false; }

/* add a VfD keep tab when editing talk pages */ function vfdresult { document.editform.wpSummary.value = 'VfD concluded in favour of keeping'; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += '==Articles for deletion==\nIn July 2005, this article was nominated for deletion. The result was to keep. See Articles for deletion/ for a record of the discussion. ~';   txt.focus; }

/* add tabs to show and hide closed VfD discussions on log pages */ function hidevfd { var divs = document.getElementsByTagName("div"); for(var x = 0; x < divs.length; ++x) if(divs[x].className.indexOf("vfd") != -1) divs[x].style.display = "none"; document.getElementById('footer').style.display = 'none'; } function showvfd { var divs = document.getElementsByTagName("div"); for(var x = 0; x < divs.length; ++x) if(divs[x].className.indexOf("vfd") != -1) divs[x].style.display = ""; document.getElementById('footer').style.display = ''; }

/* add a tab linking to VfD for deleted pages */ function vfdold { var x = document.getElementById('ca-article'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(!x) return; if(x.children) x = x.children[0]; else x = x.childNodes[0]; addlilink(tabs, x.href.replace(/Special:Undelete/, "Wikipedia:Articles_for_deletion"), 'vfd', ''); }

/* check what kind of page you're viewing and add tabs approriately */ function morelinks { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing ") == 0) addlilink(tabs, 'javascript:replace', 'replace', ''); if(document.title.indexOf("Editing Image:") == 0) { addlilink(tabs, 'javascript:unverified', 'tag', ''); addlilink(tabs, 'javascript:pui', 'pui', ''); }   if(document.title.indexOf("Editing User talk:") == 0) { addlilink(tabs, 'javascript:vandal("test")', '1', ''); addlilink(tabs, 'javascript:vandal("test2")', '2', ''); addlilink(tabs, 'javascript:vandal("test2a")', '2a', ''); addlilink(tabs, 'javascript:vandal("test3")', '3', ''); addlilink(tabs, 'javascript:vandal("test4")', '4', ''); addlilink(tabs, 'javascript:vandal("test5")', '5', ''); addlilink(tabs, 'javascript:vandal("spam")', 's1', ''); addlilink(tabs, 'javascript:vandal("spam2")', 's2', ''); addlilink(tabs, 'javascript:vandal("spam3")', 's3', ''); addlilink(tabs, 'javascript:vandal("spam4")', 's4', ''); }   if(document.title.indexOf("Confirm delete - Delete") == 0) { addlilink(tabs, 'javascript:speedy("nonsense")', 'no', ''); addlilink(tabs, 'javascript:speedy("remove redirect for page move")', 're', ''); addlilink(tabs, 'javascript:speedy("misleading redirect")', 'mr', ''); addlilink(tabs, 'javascript:speedy("talk page with no useful history")', 'tu', ''); addlilink(tabs, 'javascript:speedy("talk page of deleted article")', 'td', ''); addlilink(tabs, 'javascript:vfddelete', 'vfd', ''); }   if(document.title.indexOf("Editing Wikipedia:Articles for deletion") == 0) { addlilink(tabs, 'javascript:closevfd("delete", "")', 'D', ''); addlilink(tabs, 'javascript:closevfd("keep", "")', 'K', ''); addlilink(tabs, 'javascript:closevfd("merge and redirect", " to " + prompt("Merge and redirect to?") + "")', 'M', ''); addlilink(tabs, 'javascript:closevfd(prompt("Result?"), "")', 'O', ''); addlilink(tabs, 'javascript:closevfd("redirect", " to " + prompt("Redirect to?") + "")', 'R', ''); addlilink(tabs, 'javascript:closevfd("speedy delete", "")', 'S', ''); addlilink(tabs, 'javascript:closevfd("transwiki", " to " + prompt("Transwiki to?"))', 'T', ''); }   if(document.title.indexOf("Editing Talk:") == 0) addlilink(tabs, 'javascript:vfdresult', 'vfd', ''); if(document.title.indexOf("Wikipedia:Articles for deletion/Log") == 0) { addlilink(tabs, 'javascript:hidevfd', 'h', 'ca-hide'); addlilink(tabs, 'javascript:showvfd', 's', 'ca-show'); }   if(document.title.indexOf("View and restore deleted pages") == 0) vfdold; }

/* Live Preview by User:Pilaf */ wpUserName = 'Trilobite'; wpShowImages = true; mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js&action=raw&ctype=text/javascript');

//From User:JesseW/monobook.js function addSinceTab { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited }   else if (!/wiki\/Special:|w\/index.php?title=Special:/.test(window.location.href)) { var thetitle=document.title.slice(0, String(document.title).indexOf(" - ")); var l=addlilink(tabs, "/w/index.php?title="+thetitle+"&action=history&gotosince=true", 'since', ''); l.lastChild.title="Changes since I last edited"; } } function do_since_I_last_edited { var csub=document.getElementById("contentSub"); var msg=document.createElement("p"); msg.appendChild(document.createTextNode			("Parsing history... please wait...")); msg.className="error"; csub.insertBefore(msg, csub.firstChild)

var username=document.getElementById("pt-userpage").textContent; var hists=document.getElementById("pagehistory").childNodes; for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName("span")[0].textContent==username) { document.location=hists[n].childNodes[1].href; return; }	}

msg.replaceChild(document.createTextNode			 ("You have not edited this page! (recently)"),			 msg.firstChild); }

/* Go! */ window.onload = Main; function Main { changelinks; addtoolboxlinks addpurge; addSinceTab; morelinks; LivePreviewInstall; }

/* */ /* User:Pilaf/livepreview.js */

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

mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript');

function tnaddlilink(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 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 + " ~" + "~" + "~" + "~"; f.wpSummary.value = "Vandalism to " + page + " - warning " + number; f.submit; }

function wA { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "Where" + " ~" + "~" + "~" + "~"; f.wpSummary.value = "Welcome to Wikipedia!"; f.submit; }

function wap { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += " ~" + "~" + "~" + "~"; f.wpSummary.value = "Use preview; also, welcome!"; f.submit; }

function es { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "==Edit summaries==\n ~" + "~" + "~" + "~"; f.wpSummary.value = "Please use edit summaries"; f.submit; }

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

// Only add for pages with "Editing User talk:" somewhere in the title if (document.title.indexOf("Editing User talk:") != -1) {    tabs.appendChild(tnaddlilink('javascript:es', "ES")); tabs.appendChild(tnaddlilink('javascript:testn("test1")',"t1")); tabs.appendChild(tnaddlilink('javascript:testn("test1a")',"t1a")); tabs.appendChild(tnaddlilink('javascript:testn("test2")',"t2")); tabs.appendChild(tnaddlilink('javascript:testn("test2a")',"t2a")); tabs.appendChild(tnaddlilink('javascript:testn("test3")',"t3")); tabs.appendChild(tnaddlilink('javascript:testn("test4")',"t4")); tabs.appendChild(tnaddlilink('javascript:testn("bv")',"bv")); tabs.appendChild(tnaddlilink('javascript:testn("obscene")',"o")); tabs.appendChild(tnaddlilink('javascript:testn("joke")',"j")); tabs.appendChild(tnaddlilink('javascript:testn("welcomenpov")',"w-N")); tabs.appendChild(tnaddlilink('javascript:wA',"w-A")); tabs.appendChild(tnaddlilink('javascript:wap',"w-A-p")); }}

function inc (file) { mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s'); } inc("User:Lightdarkness/aiv.js");