User:Badgerstripe/Status.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
addOnloadHook(function (){ var subpage = "/Status"; var scheme = "/StatusTemp"; 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=online", "Online", "pt-status-online", "I'm online", "", logout); addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy", "", logout); addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=offline", "Offline", "pt-status-offline", "I'm offline", "", 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; document.getElementById('wpMinoredit').checked = 'checked'; //Submit it! document.getElementById('editform').submit(); });

