Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
Created page with "Any JavaScript here will be loaded for all users on every page load.: $(document).ready(function() { // Target the 'Muling' header and collapse it by default. // Assuming the header is part of the collapsible structure. var headerText = 'Muling'; // Replace with the exact header text, e.g., "Muling" var header = $("span.mw-headline:contains('" + headerText + "')").closest(".mw-collapsible"); // Collapse the header section if (header.le..."
 
No edit summary
Line 2: Line 2:


$(document).ready(function() {
$(document).ready(function() {
     // Target the 'Muling' header and collapse it by default.
     // Find the header with the text "Muling"
    // Assuming the header is part of the collapsible structure.
     var targetHeader = $("span.mw-headline:contains('Muling')");
    var headerText = 'Muling';  // Replace with the exact header text, e.g., "Muling"
 
     var header = $("span.mw-headline:contains('" + headerText + "')").closest(".mw-collapsible");
    // Check if the header exists
   
    if (targetHeader.length) {
    // Collapse the header section
        // Collapse the section by adding the 'collapsed' class
    if (header.length) {
        var collapsibleSection = targetHeader.closest(".mw-collapsible");
        header.addClass('collapsed');
        if (collapsibleSection.length && !collapsibleSection.hasClass('collapsed')) {
            collapsibleSection.addClass('collapsed');
        }
     }
     }
});
});

Revision as of 01:05, 2 April 2025

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

$(document).ready(function() {
    // Find the header with the text "Muling"
    var targetHeader = $("span.mw-headline:contains('Muling')");

    // Check if the header exists
    if (targetHeader.length) {
        // Collapse the section by adding the 'collapsed' class
        var collapsibleSection = targetHeader.closest(".mw-collapsible");
        if (collapsibleSection.length && !collapsibleSection.hasClass('collapsed')) {
            collapsibleSection.addClass('collapsed');
        }
    }
});