52.403
Bearbeitungen
KKeine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 152:
addOnloadHook(toggleInit);
function toggleObjectVisibility(objectId) {
var styleObject = document.getElementById(objectId);
if (styleObject) {
if (styleObject.style.display == 'block') {
styleObject.style.display = "none";
} else {
styleObject.style.display = "block";
}
}
}
var spoilersDone, navbarsDone;
//================================================================================
//*** Dynamic Navigation Bars
Zeile 166 ⟶ 180:
}
//
// Parameters:
function toggleNavigationBar(indexNavigationBar)
{
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
{
if (navbarsDone) return;
var indexNavigationBar = 0;
// iterate over all < div >-elements
Zeile 231 ⟶ 242:
var NavFrame = divs[i];
// if found a navigation bar
if (NavFrame.className == "NavFrame" || NavFrame.className == "NavFrame Ausgeklappt" || NavFrame.className == "NavFrame Zugeklappt") {
indexNavigationBar++;
Zeile 237 ⟶ 248:
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', '
var NavToggleText = document.createTextNode(NavigationBarHide);
NavToggle.appendChild(NavToggleText);
// add NavToggle-Button as first div-element
// in < div class="NavFrame" >
NavFrame.insertBefore(
Zeile 250 ⟶ 260:
);
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
if (NavFrame.className == "NavFrame Zugeklappt") toggleNavigationBar(indexNavigationBar);
}
}
Zeile 255 ⟶ 266:
if (NavigationBarShowDefault < indexNavigationBar) {
for(
var i=1;
i<=indexNavigationBar;
i++
) {
if (NavFrame.className == "NavFrame") toggleNavigationBar(i);
}
}
navbarsDone = true;
}
if (typeof showAllSpoiler == 'undefined' ) {
var showAllSpoiler = 0;
}
function createSpoiler() {
if (showAllSpoiler || spoilersDone) return;
var indexSpoiler = 0;
// iterate over all < div >-elements
var divs = document.getElementsByTagName("div");
for (var i=0; i<divs.length; i++) {
var Spoiler = divs[i];
if (Spoiler.className == "spoiler") {
indexSpoiler++;
Spoiler.style.display = "none";
var SpoilerToggle = document.createElement("a");
SpoilerToggle.className = 'spoilerButton';
SpoilerToggle.setAttribute('id', 'SpoilerToggle' +indexSpoiler);
SpoilerToggle.setAttribute('href', 'javascript:toggleObjectVisibility(\'Spoiler' + indexSpoiler + '\');');
var spLabel = Spoiler.getAttribute("title");
Spoiler.setAttribute("title", "");
if (!spLabel) spLabel = "Spoiler";
var SpoilerToggleText = document.createTextNode(spLabel);
SpoilerToggle.appendChild(SpoilerToggleText);
document.getElementById("bodyContent").insertBefore(
SpoilerToggle,
Spoiler
);
Spoiler.setAttribute('id', 'Spoiler' + indexSpoiler);
}
}
spoilersDone = true;
}
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);
for (var i = 0; i<a.childNodes.length; i++) {
var b = a.childNodes[i];
for (var j = 0; j<b.childNodes.length; j++) {
var c = b.childNodes[j];
if(c.id||c.className) {
if (b.className=="Tabs") {
c.className="";
} else if (b.className=="Contents") {
c.style.display="none";
if (c.id==ct_tab) c.style.display = "block";
}
}
}
}
document.getElementById(ct_id+"_"+ct_tab).className = "active";
}
addOnloadHook(createNavigationBarToggleButton);
addOnloadHook(createSpoiler);
addOnloadHook(createContentTabs);
|