User:Avril fan/monobook.js

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
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.
////////////////////////////////////////////////////////////////  // =-=-=- HELPER FUNCTIONS -=-=-=-  function addlilink(tabs, url, name, id, title, key){      var na = document.createElement('a');      na.href = url;      na.appendChild(document.createTextNode(name));      var li = document.createElement('li');      if(id) li.id = id;      li.appendChild(na);      tabs.appendChild(li);      if(id)      {          if(key && title)          {              ta[id] = [key, title];          }          else if(key)          {              ta[id] = [key, ''];          }          else if(title)          {              ta[id] = ['', title];          }      }      // re-render the title and accesskeys from existing code in wikibits.js      akeytt();      return li;  }    function addToolboxLink(url, name, id){      var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];      addlilink(tb, url, name, id);  }    function addTab(url, name, id, title, key){      var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];      return addlilink(tabs, url, name, id, title, key);  }    function addLink(where, url, name, id, title, key, after){      var na = document.createElement('a');      na.href = url;      na.appendChild(document.createTextNode(name));      var li = document.createElement('li');      if(id) li.id = id;      li.appendChild(na);      var tabs = document.getElementById(where).getElementsByTagName('ul')[0];      if(after) {  	tabs.insertBefore(li,document.getElementById(after));      } else {  	tabs.appendChild(li);      }      if(id) {  	if(key && title) { ta[id] = [key, title]; }  	else if(key) { ta[id] = [key, '']; }  	else if(title) { ta[id] = ['', title];}       }      // re-render the title and accesskeys from existing code in wikibits.js      akeytt();      return li;  }  /////////////////////////////////////////////    /**** Add generic tab ****/    function addlilink(tabs, url, name, id){      var na = document.createElement('a');      na.href = url;      na.appendChild(document.createTextNode(name));      var li = document.createElement('li');      li.id = id;      li.appendChild(na);      tabs.appendChild(li);      return li;  }    function addlimenu(tabs, name, id)  {      var na = document.createElement('a');      na.href = '#';      var mn = document.createElement('ul');      na.appendChild(document.createTextNode(name));      var li = document.createElement('li');      li.id = id;      li.className = 'tabmenu';      li.appendChild(na);      li.appendChild(mn);      tabs.appendChild(li);      return li;  }    function URLEncoding(input)        {          var encodedInputString=escape(input);          encodedInputString=encodedInputString.replace(/\+/g, "%2B");          encodedInputString=encodedInputString.replace(/\//g,"%2F");            encodedInputString=encodedInputString.replace(/&/g,"%26");               var outputurl=encodedInputString;          return outputurl;        }  //END    //END  //<nowiki> Admin-like RC Patrol tools    document.write('<script type="text/javascript" src="'                + 'http://en.wikipedia.org/w/index.php?title=User:VoA/monobook.js'                + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');    //</nowiki>[[Category:Wikipedians who use RC script ]]    topaz.statuschanger = new Object();    /* configuration */  // change these to whatever you'd like to show up on your status page.  topaz.statuschanger.statuscode = {    online:'<font color="green">online</font>',    busy:'<font color="orange">busy</font>',    offline:'<font color="red">offline</font>'  };  // true to use the personal bar, false to create a panel in the left column  topaz.statuschanger.usepersonalbar = true;  // true if you'd like your status page on your watchlist  topaz.statuschanger.watchstatus = false;  /* end configuration */    topaz.statuschanger.oldonload = window.onload;  window.onload = function() {    if (typeof topaz.statuschanger.oldonload == "function"){setTimeout('topaz.statuschanger.oldonload()',50);}    if (topaz.statuschanger.usepersonalbar) {      var a = topaz.wputil.addsidepanelbutton("p-personal", "Online",          'javascript:topaz.statuschanger.setstatus("online")'      );      var b = topaz.wputil.addsidepanelbutton("p-personal", "Busy",          'javascript:topaz.statuschanger.setstatus("busy")'      );      var c = topaz.wputil.addsidepanelbutton("p-personal", "Offline",          'javascript:topaz.statuschanger.setstatus("offline")'      );      a.style.borderRight=b.style.borderRight="1px solid #aaaaaa";      b.style.marginLeft=c.style.marginLeft="0px";      a.style.paddingRight=b.style.paddingLeft=b.style.paddingRight=c.style.paddingLeft="2px";    } else {      topaz.wputil.addsidepanel("tz-statuschanger", "status changer");      topaz.wputil.addsidepanelbutton("tz-statuschanger", "Online",          'javascript:topaz.statuschanger.setstatus("online")'      );      topaz.wputil.addsidepanelbutton("tz-statuschanger", "Busy",          'javascript:topaz.statuschanger.setstatus("busy")'      );      topaz.wputil.addsidepanelbutton("tz-statuschanger", "Offline",          'javascript:topaz.statuschanger.setstatus("offline")'      );    }  };    topaz.statuschanger.setstatus = function(statusname) {    topaz.wputil.setpagecontent(        "User:"+topaz.wputil.username()+"/Status",        topaz.statuschanger.statuscode[statusname],        statusname,        topaz.statuschanger.watchstatus);  };