MediaWiki:Common.js: Difference between revisions

From Midgard Tales Wiki

No edit summary
Tag: Reverted
Tags: Replaced Manual revert
 
(8 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. */
// Add Expand/Collapse All button
$(document).ready(function() {
    // Create the button
    var $toggleButton = $('<button>', {
        text: 'Collapse All',
        class: 'toggle-all-button',
        click: function() {
            var $button = $(this);
            var isCollapsed = $button.text() === 'Expand All';
            // Toggle all sections
            $('#mw-navigation .mw-portlet .mw-portlet-body').toggle(!isCollapsed);
            $('#mw-navigation .mw-portlet .collapsible-arrow').text(isCollapsed ? '▼' : '▶');
            // Update button text
            $button.text(isCollapsed ? 'Collapse All' : 'Expand All');
        }
    });
    // Add the button to the sidebar
    $('#mw-navigation').prepend($toggleButton);
});

Latest revision as of 07:30, 31 January 2025

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