Jump to content

User:Sorfane/status.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//////////STATUS CHANGER for Blake01
// Creator: Misza13
// Credits: Voyagerfan5761 for some minor improvements
 
addOnloadHook(function (){
  var subpage = "/Status";
  var scheme = "/StatusTemplate";
  var linkprefix = mw.config.get('wgServer')+mw.config.get('wgScript')+"?title=User:";
  //Add the links
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=online", "Online", "pt-status-in", "I'm online!", "", "pt-logout");
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=vandal", "Vandal", "pt-status-busy", "I'm vandal hunting!", "", "pt-logout");
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=offline", "Offline", "pt-status-out", "I'm offline!", "", "pt-logout");
  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = "{{User:"+wgUserName+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "Status update: "+status;
  //Submit it!
  document.getElementById('editform').submit();
});
 
//[[Category:Wikipedia scripts|statusChanger]]