User:Cryptoque/monobook.js

//

// User:Lupin/popups.js importScript('User:Lupin/popups.js');

popupHideDelay=0.0; popupAdminLinks=true; popupOnEditSelection=false; popupFixDabs=true; popupRedlinkRemoval=true

// importScript('User:Steel359/helper.js'); // From User:GeorgeMoney/UserScripts/helpers/all // importScript('User:Steel359/csd.js'); // From User:GeorgeMoney/csd.js importScript('User:Steel359/morebits.js'); // From User:AzaToth/morebits.js // importScript('User:Steel359/twinkleprotect.js'); // From User:AzaToth/twinkleprotect.js //importScript('User:Steel359/twinkle.js'); // From User:AzaToth/twinklespeedy.js importScript('User:AzaToth/salt.js'); importScript('User:Voice_of_All/Addtabs/monobook.js'); importScript('User:Voice_of_All/replacetxt.js'); importScript('User:Steel359/VoA.js'); // From User:Voice_of_All/Specialadmin/monobook.js importScript('User:Cryptic/toggleundelete.js'); importScript('User:Steel359/tag.js'); importScript('User:Steel359/watchlist.js'); importScript('User:Zocky/PicturePopups.js'); importScript('User:^demon/csd.js'); importScript('User:FreakSock/image fun.js"');

disableRealTitle = 1;

// User creation log quickblock --

addOnloadHook(function {  urlString = document.location.href;  if(urlString.search("newusers")>0){    bC = document.getElementById("bodyContent");    liArray = bC.getElementsByTagName("li");    for(i=0;i<liArray.length;i++){      liANode = liArray[i].childNodes[1];      liANodeNext = liArray[i].childNodes[8];      liA = liANode.innerHTML;      newAtext = "h"+"ttp://en.wikipedia.org/w/index.php?title=Special:Blockip&action=submit&wpBlockAddress=";      newAtext = newAtext + liA;      newAtext = newAtext + "&wpBlockExpiry=indefinite&wpBlockReason=&autob=true";      var newdash = document.createTextNode(" | ");      xliA = liArray[i].childNodes[5].cloneNode(true);      liArray[i].insertBefore(xliA,liANodeNext);      xliA.innerHTML = "quickblock";      xliA.href = newAtext;      xliA.title = "Quick block this user";      xliA.className = "extiw";      liArray[i].insertBefore(newdash,xliA); } } })

// Auto 24hr vandalblock

