Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Citizen.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Citizen skin */
// Force sections with certain IDs to be collapsed by default on desktop
$(document).ready(function() {
$(document).ready(function() {
   if (window.innerWidth >= 768) { // Only on desktop
   if (window.innerWidth >= 768) { // Only on desktop
     const idsToCollapse = ['Muling', 'Misc', 'Anti-ban', 'Anti-PK', 'Trip_Settings', 'Skills_Settings', 'Equipment']; // section IDs
     const idsToCollapse = ['Muling', 'Misc', 'Anti-ban', 'Anti-PK', 'Trip_Settings', 'Skills_Settings', 'Equipment'];


     idsToCollapse.forEach(function(id) {
     idsToCollapse.forEach(function(rawId) {
      var id = rawId.replace(/ /g, "_"); // Replace spaces with underscores
       var header = document.getElementById(id);
       var header = document.getElementById(id);
       if (header) {
       if (header) {
         var section = header.closest('.citizen-section-heading');
         var section = header.closest('.citizen-section-heading');
         if (section) {
        var content = section.nextElementSibling;
           section.classList.add('citizen-collapsed');
         if (section && content) {
           $(section.nextElementSibling).hide(); // hide the content div
           section.classList.add('citizen-section-collapsed'); // tell Citizen it's collapsed
           content.style.display = "none"; // also hide the content to match
         }
         }
       }
       }

Revision as of 14:10, 25 April 2025

$(document).ready(function() {
  if (window.innerWidth >= 768) { // Only on desktop
    const idsToCollapse = ['Muling', 'Misc', 'Anti-ban', 'Anti-PK', 'Trip_Settings', 'Skills_Settings', 'Equipment'];

    idsToCollapse.forEach(function(rawId) {
      var id = rawId.replace(/ /g, "_"); // Replace spaces with underscores
      var header = document.getElementById(id);
      if (header) {
        var section = header.closest('.citizen-section-heading');
        var content = section.nextElementSibling;
        if (section && content) {
          section.classList.add('citizen-section-collapsed'); // tell Citizen it's collapsed
          content.style.display = "none"; // also hide the content to match
        }
      }
    });
  }
});