This is an old revision of this page, as edited by CesarB (talk | contribs) at 16:23, 2 September 2006 (experimental defaulting for NavFrame). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Revision as of 16:23, 2 September 2006 by CesarB (talk | contribs) (experimental defaulting for NavFrame)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:CesarB/monobook.css. |
// Undo addLoadEvent(createNavigationBarToggleButton); window.removeEventListener("load", createNavigationBarToggleButton, false); // Replace function // adds show/hide-button to navigation bars function createNavigationBarToggleButton() { var indexNavigationBar = 0; var countDefaultNavigationBar = 0; // iterate over all < div >-elements for( var i=0; NavFrame = document.getElementsByTagName("div"); i++ ) { // if found a navigation bar if (NavFrame.className == "NavFrame" || NavFrame.className == "NavFrameDefaultShow" || NavFrame.className == "NavFrameDefaultHide") { indexNavigationBar++; if (NavFrame.className == "NavFrame") countDefaultNavigationBar++; 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); // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) for( var j=0; j < NavFrame.childNodes.length; j++ ) { if (NavFrame.childNodes.className == "NavHead") { NavFrame.childNodes.appendChild(NavToggle); } } NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); if (NavFrame.className == "NavFrameDefaultHide") toggleNavigationBar(indexNavigationBar); } } // if more Navigation Bars found than Default: hide all if (NavigationBarShowDefault < countDefaultNavigationBar) { for( var i=1; i<=indexNavigationBar; i++ ) { if (document.getElementById("NavFrame" + i).className == "NavFrame") toggleNavigationBar(i); } } } // Redo addLoadEvent(createNavigationBarToggleButton); addLoadEvent(createNavigationBarToggleButton);