Difference between revisions of "MediaWiki:Common.js"

Jump to navigation Jump to search
1,055 bytes removed ,  16:02, 18 July 2020
 
Tag: Replaced
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
/* Make the language and edition selectors work */
function showLanguage(event, language) {
    var i, langcontent, languagetab, newcontent;
    // Get all elements with class="language-content" and hide them
    langcontent = document.getElementsByClassName("language-items");
    for (i = 0; i < langcontent.length; i++) {
      langcontent[i].style.display = "none";
    }
    // Get all elements with class="tab-language" and remove the class "active"
    languagetab = document.getElementsByClassName("tab-language");
    for (i = 0; i < languagetab.length; i++) {
      languagetab[i].className = languagetab[i].className.replace(" active", "");
    }
    // Show the current content, and add an "active" class to the button that opened the tab
    newcontent = document.getElementsByClassName("language-items" + " " + language);
    for (i = 0; i < newcontent.length; i++) {
      newcontent[i].style.display = "initial";
    }
    event.currentTarget.className += " active";
    return;
}
function showEdition(event, edition) {
    return;
}

Navigation menu