User:YoruFeisu/vector.js

//

topaz.statuschanger = new Object; topaz.statuschanger.version = 20061108;

/* configuration */

// change these to whatever you'd like to show up on your status page. you can add new lines in // the same format provided there is a comma at the end of each line but the last one. you can // also use wikimarkup here to, for example, display an image instead of text. topaz.statuschanger.statuscode = { online:' online ', busy:' busy ', offline:' offline ' };

// this will make wikimarkup work in your stauscodes but will disable auto-updating topaz.statuschanger.enablewikimarkup = false;

// true to use the personal bar, false to create a panel in the left column topaz.statuschanger.usepersonalbar = true;

// true if you'd like your status page on your watchlist topaz.statuschanger.watchstatus = false;

/* end configuration */

topaz.statuschanger.buttonlist = {}; topaz.statuschanger.oldonload = window.onload; window.onload = function { if (typeof topaz.statuschanger.oldonload == "function") { setTimeout('topaz.statuschanger.oldonload',50); } if (!topaz.statuschanger.usepersonalbar) { topaz.wputil.addsidepanel("tz-statuschanger", "status changer"); } var buttonlist = []; for (status in topaz.statuschanger.statuscode) { buttonlist.push(status); topaz.statuschanger.buttonlist[status] = topaz.wputil.addsidepanelbutton(         topaz.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger",          status,          'javascript:topaz.statuschanger.setstatus("' + status + '")'        ); }

if (topaz.statuschanger.usepersonalbar) { for(var i=0; i<buttonlist.length; i++) { with (topaz.statuschanger.buttonlist[buttonlist[i]].style) { if (i != buttonlist.length-1) { borderRight = "1px solid #aaaaaa"; paddingRight = "2px"; }       if (i != 0) { marginLeft = "0px"; paddingLeft = "2px"; }     }    }  }

var spanlist = document.getElementsByTagName("span"); for (var i=0; i<spanlist.length; i++) { if (spanlist[i].className == "topaz.statuschanger.curstatus."+escape(topaz.wputil.username)) { topaz.util.cookie.set("topaz.statuschanger.curstatus", spanlist[i].innerHTML); } }

topaz.statuschanger.update; };

topaz.statuschanger.setstatus = function(statusname) { topaz.wputil.setpagecontent(     "User:"+topaz.wputil.username+"/Status",

(!topaz.statuschanger.enablewikimarkup ?         '  '      : '') +

topaz.statuschanger.statuscode[statusname] +

(!topaz.statuschanger.enablewikimarkup ?         '  '      : '') +

''+statusname+' ',

statusname, topaz.statuschanger.watchstatus); topaz.util.cookie.set("topaz.statuschanger.curstatus", statusname);  topaz.statuschanger.update; };

topaz.statuschanger.laststatus = null; topaz.statuschanger.update = function { var curstatus = topaz.util.cookie.get("topaz.statuschanger.curstatus"); if (curstatus && curstatus != topaz.statuschanger.laststatus) { for (status in topaz.statuschanger.buttonlist) { with (topaz.statuschanger.buttonlist[status].style) { if (status == curstatus) { fontWeight = "bold"; } else { fontWeight = "normal"; }     }    }

if (!topaz.statuschanger.enablewikimarkup) { var spanlist = document.getElementsByTagName("span"); for (var i=0; i<spanlist.length; i++) { if (spanlist[i].className == "topaz.statuschanger.inlinestatus."+escape(topaz.wputil.username)) { spanlist[i].innerHTML = topaz.statuschanger.statuscode[curstatus]; }     }    }  }  topaz.statuschanger.laststatus = curstatus; };

setInterval("topaz.statuschanger.update", 5000);

//

/*

Set default Main Page
Set the default Main Page to Main Page alternative (outline_links) /* if (wgPageName == "Main_Page") { window.location = "http://en.wikipedia.org/wiki/Wikipedia:Main_Page_alternative_%28outline_links%29"; }

/* 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.

Lupin's anti-vandal tools
*/ // Script from User:Lupin/recent2.js document.write(''); /*

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); } });