MediaWiki:Common.js: Difference between revisions

From SZ
Jump to navigation Jump to search
No edit summary
Tag: Reverted
No edit summary
Tags: Manual revert Reverted
Line 1: Line 1:
/* Collapsible sidebar sections */
mw.loader.using('jquery', function () {
 
    $(document).ready(function () {
$(document).ready(function() {
        $('.portal .body > ul > li').each(function () {
 
            var $this = $(this);
  $('.mw-collapsible .mw-collapsible-arrowtoggle').click(function() {
            if ($this.find('ul').length) {
 
                $this.addClass('collapsible-header');
    $(this).closest('.mw-collapsible').toggleClass('mw-collapsible-toggle-collapsed');
                $this.click(function (e) {
 
                    // Prevent following links on header click
    $(this).closest('.mw-collapsible').find('.mw-collapsible-content').slideToggle();
                    if (e.target.tagName !== 'A') {
 
                        e.preventDefault();
  });
                        $this.toggleClass('open');
 
                        $this.children('ul').slideToggle(200);
                    }
                });
            }
        });
    });
});
});

Revision as of 20:16, 25 August 2025

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);
                    }
                });
            }
        });
    });
});