19,670
edits
(trying MW's version of the function) |
(trying MW's version of this func too) |
||
| Line 294: | Line 294: | ||
// if found a navigation bar | // if found a navigation bar | ||
if (hasClass(NavFrame, "NavFrame")) { | if (hasClass(NavFrame, "NavFrame")) { | ||
indexNavigationBar++; | indexNavigationBar++; | ||
var NavToggle = document.createElement("a"); | var NavToggle = document.createElement("a"); | ||
| Line 300: | Line 300: | ||
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); | NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); | ||
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); | NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); | ||
var | var NavToggleText = document.createTextNode(NavigationBarHide); | ||
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { | |||
for (var NavChild = NavFrame.firstChild; NavChild != null | |||
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { | if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { | ||
if ( NavChild.style.display == 'none' ) { | if (NavChild.style.display == 'none') { | ||
NavToggleText = document.createTextNode(NavigationBarShow); | |||
break; | |||
} | } | ||
} | } | ||
} | } | ||
NavToggle.appendChild(NavToggleText); | NavToggle.appendChild(NavToggleText); | ||
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) | // 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++) { | for(var j=0; j < NavFrame.childNodes.length; j++) { | ||