Skillnad mellan versioner av "MediaWiki:Common.js"

Från Seriewikin
Hoppa till navigeringHoppa till sök
(Ny sida: // <pre><nowiki> →‎OCR button: function addOCR(form,value){ if(value =="OCR"){ form.elements["wpSummary"].value="→‎OCR: "; s = form.elements["wpTextbox1"].value; form.elemen...)
 
Rad 1: Rad 1:
// <pre><nowiki>
// ============================================================
// BEGIN Dynamic Navigation Bars (experimantal)
// This script is from Wikipedia. For author attribution, please see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history




/* Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: User:Mike Dillon, User:R. Koot, User:SG
*/


/*
var hasClass = (function () {
OCR button
    var reCache = {};
*/
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();
 
/** Collapsible tables *********************************************************
  *
  *  Description: Allows tables to be collapsed, showing only the header. See
  *              [[Wikipedia:NavFrame]].
  *  Maintainers: [[User:R. Koot]]
  */
   
   
function addOCR(form,value){
var autoCollapse = 2;
if(value =="OCR"){
var collapseCaption = "hide";
form.elements["wpSummary"].value="/*OCR*/";
var expandCaption = "show";
s = form.elements["wpTextbox1"].value;
form.elements["wpTextbox1"].value="{"+"{"+"OCR"+"}"+"}";
}
}
   
   
function addOCRButton(){
function collapseTable( tableIndex )
{
    var Button = document.getElementById( "collapseButton" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );
   
   
if((wgCanonicalNamespace == "Page") && (!wgCurRevisionId) && (self.proofreadPageViewURL)){
    if ( !Table || !Button ) {
        return false;
    }
   
   
var sb  = document.getElementById("wpSave");  
    var Rows = Table.getElementsByTagName( "tr" );  
if(sb){
sb.parentNode.innerHTML = '<input id="wpOcr" name="ocr" type="submit" tabindex="5" accesskey="o" value="OCR" title="OCR" onclick="addOCR(this.form,this.value);"/>'+sb.parentNode.innerHTML;
    if ( Button.firstChild.data == collapseCaption ) {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}
   
   
}
  function createCollapseButtons()
var msg = document.getElementById("noTextMsg");
{
if(msg){
    var tableIndex = 0;
s = msg.innerHTML;
    var NavigationBoxes = new Object();
s = s.replace(/vous pouvez <a href=(.*?)<\/a> ou (.*?)modifier cette page<\/a>\./g, 'vous pouvez ajouter le texte, ou demander une OCR automatique depuis la $2page d\'édition</a>.' );
    var Tables = document.getElementsByTagName( "table" );
msg.innerHTML=s;
   
   
}
    for ( var i = 0; i < Tables.length; i++ ) {
var msg  = document.getElementById("msgNewarticletext");
        if ( hasClass( Tables[i], "collapsible" ) ) {
if(msg){
            NavigationBoxes[ tableIndex ] = Tables[i];
msg.innerHTML='You are editing a page that does not exist.<br/>You may request an OCR by clicking on the OCR button at the bottom of this page.';
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
}
   
   
            var Button    = document.createElement( "span" );
            var ButtonLink = document.createElement( "a" );
            var ButtonText = document.createTextNode( collapseCaption );
   
   
}
            Button.style.styleFloat = "right";
}
            Button.style.cssFloat = "right";
//addOnloadHook(addOCRButton);
            Button.style.fontWeight = "normal";
            Button.style.textAlign = "right";
            Button.style.width = "6em";
   
   
var proofreadpage_debug=1;
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
 
            ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
/**********************
            ButtonLink.appendChild( ButtonText );
*** Undocumented
*** by unknown
**********************/
 
function interwikiExtra() {
// iterate over all <span>-elements
for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
// if found a linkInfo span
if(a.className == "interwiki-info") {
// iterate over all <li>-elements
var count=0;
for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
if(b.className == "interwiki-" + a.id) {
b.innerHTML = b.innerHTML + " "+a.title;
if(a.title == "(vo)") {
b.title = "Texte original";
}
}
else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) {
count = count+1;
if(a.id.charAt(a.id.length-1) == count) {
b.innerHTML = b.innerHTML + " "+a.title;
}
}
}
}
}
}
 
addOnloadHook(interwikiExtra);
 
/**********************
*** Quality indicators on "article" tab
*** by [[user:ThomasV]]
**********************/
function icon_src(t){
var src='';
switch(t){
case "0%": src='http://upload.wikimedia.org/wikipedia/commons/8/8f/00%25.png'; break;
case "25%": src='http://upload.wikimedia.org/wikipedia/commons/5/5b/25%25.png'; break;
case "50%": src='http://upload.wikimedia.org/wikipedia/commons/3/3a/50%25.png'; break;
case "75%": src='http://upload.wikimedia.org/wikipedia/commons/c/cd/75%25.png'; break;
case "100%": src='http://upload.wikimedia.org/wikipedia/commons/6/64/100%25.png'; break;
}
return src;
}
 
function pageQuality() {
var a = document.getElementById("ca-nstab-main");
if(!a) return;
 
var q = document.getElementById("textquality")
if(q) {
var new_img = document.createElement("img");
new_img.setAttribute("src", icon_src(q.className));
a.firstChild.appendChild(new_img);
}
 
for(var i=0; spanElem = document.getElementsByTagName("span")[i]; i++) {
if (spanElem.className == "pagequality")  {
var new_img = document.createElement("img");
new_img.setAttribute("src", icon_src(spanElem.title));
if(wgCanonicalNamespace == "Page") {
a.firstChild.appendChild(new_img);
}
else {
s1 = spanElem.parentNode.previousSibling;
opttext = s1.firstChild.firstChild;
img = opttext.firstChild.nextSibling.nextSibling.nextSibling;
next = img.nextSibling;
opttext.removeChild(img);
opttext.insertBefore(new_img,next);
}
}
}
}
   
   
addOnloadHook(pageQuality);
            Button.appendChild( document.createTextNode( "[" ) );
 
            Button.appendChild( ButtonLink );
 
            Button.appendChild( document.createTextNode( "]" ) );
 
/**********************
*** Add quality buttons on edit view
*** by [[user:ThomasV]]
**********************/
 
function addQuality(form,value){
var text="";
switch(value){
case "25%": text = "Incomplete"; break;
case "50%": text = "Not formatted"; break;
case "75%": text = "Complete and formatted"; break;
case "100%": text = "Proofread"; break;
}
form.elements["wpSummary"].value="/* "+text+" */";
   
   
if(wgCanonicalNamespace == "Page") {
            var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
s = form.elements["headerTextbox"].value;
            /* only add button and increment count if there is a header row to work with */
s = s.replace(/\{\{PageQuality\|(.*?)\}\}/gi,"")
            if (Header) {
form.elements["headerTextbox"].value="{"+"{PageQuality|"+value+"}"+"}"+s;
                Header.insertBefore( Button, Header.childNodes[0] );
                tableIndex++;
            }
        }
    }
   
   
}
    for ( var i = 0; i < tableIndex; i++ ) {
else {
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
s = form.elements["wpTextbox1"].value;
            collapseTable( i );
s = s.replace(/\{\{TextQuality\|(.*?)\}\}/gi,"")
        }
form.elements["wpTextbox1"].value="{"+"{TextQuality|"+value+"}"+"}"+s;
    }
}
}
 
 
 
