MediaWiki:Common.js: Unterschied zwischen den Versionen
(Die Seite wurde neu angelegt: „→Das folgende JavaScript wird für alle Benutzer geladen.: // Ausklappbare Navigationsleisten var NavigationBarHide = 'Einklappen ▲'; var NavigationBar…“) |
(kein Unterschied)
|
Version vom 3. November 2011, 12:16 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */ // Ausklappbare Navigationsleisten var NavigationBarHide = 'Einklappen ▲'; var NavigationBarShow = 'Ausklappen ▼'; var NavigationBarShowDefault = 10; //Einstellungen ([[Wiktionary:Einstellungen]]): if ( getCookie('WiktionaryUseJSPreferences') != 'true' ) { NavigationBarShowDefault = 999; } else if ( getCookie('WiktionaryPreferencesHideNav') == 'true' ) { NavigationBarShowDefault = 0; } else if ( getCookie('WiktionaryPreferencesShowNav') == 'true' ) { NavigationBarShowDefault = 999; } else { NavigationBarShowDefault = 999; } function toggleNavigationBar(indexNavigationBar) { var NavToggle = $("NavToggle" + indexNavigationBar); var NavFrame = $("NavFrame" + indexNavigationBar); if (!NavFrame || !NavToggle) {return false;} if (NavToggle.firstChild.data == NavigationBarHide) { for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { if (NavChild.className == 'NavPic') {NavChild.style.display = 'none';} if (NavChild.className == 'NavContent') {NavChild.style.display = 'none';} if (NavChild.className == 'NavToggle') {NavChild.firstChild.data = NavigationBarShow;} } } else if (NavToggle.firstChild.data == NavigationBarShow) { for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { if (NavChild.className == 'NavPic') {NavChild.style.display = 'block';} if (NavChild.className == 'NavContent') {NavChild.style.display = 'block';} if (NavChild.className == 'NavToggle') {NavChild.firstChild.data = NavigationBarHide;} } } } function createNavigationBarToggleButton() { var indexNavigationBar = 0; for (var i=0; NavFrame = $t("div")[i]; i++) { if (NavFrame.className == "NavFrame") { indexNavigationBar++; var NavToggle = document.createElement("a"); NavToggle.className = 'NavToggle'; NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); NavToggle.setAttribute('href', 'javascript:toggleNavigationBar('+indexNavigationBar+')'); var NavToggleText = document.createTextNode(NavigationBarHide); NavToggle.appendChild(NavToggleText); NavFrame.insertBefore(NavToggle, NavFrame.firstChild); NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); } } if (NavigationBarShowDefault < indexNavigationBar) { for (var i=1; i<=indexNavigationBar; i++) {toggleNavigationBar(i);} } } addOnloadHook(createNavigationBarToggleButton); function closedNavBar() { if ( getCookie('WiktionaryUseJSPreferences') != 'true' ) { if (document.getElementById("closedNavBar")) {toggleNavigationBar(1);} else { toggleNavigationBar(0); } } else if ( getCookie('WiktionaryPreferencesHideNav') == 'true' ) { toggleNavigationBar(100); } else if ( getCookie('WiktionaryPreferencesShowNav') == 'true' ) { toggleNavigationBar(0); } else { if (document.getElementById("closedNavBar")) {toggleNavigationBar(1);} else { toggleNavigationBar(0); } } } addOnloadHook(closedNavBar);