User:JarrahTree/monobook.js

mw.loader.load('//www.wikidata.org/w/index.php?title=User:Yair_rand/checksitelinks.js&action=raw&ctype=text/javascript');

// Add WP:Reflinks launcher in the toolbox on left addOnloadHook(function { mw.util.addPortletLink( "p-tb",    // toolbox portlet "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + mw.config.get('wgPageName') + "?client=script&citeweb=on&overwrite=&limit=20&lang=" + mw.config.get('wgContentLanguage'), "Reflinks" // link label )});

if((mw.config.get('wgNamespaceNumber') == 2 || mw.config.get('wgNamespaceNumber') == 3) && mw.config.get('wgTitle').indexOf('/') == -1 && (mw.config.get('wgAction') != 'edit' || mw.config.get('wgAction') != 'submit')) addOnloadHook(showUserGroups) function showUserGroups { var url = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&format=json&callback=showUserGroupsCB&maxage=3600&smaxage=3600&usprop=blockinfo|groups|editcount|registration&list=users&ususers=' + encodeURIComponent(mw.config.get('wgTitle')); mw.loader.load(url); } function showUserGroupsCB(obj) { var show = window.showUserGroupSettings || false; if(!obj['query'] || !obj['query']['users']) return var user = obj['query']['users']; if(user.length == 0) return user = user[0]; var someHeading = document.getElementsByTagName('h1')[0] || document.getElementsByTagName('h2')[0] if(!someHeading) return var span = document.createElement('span'); var title = 'User:' + user['name'] + ' '; var text = ' '; if(user['invalid'] == '') { if(show && show.IP) text += '[IP] ' else title += '[invalid or IP username] ' } else if(user['missing'] == '') { if(show && show.unregistered) text += '[doesn\'t exist] ' else title += '[not a registered name] ' } else { if(show && show.registered) text += '[exists] ' else title += '[username registered] ' if(user['groups']) { if(show && show.groups || !show) text += '[' + user['groups'] + '] ' else title += '[' + user['groups'] + '] ' }   if(user['editcount']) { if(show && show.editcount) text += '[' + user['editcount'] + ' edits] ' else title += '[' + user['editcount'] + ' edits] ' }   if(user['registration']) { if(show && show.regdate) text += '[created: ' + user['registration'].split('T')[0] + '] ' else title += '[created: ' + user['registration'] + '] ' }   if(user['blockedby']) { if(show && show.blocked) text += '[blocked] ' else text += '[currently blocked] ' } }  span.setAttribute('class','detected-userrights'); span.appendChild(document.createTextNode(text)); someHeading.appendChild(span); someHeading.setAttribute('title',title); someHeading.className += ' detected-userrights-heading'; }

// var autoLocalTimeStamps = false; // importScript('User:Splarka/timestamplocalizer.js'); // -- // START Timestamp localizer by Splarka (experimental) // -- // This crazy script iterates over all text nodes in the // content area and attempts to switch signature-generated // UTC timestamps with a version in your local time. addOnloadHook(function { if(mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit') return //DO NOT WANT  if(window.autoLocalTimeStamps=='true') {    //autoload    localTimeStamps;  } else {    //give a button instead    mw.util.addPortletLink('p-cactions','javascript:localTimeStamps','Localize timestamps','ca-local','This will attempt to convert all timestamps on the page to your local time');  } }); function localTimeStamps { findTextNodes(changeTimeStamp,document.getElementById('bodyContent')); } function changeTimeStamp(obj) { var pattern = /\d\d\:\d\d\, \d{1,2} \w{1,30} \d{4} \(UTC\)/; while(obj.nodeValue.search(pattern)!=-1) { var dat = ''+ obj.nodeValue.match(pattern); var hour = '' + dat.match(/\d\d\:\d\d\, /) hour = hour.replace(/\,/,''); dat = dat.replace(/\d\d\:\d\d\, /,''); dat = dat.replace(/ \(UTC\)/,' '+ hour + ' UTC'); var ts = new Date(dat); ts.setTime(ts.getTime); obj.nodeValue = obj.nodeValue.replace(pattern,ts.toString); } } // General text-node finder/magic/functioner // * iterates over childnodes of obj // * if obj is text, perform func on it // * if obj has childnodes, call self recursively function findTextNodes(func,obj) { if (obj.nodeType == 3) { func(obj); } var i=0; while(obj.childNodes[i]) { findTextNodes(func,obj.childNodes[i]); i++; } } // -- // END Timestamp localizer // --

// Add WP:Reflinks launcher in the toolbox on left addOnloadHook(function { mw.util.addPortletLink( "p-tb",    // toolbox portlet "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + mw.config.get('wgPageName') + "?client=script&citeweb=on&overwrite=&limit=20&lang=" + mw.config.get('wgContentLanguage'), "Reflinks" // link label )});

// User:Zocky/SearchBox.js document.write(' ');

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

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

//

