MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */

/******** TOPPEST COLLAPSIBLE ********/ var toppestCollapsible = document.getElementsByClassName("toppest-collapsible-button");

for (i = 0; i < toppestCollapsible.length; i++) { toppestCollapsible[i].addEventListener("click", function {       this.classList.toggle("active");        var content = this.nextElementSibling;        if (content.style.display === "block") {            content.style.display = "none";        } else {            content.style.display = "block";        }    }); }

/******** INFOBOX SECTION COLLAPSE ********/ const infoboxes = Array.from(document.querySelectorAll('div[class*="infobox-"]')); var infoboxHeaders = []; for (i = 0; i < infoboxes.length; i++) { for (j = 0; j < infoboxes[i].getElementsByClassName("header").length; j++) { infoboxHeaders.push(infoboxes[i].getElementsByClassName("header")[j]); } }

for (i = 0; i < infoboxHeaders.length; i++) { infoboxHeaders[i].addEventListener("click", function(event){       const isButton = event.target.nodeName === 'div';        if (!isButton) {            if (event.target.classList.contains("closed")) {                event.target.classList.remove("closed");                event.target.nextElementSibling.style.display = "block";            } else {                event.target.classList.add("closed");                event.target.nextElementSibling.style.display = "none";            }        }    }) if (infoboxHeaders[i].classList.contains("closed")) { infoboxHeaders[i].nextElementSibling.style.display = "none"; } }