User:Anturiaethwr/monobook.js

/* Note: After saving, you have to bypass your browser's cache to see the changes. To do this in Firefox/Mozilla/Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R). If you use Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

AzaToth's reversion tools
*/ // importScript('User:AzaToth/twinkle.js'); /*

WikEd, replaces Firefox's text edit window
*/ // install User:Cacycle/wikEd in-browser text editor document.write(' ');

importScript('User:Lupin/recent2.js'); /*

Watchlist sorter
Sorts your watchlist by namespace, and also adds spaces for readability. $(function { if (location.href.indexOf('Special:Watchlist') == -1) return; //Are we on a watchlist?  //days = document.getElementById('bodyContent').getElementsByTagName('ul');  days = document.evaluate( //Hell knows how it works - found in "Dive into Greasemonkey" "//ul[@class='special']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (d = 0; d < days.snapshotLength; d++) { //For each day    day = days.snapshotItem(d);    newday = document.createElement('ul'); //This will replace the old listing    while ((diffs = day.getElementsByTagName('li')).length > 0) { //Are there any diffs left?      //Try to extract the namespace      As = diffs[0].getElementsByTagName('a');      if (As[0].innerHTML == 'diff')        pagename = As[2].innerHTML;      else        pagename = As[1].innerHTML;      if (pagename.indexOf(':') == -1)        namespace = 'Main';      else        namespace = pagename.split(':')[0]; //This will fail for articles which contain ":" in name      hdrs = newday.getElementsByTagName('h5'); //Get the list of namespace headers      hdr = null;      for (j=0; j<hdrs.length; j++) //Find the header        if (hdrs[j].innerHTML==namespace) {          hdr = hdrs[j]; break;        }      if (hdr==null) { //Not found? Make a new one! hdr = document.createElement('h5'); hdr.innerHTML = namespace; newday.appendChild(hdr); namespacesub = document.createElement('ul'); newday.appendChild(namespacesub); }     hdr.nextSibling.appendChild(diffs[0]); //Move the diff }   newday.appendChild(document.createElement('hr')); //For readablility day.parentNode.replaceChild(newday,day); } });

/*** BEGIN WIKIBREAK ENFORCER ***/ $(function {	/*** Start editing here ***/	// When you want to end your break?	// no leading zeroes. (example: 7 - correct, 07 - incorrect)	var date = { year: 2010, month: 4, day: 5 };	var time = { hours: 20, minutes: 22, seconds: 0 };	/*** Stop editing here ***/	var currentDate = new Date;	var enforcedBreakEnd = new Date( date.year,date.month,date.day,time.hours,time.minutes,time.seconds);	if (currentDate <= enforcedBreakEnd) {		alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString + "\n(now is "+currentDate.toLocaleString+")\n\nBye!");		location = "http://"+location.host+"/w/index.php?title="			+ "Special:Userlogout&returnto=Main_Page";	} }); /*** END WIKIBREAK ENFORCER ***/mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3ALupin%2Fautoedit.js&action=raw&ctype=text/javascript'); // User:Lupin/autoedit.js

//Greasemonkey can't seem to be able to access the embedded variables such as wgUserName //unless you do this. This make it easy to tell if you're logged in, much simpler than //checking the edit token. var cdata = eval(document.getElementsByTagName("script")[0].innerHTML);

//This punts you to the login page if you try to make an anon edit. if(wgAction=="edit" && wgUserName==null) location.href = wgServer + wgScript + "?title=Special:UserLogin&returnto=" + wgPageName; /* Templates Used finder, version [0.0.3b] Originally from: http://en.wikipedia.org/wiki/User:Splarka/temused.js Notes: if(wgNamespaceNumber != -1 && wgArticleId > 0 && wgAction == 'view') addOnloadHook(findTemButton) function findTemButton { var portlet = (window.temusedIAmATool) ? 'p-tb' : 'p-cactions'; mw.util.addPortletLink(portlet,'javascript:findTem','Templates used','ca-tem'); if(queryString('findtem')=='true') findTem; } function findTem { var bar = document.getElementById('contentSub') || document.getElementById('topbar'); if(!bar) return; var div = document.createElement('div'); div.setAttribute('id','tem-out'); bar.appendChild(div); injectSpinner(div,'tem'); var url = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?maxage=0&smaxage=0&format=json&callback=findTemCB&action=query&generator=templates&gtllimit=500&prop=revisions&indexpageids&titles=' + encodeURIComponent(mw.config.get('wgPageName')) ; mw.loader.load(url); } function findTemCB(obj) { var tem = document.getElementById('tem-out'); removeSpinner('tem'); if(!obj['query'] || !obj['query']['pages']) { tem.appendChild(document.createTextNode('error, or no templates found')); return; } appendCSS('#ca-tem a {display:none;} #tem-out {border:1px solid #777777;} .tem-week {color:black;} .tem-day {font-weight:bold;} .tem-hour {color:red;}'); var ul = document.createElement('ul'); var ids = obj['query']['pageids']; for(var i=0;i 604800) li.className = 'tem-stale'; li.appendChild(document.createElement('br')); li.appendChild(document.createTextNode('Last edited: ')); var span = document.createElement('span'); span.appendChild(document.createTextNode(duration(timesince,2))); span.className = 'tem-time' if(timesince < 604800) span.className += ' tem-week' if(timesince < 86400) span.className += ' tem-day' if(timesince < 3600) span.className += ' tem-hour' li.appendChild(span) li.appendChild(document.createTextNode(' ago by ')); addLinkChild(li, wgScript + '?title=Special:Contributions/' + encodeURIComponent(rev['user']),rev['user']); li.appendChild(document.createTextNode(' ('));   addLinkChild(li, wgScript + '?diff=' + rev['revid'],'diff',false,false,'diff=' + rev['revid']);    li.appendChild(document.createTextNode(') ')); if(rev['comment']) li.appendChild(document.createTextNode(rev['comment'])) ul.appendChild(li); } tem.appendChild(ul); } function addLinkChild(obj,href,text,id,classes,title) { if(!obj || !href || !text) return false; var a = document.createElement('a'); a.setAttribute('href',href); a.appendChild(document.createTextNode(text)); if(id) a.setAttribute('id',id); if(classes) a.setAttribute('class',classes); if(title) a.setAttribute('title',title); obj.appendChild(a); return a; } function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }  return null; } //ISO 8601 date module by Paul Sowden, licensed under AFL. Date.prototype.setISO8601 = function(string) { if(!string) return var regexp = '([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?'; var d = string.match(new RegExp(regexp)); if(d.length < 1) return var offset = 0; var date = new Date(d[1], 0, 1); if(d[3]) date.setMonth(d[3] - 1) if(d[5]) date.setDate(d[5]) if(d[7]) date.setHours(d[7]) if(d[8]) date.setMinutes(d[8]) if(d[10]) date.setSeconds(d[10]) if(d[12]) date.setMilliseconds(Number('0.' + d[12]) * 1000) if(d[14]) { offset = (Number(d[16]) * 60) + Number(d[17]); offset *= ((d[15] == '-') ? 1 : -1); } offset -= date.getTimezoneOffset; time = (Number(date) + (offset * 60 * 1000)); this.setTime(Number(time)); } function duration(input,depth) { var num = input; var out = ''; var s = num % 60; num = Math.floor(num / 60); var m = num % 60; num = Math.floor(num / 60); var h = num % 24; num = Math.floor(num / 24); var d = num % 7; num = Math.floor(num / 7); var w = num % 52; num = Math.floor(num / 52); var y = num if(y > 0) out += y + 'yrs ' if(y + w > 0) out += w + 'wks ' if(y + w + d > 0) out += d + 'days ' if(y + w + d + h > 0) out += h + 'hrs ' if(y + w + d + h + m > 0) out += m + 'mins ' out += s + 'secs'; if(depth && depth < out.split(' ').length) { out = out.split(' ').slice(0,depth).join(' '); } return out; } // importScript("User:Gerbrant/hidepane.js"); importScript("Wikipedia:Dazzle!/code.js"); $(function {   var editTab = document.getElementById("ca-edit");    if (!editTab) return;    var editURL = editTab.getElementsByTagName("a")[0].href;    mw.util.addPortletLink("p-cactions", editURL + "&externaledit=true", "EE", "ca-exted", "External editor", ""); }); $(function {   var editTab = document.getElementById("ca-edit");    if (!editTab) return;    var editURL = editTab.getElementsByTagName("a")[0].href;    mw.util.addPortletLink("p-cactions", editURL + "&externaledit=true", "EE", "ca-exted", "External editor", ""); }); importScript('User:Gary King/expand hidden templates.js'); // Expand Hidden Templates importScript('Wikipedia:WikiProject User scripts/Scripts/Six tabs'); defaultdiffs = 750;   // or whatever number, see script for details importScript('Wikipedia:WikiProject User scripts/Scripts/Changes since I last edited');
 * Uses the API using head/appendchild(script) and callback to avoid ajax.
 * Redesigned a-la http://en.wikipedia.org/wiki/User:Splarka/templatesabused.js (which is for edit mode)
 * This script is for view mode. Similar display, completely different method of operation.

importScript('User:Anomie/util.js'); importScript('User:Anomie/linkclassifier.js'); // Linkback: User:Anomie/linkclassifier.js importScript('User:Ale_jrb/Scripts/userhist.js'); //User:Ale_jrb/Scripts importScript('User:PleaseStand/userinfo.js');// User:PleaseStand/userinfo.js