// For description, see User:Mr.Z-man/rollbackSummary function rollbackSummary { var hasRollback = getElementsByClassName(document, "span", "mw-rollback-link"); if (hasRollback[0]) { mw.util.addPortletLink('p-cactions', 'javascript:setRollbackSummary', "rollback summary", "ca-rollbacksummary", "Set rollback link edit summary"); } } addOnloadHook(rollbackSummary); function setRollbackSummary { summary = prompt("Change the default rollback summary for rollback links on this page to:", ""); if (!summary) { for (var i in document.links) { if (document.links[i].href.indexOf('summary=') != -1) { document.links[i].href = document.links[i].href.substring(0, document.links[i].href.indexOf('summary=')-1); }   }  }  else { summary = "&summary=" + encodeURIComponent(summary); for (var i in document.links) { if (document.links[i].href.indexOf('action=rollback') != -1) { document.links[i].href += summary; }   }  } }

// User:Lupin/popups.js

document.write(' ');

// User:Outriggr/metadatatest.js importScript('User:Outriggr/metadatatest.js');

importScript("User:Lupin/recent2.js");

importScript('User:AzaToth/morebits.js'); importScript('User:AzaToth/twinklefluff.js'); importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css'); importScript('User:AzaToth/twinklewarn.js'); importScript('User:AzaToth/twinklearv.js'); importScript('User:AzaToth/twinklespeedy.js'); importScript('User:AzaToth/twinklediff.js'); importScript('User:AzaToth/twinkleprotect.js');

TwinkleConfig = { revertMaxRevisions             :       50, userTalkPageMode               :       'window', showSharedIPNotice             :       true, openTalkPage                   :       [ 'agf', 'norm', 'vand' ], openTalkPageOnAutoRevert       :       false, openAOLAnonTalkPage            :       false, summaryAd                      :       " using TW", deletionSummaryAd              :       " using TW", protectionSummaryAd            :       " using TW", watchSpeedyPages               :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ], 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, markWarningsAsMinor            :       true, markAIVReportAsMinor           :       true, markSpeedyPagesAsMinor         :       true, confirmUsernameToAIV           :       true };

importScript('User:Ioeth/friendly.js');