function addQualityButtons(){
if( wgNamespaceNumber != 0) {
return;
}
var ig  = document.getElementById("wpWatchthis");
if(ig) {
var f = document.createElement("span");
f.innerHTML = ' <input type="radio" name="quality" value="25%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/25%25.png">'+'<input type="radio" name="quality" value="50%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/50%25.png">'+'<input type="radio" name="quality" value="75%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/75%25.png">'+'<input type="radio" name="quality" value="100%" onclick="addQuality(this.form,this.value)"><img src = "/wiki/Special:Filepath/100%25.png"> Text advancement';
ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling)
}
}
 
addOnloadHook(addQualityButtons);
 
/**********************
*** Add arrows on sidebar to compare current page to interlanguage link'd page
*** by [[user:Pathoschild]], based on older script by unknown
**********************/
 
function BilingualLink() {
if(document.getElementById('p-lang') != null) {
// get list of links
var biboxes = document.getElementById('p-lang').getElementsByTagName('li');
 
// iterate over links
for(var i=0; i<biboxes.length; i++) {
// get link
var bilink = biboxes[i].getElementsByTagName('a')[0];
 
// create new URL
var bilang = bilink.getAttribute('href').match(/http:\/\/([^\.]+)\.wikisource/)[1];
var bilanglink = wgServer + '/wiki/' + wgPageName + '?match=' + bilang;
 
// create link
var bianchor = document.createElement('a');
bianchor.setAttribute('href',bilanglink);
bianchor.setAttribute('title','Compare this page with the '+bilang+' version.');
bianchor.appendChild(document.createTextNode(' ⇔'));
 
// add link
biboxes[i].appendChild(bianchor);
}
}
}
 