if (document.title.indexOf("User contributions") != -1) {

addOnloadHook(function {    var href = document.getElementById('t-contributions');    if (href) href = href.getElementsByTagName('a');    if (href) href = href[0];    if (href) href = href.href;    else href = window.location.href;

var addr = /(\/wiki\/|[?&]title=)Special:Contributions(\/([^\/?&#]*)|[?&#]|$)/.exec(href); if (!addr) return; addr = addr[3]; if (!addr) { addr = /^[^?#]*\?([^&#]*&)*target=([^&#]*)/.exec(href); if (!addr) return; addr = addr[2]; }

if ( addr == wgUserName ) { return;

} else if (!/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(addr)) {

addLink('p-navigation', 'h'+'ttp://en.wikipedia.org/w/index.php?title=Special:Blockip&action=submit&wpBlockAddress='   +addr+    '&wpBlockExpiry=indefinite&wpBlockReason=Vandal only account&autob=true', 'Indefblock', 'p-vblock', 'Indefblock', null, 't-contributions'); addLink('p-navigation', 'h'+'ttp://en.wikipedia.org/w/index.php?title=Special:Blockip&action=submit&wpBlockAddress='   +addr+    '&wpBlockExpiry=indefinite&wpBlockReason=JB196&autob=true', 'JB196', 'p-jbblock', 'JB196', null, 't-contributions');

} else {

addLink('p-navigation', 'h'+'ttp://en.wikipedia.org/w/index.php?title=Special:Blockip&action=submit&wpBlockAddress='   +addr+    '&wpBlockExpiry=24 hours&wpBlockReason=Vandalism&autob=true', '24hr vandalblock', 'p-vblock', '24hr vandalblock', null, 't-contributions'); } });

}

// AfD helper.js & easy voting

function addLink(where, url, name, id, title, key, after) { // addLink accepts either an id or a DOM node, addPortletLink only takes a node if (after && !after.cloneNode) after = document.getElementById(after);

return addPortletLink(where, url, name, id, title, key, after); }

function autoafd_result { var close = prompt("Result of debate?") var f = document.editform, t = f.wpTextbox1; t.value = t.value.split('{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD').join('{{subst:User:Steel359/Empty'); t.value = "{{subst:" + "at" + "}} " + close + ". " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value; if (t.value.length > 0) t.value += '\n'; t.value += "{{subst:" + "ab" + "}}"; f.wpSummary.value = "Closed (" + close + ")";

var addit = promot ("Any additional comments? (Optional)"); if ( !addit ) { document.forms[0].wpSave.click; } else { t.value = t.value.split("{{subst:" + "at" + "}} " + close + ".").join("{{subst:" + "at" + "}} " + close + ". " + addit ); } }

function autoafd_add_afd_tabs { // Only add for pages with the right string somewhere in the title if (document.title.indexOf("Editing Wikipedia:Articles for deletion/") != -1) {     addPortletLink('p-cactions', 'javascript:autoafd_result', "close"); } }

addOnloadHook(autoafd_add_afd_tabs);

// Navigation ---

addOnloadHook(function { // if this is a user, show the logs for the user rather than the page if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) {  url = wgServer + "/w/index.php?title=Special:Log&user=" + wgTitle.split("/")[0]; } else if ( wgCanonicalNamespace == "Special" ) {  // don't display link for special pages  return; } else {  url = wgServer + "/w/index.php?title=Special:Log&page=" + wgPageName; } addPortletLink("p-navigation", url, "Logs", "pt-logs");

if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) { url = wgServer + "/w/index.php?title=Special:Listusers&limit=1&username=" + wgTitle.split("/")[0]; } else { return; } addPortletLink("p-navigation", url, "User rights", "pt-rights");

if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) { url = wgServer + "/w/index.php?title=Special:Prefixindex&namespace=2&from=" + wgTitle.split("/")[0] + '/'; } else { return; } addPortletLink("p-navigation", url, "Userspace", "pt-space");

});

// Vandalwarn ---

function warnvandal { var warn = prompt("Which warning?") if( !warn ) { return; } var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += '\n' + "{{subst:" + warn + "}} " + ""; f.wpSummary.value = warn; document.forms[0].wpSave.click; }

function warnvandalb { // Only add for pages with the right string somewhere in the title if (document.title.indexOf("Editing User talk:") != -1) {     addPortletLink('p-cactions', 'javascript:warnvandal', "warn" ); } }

addOnloadHook(warnvandalb);

// pp-dispute

addOnloadHook(function { if(queryString("jsaction")=="pp-dispute2") {  var f = document.editform, t = f.wpTextbox1;  t.value = "{" + "{pp-dispute}}" + '\n' + t.value;  f.wpSummary.value = "{" + "{pp-dispute}}";  document.forms[0].wpSave.click; } });

// fair use abuse

addOnloadHook(function { if(queryString("jsaction")=="killfu") {  var f = document.editform, t = f.wpTextbox1;  var fairuse = RegExp("\[\Ii]mage:.*?\]\]");  t.value = t.value.split(fairuse).join('');  f.wpSummary.value = "Removing violations of [[WP:NONFREE; see User:Durin/Fair use overuse explanation for more information";  document.forms[0].wpDiff.click; } });

function toolbox_tagging { if ( wgNamespaceNumber > -1 ) { addPortletLink('p-tb', wgServer + '/wiki/' + wgPageName + '?action=edit&jsaction=pp-dispute2', '{' + '{pp-dispute}}'); addPortletLink('p-tb', wgServer + '/wiki/' + wgPageName + '?action=edit&jsaction=killfu', 'Kill fair use'); } }

addOnloadHook(toolbox_tagging);

// URL autoclicks ---

addOnloadHook(function {		if(queryString("submitdelete")=="true") document.forms[0].wpConfirmB.click;		if(queryString("autodel")=="true") document.forms[0].wpConfirmB.click;		if(queryString("autob")=="true") document.forms[0].wpBlock.click;	}); function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { }		}		return null; };

// User talk:Alex Smotrov/wlunwatch.js

if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view') addOnloadHook(function { var frm = document.getElementsByTagName('form')[0]; frm.parentNode.insertBefore(document.createTextNode(' | '), frm); var lnk = document.createElement('a'); lnk.appendChild(document.createTextNode('Unwatch…')); lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")'; frm.parentNode.insertBefore(lnk, frm); })

// veroparse

function vero { if ( wgNamespaceNumber == 0 ) { addPortletLink('p-cactions', 'http://en.veropedia.com/v/parser.pl?article=' + wgPageName + ';revid=;wiki=wikipedia;lang=en;debug=0;reload=0', "vero"); } }

addOnloadHook(vero);

// RemExternalLinks --

if(wgPageName == 'Special:Linksearch') { addOnloadHook(function {		addPortletLink('p-cactions', "javascript:rem_spam", "remove external links", 'ca-remspam', 'Alter all the links on this page to autorem the external link on the page when clicked');	}); }