//Wikipedia:WikiProject User scripts | Scripts function format { var txt = document.editform.wpTextbox1; txt.value = catFixer(txt.value); txt.value = entities(txt.value); txt.value = fixheadings(txt.value); txt.value = fixsyntax(txt.value); txt.value = linkfixer(txt.value, false); //txt.value = imagefixer(txt.value); txt.value = whitespace(txt.value); txt.value = linksimplifyer(txt.value); txt.value = trim(txt.value); } function whitespace(str){ str = str.replace(/\t/g, " "); str = str.replace(/^ ? ? \n/gm, "\n"); str = str.replace(/(\n\n)\n+/g, "$1"); str = str.replace(/== ? ?\n\n==/g, "==\n=="); str = str.replace(/\n\n(\* ?\[?http)/g, "\n$1"); str = str.replace(/^ ? ? \n/gm, "\n"); str = str.replace(/\n\n\*/g, "\n*"); str = str.replace(/[ \t][ \t]+/g, " "); str = str.replace(/([=\n]\n)\n+/g, "$1"); str = str.replace(/ \n/g, "\n"); //* bullet points str = str.replace(/^([\*#]+) /gm, "$1"); str = str.replace(/^([\*#]+)/gm, "$1 "); //==Headings== str = str.replace(/^(={1,4}) ?(.*?) ?(={1,4})$/gm, "$1$2$3"); //dash — spacing str = str.replace(/ ?(–|&#150;|–|&#8211;|&#x2013;) ?/g, "$1"); str = str.replace(/ ?(—|&#151;|&mdash;|&#8212;|&#x2014;) ?/g, "$1"); str = str.replace(/([^1-9])(—|&#151;|&mdash;|&#8212;|&#x2014;|–|&#150;|–|&#8211;|&#x2013;)([^1-9])/g, "$1 $2 $3"); return trim(str); } function entities(str){ //str = str.replace(//g, ""); str = str.replace(/&#150;|&#8211;|&#x2013;/g, "–"); str = str.replace(/&#151;|&#8212;|&#x2014;/g, "&mdash;"); // str = str.replace(/(cm| m|km|mi)2/g, "$1²"); str = str.replace(/&sup2;/g, "²"); str = str.replace(/&deg;/g, "°"); return trim(str); } //Fix ==See also== and similar section common errors. function fixheadings(str) { if( !str.match(/= ?See also ?=/) ) str = str.replace(/(== ?)(see also:?|related topics:?|related articles:?|internal links:?|also see:?)( ?==)/gi, "$1See also$3"); str = str.replace(/(== ?)(external links?:?|outside links?|web ?links?:?|exterior links?:?)( ?==)/gi, "$1External links$3"); str = str.replace(/(== ?)(references?:?)( ?==)/gi, "$1References$3"); str = str.replace(/(== ?)(sources?:?)( ?==)/gi, "$1Sources$3"); str = str.replace(/(== ?)(further readings?:?)( ?==)/gi, "$1Further reading$3"); return str; } function catFixer(str){ str = str.replace(/\[\[ ?[Cc]ategory ?: ?/g, "[[Category:");   return trim(str); } //fixes many common syntax problems function fixsyntax(str) {  //replace html with wiki syntax  if( !str.match(/'<\/?[ib]>|<\/?[ib]>'/gi) )  {    str = str.replace(/(.*?)<\/i>/gi, "$1");    str = str.replace(/(.*?)<\/b>/gi, "$1");  }  str = str.replace(//gi, " ");  str = str.replace(/ /gi, " ");  return trim(str); } //formats links in standard fashion function linkfixer(str, checkImages) {   str = str.replace(/\]\[/g, "] [");  var m = str.match(/\[?\[[^\]]*?\]\]?/g);  if (m)  {    for (var i = 0; i < m.length; i++)    {      var x = m[i].toString;      var y = x;      //internal links only      if ( !y.match(/^\[?\[http:\/\//i) && !y.match(/^\[?\[image:/i) )      {        if (y.indexOf(":") == -1 && y.substr(0,3) != "_") == -1)        {          if (y.indexOf("|") == -1)            y = y.replace(/_/g, " ");          else            y = y.replace( y.substr(0, y.indexOf("|")), y.substr(0, y.indexOf("|")).replace(/_/g, " "));        }          y = y.replace(/ ?\| ?/, "|").replace("|", "| ]]"); }     str = str.replace(x, y); } }  //repair bad internal links str = str.replace(/\[\[ ?([^\]]*?) ?\]\]/g, "$1"); str = str.replace(/\[\[([^\]]*?)( |_)#([^\]]*?)\]\]/g, "$1"); //repair bad external links str = str.replace(/\[?\[http:\/\/([^\]]*?)\]\]?/gi, "[http://$1]"); str = str.replace(/\[http:\/\/([^\]]*?)\|([^\]]*?)\]/gi, "[http://$1 $2]"); return trim(str); } //fixes images function imagefixer(str) { //remove external images str = str.replace(/\\]?/gi, "[http://$1]"); //fix links within internal images var m = str.match(/\");     y = linkfixer(y, true);      y = "" + y + "";      str = str.replace(x, y);    }  }  return trim(str); } //simplifies some links e.g. dog to dog and dogs to dogs function linksimplifyer(str){  var m = str.match(/\[\[([^[]*?)\|([^[]*?)\]\]/g);  if (m)  {    for (var i = 0; i < m.length; i++)    {      var n_arr = m[i].toString.match(/\[\[([^[]*?)\|([^[]*?)\]\]/);      var n = n_arr[0];      var a = n_arr[1];      var b = n_arr[2];      if (b.indexOf(a) == 0 || b.indexOf(TurnFirstToLower(a)) == 0)      {        var k = n.replace(/\[\[([^\]\|]*?)\|(\1)([\w]*?)\]\]/i, "$2$3");        str = str.replace(n, k);      }    }  }  str = str.replace(/\[\[([^\]\|]+)\|([^\]\|]+)\]\]([A-Za-z\'][A-Za-z]*)([\.\,\;\:\"\!\?\s\n])/g, "$2$3$4"); // ' // Help the syntax highlighter... return str; } //trim start and end, trim spaces from the end of lines function trim(str) { str = str.replace(/ $/gm, ""); return str.replace(/^\s*|\s*$/g, ""); } //turns first character to lowercase function TurnFirstToLower(input) { if (input != "") {   var input = trim(input); var temp = input.substr(0, 1); return temp.toLowerCase + input.substr(1, input.length); } else return ""; } //entities that should never be unicoded function noUnicodify(str) { str = str.replace(" &amp; ", " & "); str = str.replace("&amp;", "&amp;amp;").replace("&amp;lt;", "&amp;amp;lt;").replace("&amp;gt;", "&amp;amp;gt;").replace("&amp;quot;", "&amp;amp;quot;").replace("&amp;apos;", "&amp;amp;apos;"); str = str.replace("&minus;", "&amp;minus;").replace("&times;", "&amp;times;"); str = str.replace(" ", "&amp;nbsp;").replace("&thinsp;", "&amp;thinsp;").replace("&shy;", "&amp;shy;"); str = str.replace("&prime;", "&amp;prime;"); str = str.replace(/&(#0?9[13];)/, "&amp;$1"); str = str.replace(/&(#0?12[345];)/, "&amp;$1"); return str; } addOnloadHook(function {  if(document.forms.editform) {    mw.util.addPortletLink('p-cactions', 'javascript:format', 'format', 'ca-format', 'Format article', '', document.getElementById('ca-edit'));  } });

importScript('User:Dr_pda/prosesize.js'); //User:Dr_pda/prosesize.js

importScript('User:Dr pda/editrefs.js'); //User:Dr pda/editrefs.js

importScript('User:Kephir/gadgets/rater.js'); // User:Kephir/gadgets/rater

importScript('User:Lourdes/PageCuration.js'); // Linkback: User:Lourdes/PageCuration.js