User:Tehjustice/Status

//

tehjustice.statuschanger = new Object; tehjustice.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. tehjustice.statuschanger.statuscode = { online:' online ', busy:' busy ', offline:' offline ' };

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

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

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

/* end configuration */

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

if (tehjustice.statuschanger.usepersonalbar) { for(var i=0; i<buttonlist.length; i++) { with (tehjustice.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 == "tehjustice.statuschanger.curstatus."+escape(tehjustice.wputil.username)) { tehjustice.util.cookie.set("tehjustice.statuschanger.curstatus", spanlist[i].innerHTML); } }

tehjustice.statuschanger.update; };

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

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

tehjustice.statuschanger.statuscode[statusname] +

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

''+statusname+' ',

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

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

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

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

//