Difference between revisions of "MediaWiki:Common.js"
Microchip08 (talk | contribs) (Created page with '// ================================================== // Folding Multi Wiki Tabs (experimental) // ================================================== addOnloadHook(foldingTabsM…') |
(No difference)
|
Latest revision as of 21:32, 21 December 2009
// ================================================== // Folding Multi Wiki Tabs (experimental) // ================================================== addOnloadHook(foldingTabsMulti); function foldingTabsMulti() { var len=0; ftsets = getElementsByClassName(document, 'div', 'foldtabSet'); //global object array thingy if(ftsets.length==0) return for(var i=0;i<ftsets.length;i++) { ftsets[i].head = getElementsByClassName(ftsets[i], 'div', 'foldtabHead')[0]; ftsets[i].links = ftsets[i].head.getElementsByTagName('a'); ftsets[i].boxen = getElementsByClassName(ftsets[i], 'div', 'foldtabBox'); if(ftsets[i].links.length < ftsets[i].boxen.length) { len = ftsets[i].boxen.length; } else { len = ftsets[i].links.length; } for(var j=0;j<len;j++) { ftsets[i].links[j].href = 'javascript:showmultitab(\'' + i + '\',\'' + j + '\');'; ftsets[i].links[j].title = 'click to display tab ' + j + ' of set ' + i; } showmultitab(i,'0'); ftsets[i].head.style.display = 'block'; } } function showmultitab(set,num) { for(var j=0;j<ftsets[set].boxen.length;j++) { if(j==num) { ftsets[set].boxen[j].style.display = 'block'; } else { ftsets[set].boxen[j].style.display = 'none'; } } for(var j=0;j<ftsets[set].links.length;j++) { if(j==num) { ftsets[set].links[j].className = 'selected'; ftsets[set].links[j].blur(); } else { ftsets[set].links[j].className = ''; } } } // ================================================== // END Folding Multi Wiki Tabs // ================================================== // http://www.wikia.com/wiki/User:Splarka/tricks#The_javascript