MediaWiki

Common.js: Difference between revisions

From Redrock Wiki

No edit summary
No edit summary
Line 9: Line 9:
       if (content.style.display === "inline") {
       if (content.style.display === "inline") {
         content.style.display = "none";
         content.style.display = "none";
         this.innerHTML = this.innerHTML.replace('{{#fas:angle-down}}', '{{#fas:angle-up}}');
         this.innerHTML = this.innerHTML.replace('-down', '-up');
         console.log('changing' + this.innerHTML + ' to ' + this.innerHTML.replace('-', '+'));
         console.log('changing' + this.innerHTML + ' to ' + this.innerHTML.replace('-', '+'));
       } else {
       } else {
         content.style.display = "inline";
         content.style.display = "inline";
         this.innerHTML = this.innerHTML.replace('{{#fas:angle-up}}', '{{#fas:angle-down}}');
         this.innerHTML = this.innerHTML.replace('-up', '-down');
       }
       }
     });
     });
   }
   }
});
});

Revision as of 23:26, 31 March 2026

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

$(function () {
  var coll = document.getElementsByClassName("collapsibleList");

  for (var i = 0; i < coll.length; i++) {
    coll[i].addEventListener("click", function () {
      var content = this.nextElementSibling
      if (content.style.display === "inline") {
        content.style.display = "none";
        this.innerHTML = this.innerHTML.replace('-down', '-up');
        console.log('changing' + this.innerHTML + ' to ' + this.innerHTML.replace('-', '+'));
      } else {
        content.style.display = "inline";
        this.innerHTML = this.innerHTML.replace('-up', '-down');
      }
    });
  }
});