MediaWiki:Monobook.js

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
  • Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac);
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5;
  • Konqueror: simply click the Reload button, or press F5;
  • Opera users may need to completely clear their cache in Tools→Preferences.
/*
See also: [[MediaWiki:Common.js]]

<pre>
*/

/* Functions for adding links to the personal links section and the toolbox*/
function AddPersonalLink(link, text, tag, ibefore)
{
  var li = document.createElement( 'li' );
  li.id = tag;
  var a = document.createElement( 'a' );
  a.appendChild( document.createTextNode( text ) ); 
  a.href = link;
  li.appendChild( a );
  if ( ! ibefore ) // append to end (right) of list
  {
     document.getElementById( 'pt-logout' ).parentNode.appendChild( li );
  }
  else
  {
      var before = document.getElementById( ibefore );
      before.appendChild( li, before );
  }
}

function AddToolboxLink(text, href, onclick, linkid) {
  var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
  
  var link = document.createElement('a');
  link.onclick = onclick;
  link.href = href;
  link.appendChild(document.createTextNode(text));

  var li = document.createElement('li');
  li.id = linkid;
  li.appendChild(link);

  tb.insertBefore(li, tb.firstChild);
  return;
}
/*
</pre>
*/