addOnloadHook(BilingualLink);
 
/**********************
*** add menu on edit page /for selecting subsets of secial characters
*** by [[user:Pathoschild]]
***  - note: must match MediaWiki:Edittools
**********************/
function addCharSubsetMenu() {
var specialchars = document.getElementById('specialchars');
 
if (specialchars) {
var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
menu += "<option>Select</option>";
menu += "<option>Ligatures and symbols</option>";
menu += "<option>Accents</option>";
menu += "<option>Tildes</option>";
menu += "<option>Cedillas</option>";
menu += "<option>Diareses</option>";
menu += "<option>Circumflexes</option>";
menu += "<option>Macrons</option>";
menu += "<option>Other diacritics</option>";
menu += "<option>Greek</option>";
menu += "<option>Hebrew</option>";
menu += "<option>Cyrillic</option>";
menu += "</select>";
specialchars.innerHTML = menu + specialchars.innerHTML.replace(/_newline_/gm, "\n");
 
/* default subset - try to use a cookie some day */
chooseCharSubset(0);
}
}
 
/* select subsection of special characters */
function chooseCharSubset(s) {
var l = document.getElementById('specialchars').getElementsByTagName('p');
for (var i = 0; i < l.length ; i++) {
l[i].style.display = i == s ? 'inline' : 'none';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
}
 
addOnloadHook(addCharSubsetMenu);
 
/**********************
*** Display options (see [[template:option]])
*** by [[user:ThomasV]]
**********************/
 
//Cookies
function SetCookie(name,value) {
document.cookie = name + "=" + escape(value);
}
 
function GetCookie(name) {
var i =0;
while (i < document.cookie.length) {
if (document.cookie.substr(i,name.length) == name) {
var valend = document.cookie.indexOf(";",i+name.length+1);
if (valend == -1) {
valend = document.cookie.length;
}
return unescape(document.cookie.substring(i+name.length+1,valend));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) {
break;
}
}
}
 
function OptionText() {
var indexNavigationBar = 0;
// iterate over all < span >-elements until class "OptionText" is found
for(var i=0; SpanElem = document.getElementsByTagName("span")[i]; i++) {
// if found an option span
if (SpanElem.className == "OptionText") {
//SpanElem.style.display = 'none';
OptionTitle = SpanElem.title;
OptionStyle = SpanElem.firstChild.getAttribute('style');
//check if option was already encountered...
if(!document.getElementById(OptionTitle)) {
//read cookie
var DisplayOptionDefault = true;
CookieDisplayOption = GetCookie("Display"+OptionTitle);
if (CookieDisplayOption ) {
if (CookieDisplayOption == "false") {
DisplayOptionDefault = false;
}
}
var PageDisplay = document.createElement("li");
PageDisplay.setAttribute('id', OptionTitle);
var PageDisplayLink = document.createElement("a");
 
OptionText = document.createTextNode("Désactiver "+OptionTitle);
PageDisplayLink.appendChild(OptionText);
PageDisplayLink.setAttribute('href','javascript:displayOptionText("'+OptionTitle+'","' + OptionStyle +'", '+DisplayOptionDefault+');');
PageDisplay.appendChild(PageDisplayLink);
 
var optlist = document.getElementById("optlist");
if(!optlist) {
var displayOptions = document.createElement("div");
displayOptions.style.marginTop = "0.7em";
displayOptions.innerHTML = '<h5>display options<\/h5><div class="pBody"><ul id="optlist"></ul><\/div>';
document.getElementById("p-tb").appendChild(displayOptions);
optlist = document.getElementById("optlist");
}
optlist.appendChild(PageDisplay);
            displayOptionText(OptionTitle,OptionStyle,DisplayOptionDefault);
}
}
}
  }
  }
