MediaWiki

Common.js: Difference between revisions

From Redrock Wiki

No edit summary
No edit summary
Line 10: Line 10:


       if (this.closest('.collapsedDefault')) {
       if (this.closest('.collapsedDefault')) {
         console.log("example")
         content.style.cssText = 'display:inline !important';
        this.innerHTML = this.innerHTML.replace('-up', '-down');
       }
       }



Revision as of 18:21, 9 April 2026

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

/* collapsible categories */
$(function () {
  var coll = document.getElementsByClassName("collapsibleList");

  for (var i = 0; i < coll.length; i++) {
    coll[i].addEventListener("click", function () {
      var content = this.nextElementSibling

      if (this.closest('.collapsedDefault')) {
        content.style.cssText = 'display:inline !important';
        this.innerHTML = this.innerHTML.replace('-up', '-down');
      }

      if (content.style.display === "inline") {
        content.style.cssText = 'display:none !important';
        this.innerHTML = this.innerHTML.replace('-down', '-up');
      } else {
        content.style.cssText = 'display:inline !important';
        this.innerHTML = this.innerHTML.replace('-up', '-down');
      }
    });
  }
});