MediaWiki:Common.js

From SZ
Revision as of 20:16, 25 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.
mw.loader.using('jquery', function () {
    $(document).ready(function () {
        $('.portal .body > ul > li').each(function () {
            var $this = $(this);
            if ($this.find('ul').length) {
                $this.addClass('collapsible-header');
                $this.click(function (e) {
                    // Prevent following links on header click
                    if (e.target.tagName !== 'A') {
                        e.preventDefault();
                        $this.toggleClass('open');
                        $this.children('ul').slideToggle(200);
                    }
                });
            }
        });
    });
});