addOnloadHook( createCollapseButtons );


function displayOptionText(optiontitle, optionstyle, bool) {
/** Dynamic Navigation Bars (experimental) *************************************
SetCookie ("Display"+optiontitle,bool);
  *
var PageDisplayLink = document.getElementById(optiontitle).firstChild;;
  *  Description: See [[Wikipedia:NavFrame]].
  *  Maintainers: UNMAINTAINED
// iterate over all < span >-elements
  */
for(var i=0; SpanElem = document.getElementsByTagName("span")[i]; i++) {
// if found an option text
  // set up the words in your language
if ((SpanElem.className == "OptionText") && (SpanElem.title == optiontitle)) {
  var NavigationBarHide = '[' + collapseCaption + ']';
if(bool==true ) {
  var NavigationBarShow = '[' + expandCaption + ']';
SpanElem.setAttribute('style',optionstyle);
 
PageDisplayLink.firstChild.data = (optiontitle);
  // set up max count of Navigation Bars on page,
PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", false);');
  // if there are more, all will be hidden
}
  // NavigationBarShowDefault = 0; // all bars will be hidden
if(bool==false) {
  // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
SpanElem.setAttribute('style','null');
  var NavigationBarShowDefault = autoCollapse;
PageDisplayLink.firstChild.data = (optiontitle);
 
PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", true);');
 
}
  // shows and hides content and picture (if available) of navigation bars
}
  // Parameters:
}
  //     indexNavigationBar: the index of navigation bar to be toggled
}
  function toggleNavigationBar(indexNavigationBar)
 
  {
addOnloadHook(OptionText);
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
 
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
/**********************
 
*** Automatically generate page footer from values in {{header}}
    if (!NavFrame || !NavToggle) {
*** by [[user:GrafZahl]]
        return false;
**********************/
    }
 
 
