MediaWiki:Common.js

From SZ
Revision as of 13:59, 24 August 2025 by Test2 (talk | contribs)
Jump to navigation Jump to search

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

document.querySelectorAll('.sidebar .header').forEach(header => {
  header.addEventListener('click', () => {
    header.parentElement.classList.toggle('active');
  });
});


/*
mw.loader.using('jquery.makeCollapsible').then(function () {
    // Turn sidebar sections into collapsible groups
    $('#mw-panel .portal').each(function () {
        var $portal = $(this);
        if ($portal.find('ul').length) {
            $portal.addClass('collapsible');
            $portal.makeCollapsible({
                collapsed: true // start collapsed
            });
        }
    });
});
*/

/*

mw.loader.using('jquery.makeCollapsible').done(function () {
  // Target sidebar portlets (each "box" in the sidebar)
  $('#p-navigation, #p-tb, #p-Book-2, #p-wiki-navigation, #p-coll-print_export').addClass('mw-collapsible mw-collapsed');

  // Auto-apply collapsible behavior
  $('.mw-collapsible').makeCollapsible();
});
*/

/*
mw.loader.using('jquery.makeCollapsible', function () {
    $('.portal').each(function () {
        var $header = $(this).find('h3');

        // Add persistent text (only if not already present)
        if (!$header.find('.persistent-text').length) {
            $header.append('<span class="persistent-text"> [Info]</span>');
        }
    }).makeCollapsible({
        toggle: true
    });
});
*/



/*

// Ensure CollapsibleVector features are enabled
mw.loader.using('jquery.makeCollapsible', function () {
    $('.portal').makeCollapsible({
        toggle: true
    });
});
*/