if(location.href.indexOf('action=edit') != -1 && location.href.indexOf('remspam=') != -1) { addOnloadHook(function {		var tag = query_get('remspam');		var box = document.getElementById('wpTextbox1');		var txt = box.value;		var reg = tag.replace('http://', ).replace(/\./g, '\\.').replace(/\*\\?\./g, '(?:.*?\\.)?');		var newtext = +txt; //		var elreg = /.*\s*={1,6}external\s*links?={1,6}\s*.*/ig; //		var elreg2 = /(\s*={1,6}external\s*links?={1,6}.*)$/ //		if(elreg.test(newtext)) { //						alert('MATCHED'); //			var elsect = newtext.replace(elreg, '$1'); //						document.getElementById('content').appendChild(document.createTextNode(elreg)); //						document.getElementById('content').appendChild(document.createElement('br')); //						document.getElementById('content').appendChild(document.createTextNode(elsect)); //						fuu; //			elsect = elsect.replace(new RegExp('^\\s*\\*.*?\\[?https?\\://'+reg+'/?.+?(?:\\s+(.+?)\\]|(\\s)).*?$', 'igm'), ''); //			newtext = newtext.replace(elreg, elsect); //		}		if(!query_get('options') || (',' + query_get('options') + ',').indexOf(',lines,') != -1) newtext = newtext.replace(new RegExp('^\\s*\\*.*?\\[?https?\\://'+reg+'/?.+?(?:\\s+(.+?)\\]|.*?)$', 'igm'), ''); if(!query_get('options') || (',' + query_get('options') + ',').indexOf(',citeweb,') != -1) newtext = newtext.replace(new RegExp('(?:\\s*)?\\{\\{\\s*cite[_ ]web\\s*\\|(?:.*?\\|)*\\s*url\\s*=\\s*https?\\://'+reg+'/?.*?\\s*(?:\\|.*?)?\\}\\}(?:\\s*<\/ref>)?', 'ig'), ''); if(!query_get('options') || (',' + query_get('options') + ',').indexOf(',inline,') != -1) newtext = newtext.replace(new RegExp('(?:\\s*)?\\[?https?\\://'+reg+'/?.+?(?:\\s+(.+?)\\]|(\\s))(?:\\s*<\/ref>)?', 'ig'), '$1'); box.value = newtext; document.getElementById('wpSummary').value = query_get('usesummary').replace(/__LINK__/g, tag) || 'Removing external link: '+tag+' -- per external link guidelines'; document.getElementById('wpMinoredit').checked = true; document.getElementById('wpWatchthis').checked = false; document.getElementById('wpDiff').click; }); }

function rem_spam { var targ = query_get('target') || unescape(location.href).split('/').reverse[0].split('?')[0].split('#')[0]; var tag = prompt('Please insert a link (without http://) to remove from\nall pages listed here. Example (and default if textbox is blank):\n'+targ); if(tag == null) { alert('Action canceled.'); return; } if(tag == "") tag = targ; var options = prompt('Please enter the option modes you would want.\nEnter each one in the textbox (without any seperation marker)\ne=Remove lines of External Links that contain the link\ni=Remove links inline in text\nc=Remove Cite_web templates using the link\nExample: ci\nLeave the box blank for all modes'); if(options == null) { alert('Action canceled.'); return; } if(options == "") options = 'eic'; options = options.split(new RegExp('')); var opt = ''; for(var x in options) { var y = options[x]; if(y == 'c') opt += ',citeweb'; if(y == 'i') opt += ',inline'; if(y == 'e') opt += ',lines'; }	opt = opt.substring(1); options = opt; var usesummary = prompt('Please enter a summary to use\nDefault: Removing external link: __LINK__ -- per external link guidelines'); if(usesummary == null) { alert('Action canceled.'); return; } if(usesummary == '') usesummary = 'Removing external link: __LINK__ -- per external link guidelines'; var links = document.getElementById('bodyContent').getElementsByTagName('a'); for(var i=0; i]+)>)/g, ''); }	var btn = document.getElementById('ca-remspam').firstChild; btn.href = 'javascript:unrem_spam;'; btn.innerHTML = 'un-highlight links'; btn.title = ''; }

function unrem_spam { var links = document.getElementById('bodyContent').getElementsByTagName('a'); for(var i=0; i<links.length; i++) { var link = links[i]; link.href = link.href.split('linkmodified=yes')[0]; link.style.color = ""; }	alert('All links will now be safe to click...'); var btn = document.getElementById('ca-remspam').firstChild; btn.href = 'javascript:rem_spam;'; btn.innerHTML = 'remove external links'; btn.title = ''; }

//parse paramName out of query string //stolen from Lupin's popups function query_get(paramName) { var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)'); var h=document.location; var m; if (m=cmdRe.exec(h)) { try { return unescape(m[1]); } catch (someError) {} } return null; };

if (wgPageName == "Special:Watchlist") addOnloadHook((function {document.write('<\/script>')}));

//