MediaWiki:Myskin.js: Porovnání verzí

z deskovehry.cz - od hráčů pro hráče
Skočit na navigaci Skočit na vyhledávání
m
 
(Není zobrazeno 25 mezilehlých verzí od stejného uživatele.)
Řádek 1: Řádek 1:
/*
function getElementsByClassName
Written by Jonathan Snook, http://www.snook.ca/jonathan
Add-ons by Robert Nyman, http://www.robertnyman.com
*/
function getElementsByClassName(oElm, strTagName, strClassName){
var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/-/g, "\-");
var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
var oElement;
for(var i=0; i<arrElements.length; i++){
oElement = arrElements[i];
if(oRegExp.test(oElement.className)){
arrReturnElements.push(oElement);
}
}
return (arrReturnElements)
}
function transformPage() {
function transformPage() {
   /* 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. */
   /* 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. */
Řádek 9: Řádek 30:
   var personal = document.getElementById('p-personal');
   var personal = document.getElementById('p-personal');
   var tb = document.getElementById('p-tb');
   var tb = document.getElementById('p-tb');
   personal.parentNode.insertBefore(personal,tb);
   personal.parentNode.insertBefore(personal,tb);
/* mark .section with h1 in it
  sections=getElementsByClassName(document, 'div', 'section');
  for(var i = 0, n = sections.length; i < n; i++) {
    var sec = sections[i];
    if((sec.childNodes[0].tagName=='H1') && (sec.childNodes.length<4)) {
      sec.setAttribute('class', 'section onlyheader');
    }
  }
*/
}
}


function reformatMyPage() {
function reformatMyPage() {
   var mpTitle = "Hlavní strana - DeskoveHryx";
   var mpTitle = "Hlavní strana - ";
   var isMainPage = (document.title.substr(0, mpTitle.length) == mpTitle)
   var isMainPage = (document.title.substr(0, mpTitle.length) == mpTitle)
    
    
Řádek 23: Řádek 54:
     var gw = document.getElementById('globalWrapper');
     var gw = document.getElementById('globalWrapper');
      
      
     gw.setAttribute("class", "mainPage")
     gw.className = "mainPage";


     bodycontent.parentNode.insertBefore(fakehead,bodycontent);
     bodycontent.parentNode.insertBefore(fakehead,bodycontent);

Aktuální verze z 8. 9. 2007, 00:11

/*
	function getElementsByClassName 
	Written by Jonathan Snook, http://www.snook.ca/jonathan
	Add-ons by Robert Nyman, http://www.robertnyman.com
*/

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/-/g, "\-");
	var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function transformPage() {
  /* 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. */
 
  var bodycontent = document.getElementById('bodyContent');
  var tabs = document.getElementById('p-cactions');
  bodycontent.parentNode.insertBefore(tabs,bodycontent);

/* move #personal down the column */
  var personal = document.getElementById('p-personal');
  var tb = document.getElementById('p-tb');
  personal.parentNode.insertBefore(personal,tb);

/* mark .section with h1 in it 
  sections=getElementsByClassName(document, 'div', 'section');

  for(var i = 0, n = sections.length; i < n; i++) {
    var sec = sections[i];
    if((sec.childNodes[0].tagName=='H1') && (sec.childNodes.length<4)) {
      sec.setAttribute('class', 'section onlyheader'); 
    }
  }
*/
}

function reformatMyPage() {
  var mpTitle = "Hlavní strana - ";
  var isMainPage = (document.title.substr(0, mpTitle.length) == mpTitle)
  
  if (isMainPage) { 
    var bodycontent = document.getElementById('bodyContent');
    var fakehead = document.getElementById('fakehead');
    var fh = bodycontent.parentNode.getElementsByTagName("h1");
    var gw = document.getElementById('globalWrapper');
    
    gw.className = "mainPage";

    bodycontent.parentNode.insertBefore(fakehead,bodycontent);
    fh[0].parentNode.removeChild(fh[0]);
  }
  
  transformPage(); 
}   
 
if (window.addEventListener) window.addEventListener("load",reformatMyPage,false);
else if (window.attachEvent) window.attachEvent("onload",reformatMyPage);