MediaWiki:Common.js: Difference between revisions

From Midgard Tales Wiki

No edit summary
Tag: Reverted
Tags: Replaced Manual revert
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
// Make sidebar sections collapsible
$(document).ready(function() {
    $('#mw-panel div.portal h3').each(function() {
        var $heading = $(this);
        var $content = $heading.next('div.body');
        // Add a toggle button
        $heading.append('<span class="collapsible-arrow">▼</span>');
        // Collapse/expand on click
        $heading.on('click', function() {
            $content.toggle();
            $heading.find('.collapsible-arrow').text(function(_, text) {
                return text === '▼' ? '▶' : '▼';
            });
        });
        // Collapse all sections by default (optional)
        $content.hide();
        $heading.find('.collapsible-arrow').text('▶');
    });
});

Latest revision as of 07:30, 31 January 2025

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