function DisplayFooter() {
    // if shown now
if(document.getElementById && wgNamespaceNumber==0) {
    if (NavToggle.firstChild.data == NavigationBarHide) {
nofooter = document.getElementById('nofooter');
        for (
hp = document.getElementById('headerprevious');
                var NavChild = NavFrame.firstChild;
hn = document.getElementById('headernext');
                NavChild != null;
content = document.getElementById('bodyContent');
                NavChild = NavChild.nextSibling
catlinks = document.getElementById('catlinks');
            ) {
footer = document.createElement('table');
            if ( hasClass( NavChild, 'NavPic' ) ) {
                NavChild.style.display = 'none';
if((!((hp) && (hn) && (content) && (footer))) ||
            }
(nofooter))
            if ( hasClass( NavChild, 'NavContent') ) {
return;
                NavChild.style.display = 'none';
            }
footer.setAttribute('class', 'headertemplate');
        }
footer.setAttribute('id', 'footertemplate');
    NavToggle.firstChild.data = NavigationBarShow;
 
/* Begin footer HTML code */
    // if hidden now
tr = document.createElement('tr');
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
td = document.createElement('td');
        for (
td.setAttribute('align', 'left');
                var NavChild = NavFrame.firstChild;
td.setAttribute('width', '33%');
                NavChild != null;
                NavChild = NavChild.nextSibling
fp = hp.cloneNode(true);
            ) {
fp.setAttribute('id', 'footerprevious');
            if (hasClass(NavChild, 'NavPic')) {
td.appendChild(fp);
                NavChild.style.display = 'block';
            }
tr.appendChild(td);
            if (hasClass(NavChild, 'NavContent')) {
                NavChild.style.display = 'block';
td = document.createElement('td');
            }
td.setAttribute('align', 'center');
        }
td.setAttribute('width', '34%');
    NavToggle.firstChild.data = NavigationBarHide;
a = document.createElement('a');
    }
a.setAttribute('href', '#top');
  }
text = document.createTextNode('Return to the top of the page.');
 
a.appendChild(text);
  // adds show/hide-button to navigation bars
td.appendChild(a);
  function createNavigationBarToggleButton()
tr.appendChild(td);
  {
    var indexNavigationBar = 0;
td = document.createElement('td');
    // iterate over all < div >-elements
td.setAttribute('align', 'right');
    var divs = document.getElementsByTagName("div");
td.setAttribute('width', '33%');
    for(
            var i=0;  
fn = hn.cloneNode(true);
            NavFrame = divs[i];  
fn.setAttribute('id', 'footernext');
            i++
td.appendChild(fn);
        ) {
        // if found a navigation bar
tr.appendChild(td);
        if (hasClass(NavFrame, "NavFrame")) {
 
footer.appendChild(tr);
            indexNavigationBar++;
            var NavToggle = document.createElement("a");
/* End footer HTML code */
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
if(catlinks) // place footer before category box
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
content.insertBefore(footer, catlinks);
           
else
            var NavToggleText = document.createTextNode(NavigationBarHide);
content.appendChild(footer);
            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;  
addOnloadHook(DisplayFooter);
              j < NavFrame.childNodes.length;  
 
              j++
/*************
            ) {
*** Execute JS file in MediaWiki namespace with &usejs parameter on any page
              if (hasClass(NavFrame.childNodes[j], "NavHead")) {
*** by [[m:user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Usejs>
                NavFrame.childNodes[j].appendChild(NavToggle);
*************/
              }
document.write('<script type="text/javascript" src="'
            }
   + 'http://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Usejs.js'
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
   + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
        }
 
    }
// </nowiki></pre>
    // if more Navigation Bars found than Default: hide all
    if (NavigationBarShowDefault < indexNavigationBar) {
        for(
                var i=1;  
                i<=indexNavigationBar;  
                i++
        ) {
            toggleNavigationBar(i);
        }
    }
 
   }
   addOnloadHook( createNavigationBarToggleButton );

Versionen från 5 mars 2008 kl. 22.08

// ============================================================
// BEGIN Dynamic Navigation Bars (experimantal)
// This script is from Wikipedia. For author attribution, please see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history


/* Test if an element has a certain class **************************************
 *
 * Description: Uses regular expressions and caching for better performance.
 * Maintainers: User:Mike Dillon, User:R. Koot, User:SG
 */

