Jump to content

User:Sanmartin/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Sanmartin (talk | contribs) at 01:00, 3 January 2005. 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.
function languageAtTop () {
  /* Take the #p-lang (if there is one) out of the .portlet sidebar and put it
     physically into the main column. */
  var contents  = document.getElementById('column-content');
  var langlinks = document.getElementById('p-lang');

  if (langlinks != null) {
    langlinks.parentNode.removeChild (langlinks);
    contents.insertBefore(langlinks, contents.firstChild);
  }
}

function bottomTabs() {
  /* Duplicate the top "tabs" at the end of the content area. */
  var tabs = document.getElementById('p-cactions').cloneNode(true);
  /* Give all the named items new ids to avoid id clashes with the existing top "tabs". */
  tabs.id = 'mytabs';
  var listitems = tabs.getElementsByTagName('LI');
  for (i=0;i<listitems.length;i++) {
    if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
  }
  document.getElementById('column-content').appendChild(tabs);
}

function reformatMyPage() {
  bottomTabs();
  topTabsToRightPlace();  /* First the top "tabs"... */
  languageAtTop();        /* ... and then the language links */
  /* The order is important here: first move the tabs, then the language links, otherwise they
     will end up in the wrong order (tabs above language links). */
}

if (window.addEventListener) window.addEventListener("load",reformatMyPage,false);
else if (window.attachEvent) window.attachEvent("onload",reformatMyPage);