User:Daedalus969/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
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.
importScript('User:AzaToth/twinkle.js');
importScript('User:Voice_of_All/Addtabs/monobook.js');
 
importScript('User:Lupin/recent2.js');
 
// [[User:Henrik/live-edit-counter]]
importScript('User:Henrik/js/live-edit-counter.js');
 
 
/* Misza13's Status Switcher Script */
// Modified by Voyagerfan5761 to also update a second page for CVU status bot
 addOnloadHook(function (){
  var subpage = "/Status";
  var scheme = "/StatusText";
  var updatesbot = true; // Sets whether or not to also update the sbotpage page content
  var sbotpage = "/Busy"; // Page to update if updatesbot === true
  var linkprefix = wgServer+wgScript+"?title=User:";
  //Add the links
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=", "In", "pt-status-in", "I'm in!", "", "pt-logout");
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "", "pt-logout");
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=offline", "Out", "pt-status-out", "I'm out!", "", "pt-logout");
  addLink("p-personal", linkprefix+wgUserName+subpage+"&action=edit&newstatus=wikibreak", "WikiBreak", "pt-status-wikibreak", "I'm taking a break!", "", "pt-logout");
  if (location.href.indexOf("&action=edit&newstatus=") == -1 && location.href.indexOf("&action=edit&sbotstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&(newstatus|sbotstatus)=(.*)/;
  matchresults = statusRegExp.exec(location.href);
  updatetype = matchresults[1];
  status = matchresults[2];
  //Modify the form
  switch(updatetype) {
    case 'newstatus':
      document.getElementById('wpTextbox1').value = "{{User:"+wgUserName+scheme+"|"+status+"}}";
      document.getElementById('wpSummary').value = "Status update: "+status;
      break;
    case 'sbotstatus':
      document.getElementById('wpTextbox1').value = (status == "in") ? '' : "busy";
      document.getElementById('wpSummary').value = "Updating status for CVU status bot";
      break;
  }
  document.getElementById('wpMinoredit').checked = true;
  if(updatesbot && location.href.indexOf("&action=edit&sbotstatus=") == -1) {
    window.open(linkprefix+wgUserName+sbotpage+"&action=edit&sbotstatus="+status, "sbotpage_updater", "width=640,height=480,resizable=no,scrollbars=yes");
  }
  //Submit it!
  document.getElementById('editform').submit();
  if(updatetype == "sbotstatus") { self.close() };
});