MediaWiki
MediaWiki:Foreground.js
From Grouse House Wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Collapsible Headers */ var coll = document.getElementsByClassName("c-header"); var i; for (i = 0; i < coll.length; i++) { coll[i].addEventListener("click", function() { var content = this.nextElementSibling; if (content.style.display === "block") { content.style.display = "none"; if (this.classList.contains("active")) { this.classList.remove("active"); this.classList.add("hidden"); } else { this.classList.add("hidden"); } } else { content.style.display = "block"; if (this.classList.contains("hidden")) { this.classList.remove("hidden"); this.classList.add("active"); } else { this.classList.add("active"); } } }); } /* Remove extra headers from edit button fix */ $(function() { $('h2.c-header.active span.mw-headline').each(function () { var $header = $(this); var $headername = $header.html(); $headernameu = $headername.split(' ').join('_'); var $secondheader = "#" + $headernameu + "_2"; var $editsection = $( $secondheader ).next().children('a').attr("href"); $toclink = "https://grousehouse.wiki/" + $pagenameu + $secondheader; $("a[href*='" + $secondheader + "']").hide(); }); });