User:Misza13/Scripts/Status switcher
From Wikipedia, the free encyclopedia
//
This module will add 3 new links beside the "log out" link. These will be "in", "busy" and "out" for quickly changing your current Wikipedia status. For this to work, you'll need two additional pages:
Note: The exact names of the subpages can be configured in the script.
The first one is the one modified by the script to hold {{User:Example/StatusTemplate|STATUS}}, where "STATUS" will be one of "in", "busy", "out". Then it is up to the "Template" to render it the way you wish. An example is:
'''<div style="border: 1px solid black; background: white; float: right; position: relative; top: -30px; padding: 5px">Example's status: {{ #switch: {{{1}}} | in=<span style="color: green;">IN</span> | busy=<span style="color: #FFAA00;">BUSY</span> | out=<span style="color: red;">OUT</span> }} </div>'''
You can tweak it to look whatever you like.
Then all you need is to put {{User:Example/Status}} on whatever pages you want the status to be displayed on and add the following function to your monobook.js.
Any comments/praises/bug reports/flames go to the author, Misza13 T C 16:48, 25 March 2006 (UTC).
//
// STATUS CHANGER addOnloadHook(function (){ var subpage = "/Status"; var scheme = "/StatusTemplate"; var subpagelink = wgServer + "/w/index.php?title=User:" + encodeURIComponent(wgUserName + subpage); var logout = document.getElementById( 'pt-logout' ); //Add the links addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=in", "In", "pt-status-in", "I'm in!", "", logout); addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "", logout); addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", "", logout); if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status? //Get new status var statusRegExp = /&action=edit&newstatus=(.*)/; var status = statusRegExp.exec(location.href)[1]; //Modify the form document.getElementById('wpTextbox1').value = "{{User:"+wgUserName+scheme+"|"+status+"}}"; document.getElementById('wpSummary').value = "Status: "+status; document.getElementById('wpMinoredit').checked = 'checked'; //Submit it! document.getElementById('editform').submit(); }); //