Jump to content

User:Macy/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Macy (talk | contribs) at 20:07, 17 November 2008 (JS test). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
var summary = ' using [[User:Macy/statuschanger|StatusChanger]]';

addOnloadHook((function (){
    var message=new Array();
        message[0]='[<a href="http://en.wikipedia.org/w/index.php?title=Special:MyPage/Status&action=edit&status=in" class="extiw" title="Change status to in"><b>in</b></a>] [<a href="http://en.wikipedia.org/w/index.php?title=Special:MyPage/Status&action=edit&status=busy" class="extiw" title="Change status to busy"><b>busy</b></a>] [<a href="http://en.wikipedia.org/w/index.php?title=Special:MyPage/Status&action=edit&status=out" class="extiw" title="Change status to out"><b>out</b></a>]';
    var weightLimit = 0;
    var biasPercent = 0.815;
    var whichMessage = (Math.random() < biasPercent) ? weightLimit : message.length;
 
    whichMessage = Math.floor(Math.random() * whichMessage);
 
    var wrapper = document.getElementById("globalWrapper");
    if (wrapper) {
        var div = document.createElement('div');
        div.id = "anon-banner";
        div.style.cssText = "position:absolute; z-index:40; left:155px; top:1px; clear:both; float:left; font-size:90%; white-space:nowrap";
        div.innerHTML = message[whichMessage];
        wrapper.insertBefore(div, wrapper.firstChild);
    }

if (location.href.match("status=in")) 
{
  document.getElementById('wpTextbox1').value = "1";
  document.getElementById('wpSummary').value = "Status update: in" + summary;
  document.getElementById('wpMinoredit').checked = true;
  document.getElementById('editform').submit();
}
 
else if (location.href.match("status=busy")) 
{
  document.getElementById('wpTextbox1').value = "2";
  document.getElementById('wpSummary').value = "Status update: busy" + summary;
  document.getElementById('wpMinoredit').checked = true;
  document.getElementById('editform').submit();
}
 
else if (location.href.match("status=out")) 
{
  document.getElementById('wpTextbox1').value = "3";
  document.getElementById('wpSummary').value = "Status update: out" + summary;
  document.getElementById('wpMinoredit').checked = true;
  document.getElementById('editform').submit();
}

}));