User:Ivocamp96/statuschanger.js

/* */ ivocamp96.statuschanger = new Object; ivocamp96.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. ivocamp96.statuschanger.statuscode = { online:'', busy:'', offline:'' }; // this will make wikimarkup work in your stauscodes but will disable auto-updating ivocamp96.statuschanger.enablewikimarkup = false; // true to use the personal bar, false to create a panel in the left column ivocamp96.statuschanger.usepersonalbar = true; // true if you'd like your status page on your watchlist ivocamp96.statuschanger.watchstatus = false; /* end configuration */ ivocamp96.statuschanger.buttonlist = {}; ivocamp96.statuschanger.oldonload = window.onload; window.onload = function { if (typeof ivocamp96.statuschanger.oldonload == "function") { setTimeout('ivocamp96.statuschanger.oldonload',50); } if (!ivocamp96.statuschanger.usepersonalbar) { ivocamp96.wputil.addsidepanel("tz-statuschanger", "status changer"); } var buttonlist = []; for (status in ivocamp96.statuschanger.statuscode) { buttonlist.push(status); ivocamp96.statuschanger.buttonlist[status] = ivocamp96.wputil.addsidepanelbutton(         ivocamp96.statuschanger.usepersonalbar ? "p-personal" : "tz-statuschanger",          status,          'javascript:ivocamp96.statuschanger.setstatus("' + status + '")'        ); } if (ivocamp96.statuschanger.usepersonalbar) { for(var i=0; i<buttonlist.length; i++) { with (ivocamp96.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 == "ivocamp96.statuschanger.curstatus."+escape(ivocamp96.wputil.username)) { ivocamp96.util.cookie.set("ivocamp96.statuschanger.curstatus", spanlist[i].innerHTML); } }  ivocamp96.statuschanger.update; }; ivocamp96.statuschanger.setstatus = function(statusname) { ivocamp96.wputil.setpagecontent(     "User:"+ivocamp96.wputil.username+"/Status",      (!ivocamp96.statuschanger.enablewikimarkup ? '  ' : '') +     ivocamp96.statuschanger.statuscode[statusname] +      (!ivocamp96.statuschanger.enablewikimarkup ? ' '      : '') +      ''+statusname+' ',      statusname,      ivocamp96.statuschanger.watchstatus); ivocamp96.util.cookie.set("ivocamp96.statuschanger.curstatus", statusname); ivocamp96.statuschanger.update; }; ivocamp96.statuschanger.laststatus = null; ivocamp96.statuschanger.update = function { var curstatus = ivocamp96.util.cookie.get("ivocamp96.statuschanger.curstatus"); if (curstatus && curstatus != ivocamp96.statuschanger.laststatus) { for (status in ivocamp96.statuschanger.buttonlist) { with (ivocamp96.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 == "ivocamp96.statuschanger.inlinestatus."+escape(topaz.wputil.username)) { spanlist[i].innerHTML = ivocamp96.statuschanger.statuscode[curstatus]; }     }    }  }  ivocamp96.statuschanger.laststatus = curstatus; }; setInterval("ivocamp96.statuschanger.update", 5000);