Uživatel:Gorn/monobook.js: Porovnání verzí

z deskovehry.cz - od hráčů pro hráče
Skočit na navigaci Skočit na vyhledávání
m
 
m
Řádek 1: Řádek 1:
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 topTabsToRightPlace() {
function topTabsToRightPlace() {
   /* Remove the top "tabs" from the .portlet side column (why were they ever put there?) and
   /* Remove the top "tabs" from the .portlet side column (why were they ever put there?) and put them at the top of the content area, where they belong! (This allows me to use simple relative positioning to get a proper layout. I don't have to mess around with absolute positioning. This is necessary for my language links at the top to work properly, but it is cleaner anyway. */
    put them at the top of the content area, where they belong! (This allows me to use simple
   var contents  = document.getElementById('bodyContent');
    relative positioning to get a proper layout. I don't have to mess around with absolute
    positioning. This is necessary for my language links at the top to work properly, but it
    is cleaner anyway. */
   var contents  = document.getElementById('column-content');
   var tabs      = document.getElementById('p-cactions');
   var tabs      = document.getElementById('p-cactions');


Řádek 37: Řádek 9:


function reformatMyPage() {
function reformatMyPage() {
  bottomTabs();
   topTabsToRightPlace();   
   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);
if (window.addEventListener) window.addEventListener("load",reformatMyPage,false);
else if (window.attachEvent) window.attachEvent("onload",reformatMyPage);
else if (window.attachEvent) window.attachEvent("onload",reformatMyPage);

Verze z 1. 4. 2006, 23:28

function topTabsToRightPlace() {
  /* Remove the top "tabs" from the .portlet side column (why were they ever put there?) and put them at the top of the content area, where they belong! (This allows me to use simple  relative positioning to get a proper layout. I don't have to mess around with absolute  positioning. This is necessary for my language links at the top to work properly, but it is cleaner anyway. */
  var contents  = document.getElementById('bodyContent');
  var tabs      = document.getElementById('p-cactions');

  tabs.parentNode.removeChild (tabs);
  contents.insertBefore(tabs, contents.firstChild);
}

function reformatMyPage() {
  topTabsToRightPlace();  
}

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