})});
function createContentTabs() {
var ict = 0, divs = document.getElementsByTagName("div"), defaultTab;
for (var i = 0; i<divs.length; i++) {
var ctdiv = divs[i];
if (ctdiv.className == "Tabs") {
var firstTab, tabs;
ict++;
if (document.getElementById("ct_"+ict)) continue;
ctdiv.parentNode.id = "ct_"+ict;
tabs = ctdiv.childNodes;
defaultTab = ctdiv.title;
ctdiv.setAttribute("title", "");
for (var j=0; j<tabs.length; j++) {
var tab = tabs[j];
var toggle = document.createElement("a");
var tabName = tab.className;
if (!tabName) continue;
toggle.setAttribute('href', 'javascript:toggleTab(\'ct_'+ict+'\', \''+tabName+'\');');
toggle.setAttribute('id', 'ct_'+ict+'_'+tabName);
var spLabel = tab.innerHTML;
if (!spLabel) continue;
toggle.innerHTML = spLabel;
if (!firstTab) {
firstTab = tabName;
if (!defaultTab) {
defaultTab=tabName;
}
}
ctdiv.appendChild(toggle);
ctdiv.removeChild(tab);
}
toggleTab("ct_"+ict, defaultTab);
}
}
}
function toggleTab(ct_id, ct_tab) {
var a = document.getElementById(ct_id);
document.getElementById(ct_id+"_"+ct_tab).className = "active";
}
$(createSpoiler);
$(createContentTabs);
if(mw.config.get("wgAction") === "edit") {
|