User:Deon/statuschanger.js
(Redirected from User:Deon555/statuschanger.js)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Deon/statuschanger. |
//<pre><nowiki>
topaz.statuschanger = new Object();
topaz.statuschanger.version = 20061106;
/* 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:'[[Image:In Icon.PNG|right|80px]]',
busy:'[[Image:Busy Icon.PNG|right|120px]]',
offline:'[[Image:Out Icon.PNG|right|100px]]',
help:'<br>Doing a {{tl|helpme}} <small>(note: this also includes [[WP:HD]]</small>',
openproxy:'[[Image:Symbol delete vote.svg|right|75px]]<br>Checking [[WP:OP|Open Proxies]]',
abusereport:'[[Image:Abuse_Reports.png|right|80px]]<br><br><br><br><br>Investigating an Abuse Report',
working:'[[Image:Mortarboard.jpg|right|70px]]<br>Working',
patrol:'[[Image:Police man ganson.svg|right|75px]]<br>Doing RC and/or NP Patrol.',
AWB:'[[Image:AWB.png|right|75px]]<br><br><br><br><br>Doing [[WP:AWB|AutoWikiBrowser]] Editing.'
};
// 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 = true;
/* 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.statuscode[statusname] +
'<span class="topaz.statuschanger.curstatus.' +
escape(topaz.wputil.username())+'" style="display:none">'+statusname+'</span>',
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";
}
}
}
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);
//</nowiki></pre>