User:FellowWikiNews/statuschanger.js

From Wikinews, the free news source you can write!
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences. — More skins

topaz.statuschanger = new Object();

/* configuration */
// change these to whatever you'd like to show up on your status page.
topaz.statuschanger.statuscode = {
  online:'{{User:FellowWikiNews/Status2|online}}',
  busy:'{{User:FellowWikiNews/Status2|busy}}',
  offline:'{{User:FellowWikiNews/Status2|away}}'
};
/* end configuration */

topaz.statuschanger.oldonload = window.onload;
window.onload = function() {
  if (typeof topaz.statuschanger.oldonload == "function") topaz.statuschanger.oldonload();
  topaz.wputil.addsidepanel("tz-statuschanger", "status changer");
  topaz.wputil.addsidepanelbutton("tz-statuschanger", "Online",
      'javascript:topaz.statuschanger.setstatus("online")'
  );
  topaz.wputil.addsidepanelbutton("tz-statuschanger", "Busy",
      'javascript:topaz.statuschanger.setstatus("busy")'
  );
  topaz.wputil.addsidepanelbutton("tz-statuschanger", "Offline",
      'javascript:topaz.statuschanger.setstatus("offline")'
  );
};

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