var hasClass = (function () {
    var reCache = {};
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();

 /** Collapsible tables *********************************************************
  *
  *  Description: Allows tables to be collapsed, showing only the header. See
  *               [[Wikipedia:NavFrame]].
  *  Maintainers: [[User:R. Koot]]
  */
 
 var autoCollapse = 2;
 var collapseCaption = "hide";
 var expandCaption = "show";
 
 function collapseTable( tableIndex )
 {
     var Button = document.getElementById( "collapseButton" + tableIndex );
     var Table = document.getElementById( "collapsibleTable" + tableIndex );
 
     if ( !Table || !Button ) {
         return false;
     }
 
     var Rows = Table.getElementsByTagName( "tr" ); 
 
     if ( Button.firstChild.data == collapseCaption ) {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = "none";
         }
         Button.firstChild.data = expandCaption;
     } else {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = Rows[0].style.display;
         }
         Button.firstChild.data = collapseCaption;
     }
 }
 
 function createCollapseButtons()
 {
     var tableIndex = 0;
     var NavigationBoxes = new Object();
     var Tables = document.getElementsByTagName( "table" );
 
     for ( var i = 0; i < Tables.length; i++ ) {
         if ( hasClass( Tables[i], "collapsible" ) ) {
             NavigationBoxes[ tableIndex ] = Tables[i];
             Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
 
             var Button     = document.createElement( "span" );
             var ButtonLink = document.createElement( "a" );
             var ButtonText = document.createTextNode( collapseCaption );
 
             Button.style.styleFloat = "right";
             Button.style.cssFloat = "right";
             Button.style.fontWeight = "normal";
             Button.style.textAlign = "right";
             Button.style.width = "6em";
 
             ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
             ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
             ButtonLink.appendChild( ButtonText );
 
             Button.appendChild( document.createTextNode( "[" ) );
             Button.appendChild( ButtonLink );
             Button.appendChild( document.createTextNode( "]" ) );
 
             var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
             /* only add button and increment count if there is a header row to work with */
             if (Header) {
                 Header.insertBefore( Button, Header.childNodes[0] );
                 tableIndex++;
             }
         }
     }
 
     for ( var i = 0;  i < tableIndex; i++ ) {
         if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
             collapseTable( i );
         }
     }
 }
 addOnloadHook( createCollapseButtons );

 /** Dynamic Navigation Bars (experimental) *************************************
  *
  *  Description: See [[Wikipedia:NavFrame]].
  *  Maintainers: UNMAINTAINED
  */
 
  // set up the words in your language
  var NavigationBarHide = '[' + collapseCaption + ']';
  var NavigationBarShow = '[' + expandCaption + ']';
  
  // set up max count of Navigation Bars on page,
  // if there are more, all will be hidden
  // NavigationBarShowDefault = 0; // all bars will be hidden
  // NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
  var NavigationBarShowDefault = autoCollapse;
  
  
  // shows and hides content and picture (if available) of navigation bars
  // Parameters:
  //     indexNavigationBar: the index of navigation bar to be toggled
  function toggleNavigationBar(indexNavigationBar)
  {
     var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
     var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
  
     if (!NavFrame || !NavToggle) {
         return false;
     }
  
     // if shown now
     if (NavToggle.firstChild.data == NavigationBarHide) {
         for (
                 var NavChild = NavFrame.firstChild;
                 NavChild != null;
                 NavChild = NavChild.nextSibling
             ) {
             if ( hasClass( NavChild, 'NavPic' ) ) {
                 NavChild.style.display = 'none';
             }
             if ( hasClass( NavChild, 'NavContent') ) {
                 NavChild.style.display = 'none';
             }
         }
     NavToggle.firstChild.data = NavigationBarShow;
  
     // if hidden now
     } else if (NavToggle.firstChild.data == NavigationBarShow) {
         for (
                 var NavChild = NavFrame.firstChild;
                 NavChild != null;
                 NavChild = NavChild.nextSibling
             ) {
             if (hasClass(NavChild, 'NavPic')) {
                 NavChild.style.display = 'block';
             }
             if (hasClass(NavChild, 'NavContent')) {
                 NavChild.style.display = 'block';
             }
         }
     NavToggle.firstChild.data = NavigationBarHide;
     }
  }
  
  // adds show/hide-button to navigation bars
  function createNavigationBarToggleButton()
  {
     var indexNavigationBar = 0;
     // iterate over all < div >-elements 
     var divs = document.getElementsByTagName("div");
     for(
             var i=0; 
             NavFrame = divs[i]; 
             i++
         ) {
         // if found a navigation bar
         if (hasClass(NavFrame, "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);
             // 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 (hasClass(NavFrame.childNodes[j], "NavHead")) {
                 NavFrame.childNodes[j].appendChild(NavToggle);
               }
             }
             NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
         }
     }
     // if more Navigation Bars found than Default: hide all
     if (NavigationBarShowDefault < indexNavigationBar) {
         for(
                 var i=1; 
                 i<=indexNavigationBar; 
                 i++
         ) {
             toggleNavigationBar(i);
         }
     }
   
  } 
  addOnloadHook( createNavigationBarToggleButton );