MediaWiki: Common.js
From Xeliki
(testing collapsible tables.) |
(Testing finished, didnt work as intended.) |
||
| Line 48: | Line 48: | ||
} | } | ||
} | } | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Revision as of 05:25, 22 January 2009
addOnloadHook(function() { addPortletLink('p-personal','http://forums.irowiki.org','iW Forums'); });
var tocImgHid = stylepath + '/common/images/Arr_r.png';
var tocImgSho = stylepath + '/common/images/Arr_d.png';
function tocTree() {
appendCSS('a.toctogHidden img, a.toctogShown img, a.toctogNull img {width:12px;height:12px;} #toc li a {padding-right:3px;} a.toctogNull img {visibility:hidden;}');
var toc = document.getElementById('toc');
if(!toc) return
var li = toc.getElementsByTagName('li');
for(var i=0;i<li.length;i++) {
var cul = li[i].getElementsByTagName('ul');
var a = document.createElement('a');
if(cul.length == 0) {
a.setAttribute('class','toctogNull');
} else {
a.setAttribute('class','toctogShown');
a.setAttribute('id','toctog-a-' + i );
a.setAttribute('href','javascript:tocTreeToggle("' + i + '");');
}
var img = document.createElement('img');
img.setAttribute('src',tocImgHid);
img.setAttribute('id','toctog-i-' + i );
a.appendChild(img);
li[i].insertBefore(a,li[i].firstChild);
if(cul.length != 0) tocTreeToggle(i)
}
}
if(wgNamespaceNumber != -1 && wgArticleId != 0) addOnloadHook(tocTree)
function tocTreeToggle(id) {
var a = document.getElementById('toctog-a-' + id);
var img = document.getElementById('toctog-i-' + id);
var cul = a.parentNode.getElementsByTagName('ul');
var disp;
if(a.getAttribute('class') == 'toctogShown') {
disp = 'none';
a.setAttribute('class','toctogHidden');
img.setAttribute('src',tocImgHid);
} else {
disp = 'block';
a.setAttribute('class','toctogShown');
img.setAttribute('src',tocImgSho);
}
for(var j=0;j<cul.length;j++) {
if(cul[j].parentNode == a.parentNode) cul[j].style.display = disp
}
}