User:Splarka/monobook.js

From WikiFur, the furry encyclopedia.
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences
// ** patrolled edit popups **
// Lets you open patrolled edit links in popups which will autoclose when complete.
// Set popups to open in new tabs for best results.
function patrolpop() {
    if( (!document.getElementById)||(!queryString("diff"))||(!queryString("rcid")) ) return;
 
    if(document.getElementsByTagName("table")[0].className = "diff") {
        var marklink = document.getElementsByTagName("table")[0].getElementsByTagName("a").length -1;
        var purl = document.getElementsByTagName("table")[0].getElementsByTagName("a")[marklink].href
        var mp = document.getElementsByTagName("table")[0].getElementsByTagName("a")[marklink].parentNode
        var mpa=document.createElement('span');
        mpa.innerHTML='&emsp;<sup>[<a id="poppatrol" href="#" onclick="window.open(\'' + purl + '&autoclose=true\',\'automarking '+ purl +'\',\'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=320,height=240\');window.focus();return false;" title="Patrol in popup [alt-p]">pop</a>]</sup>';
        mp.appendChild(mpa);
        document.getElementById("poppatrol").accessKey="p";
    }
}
addOnloadHook(patrolpop);
 
// window closer and query string retriever
if( queryString("autoclose") == "true") window.close();
function queryString(p) {
	var re = RegExp('[&?]' + p + '=([^&]*)');
 
	var matches;
 
	if (matches = re.exec(document.location)) {
		try { 
			return decodeURI(matches[1]);
		} catch (e) {
		}
	}
 
	return null;
}
// ** end patrolled edit popups **