MediaWiki:Common.js: Difference between revisions

From Bose Portable PA Encyclopedia
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
Line 2: Line 2:


/* Expand/Collapse all for FAQList */
/* Expand/Collapse all for FAQList */
mw.hook('wikipage.content').add(function($content) {
mw.hook('wikipage.content').add(function ($content) {
    const expand = $content.find('.faq-expand-all');
    const collapse = $content.find('.faq-collapse-all');


     expand.on('click', function() {
     // Expand all
         $content.find('.faq-list details').attr('open', true);
    $content.on('click', '.faq-expand-all', function () {
         $('.faq-list details').attr('open', true);
     });
     });


     collapse.on('click', function() {
     // Collapse all
         $content.find('.faq-list details').removeAttr('open');
    $content.on('click', '.faq-collapse-all', function () {
         $('.faq-list details').removeAttr('open');
     });
     });
});
});



Latest revision as of 19:48, 10 February 2026

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

/* Expand/Collapse all for FAQList */
mw.hook('wikipage.content').add(function ($content) {

    // Expand all
    $content.on('click', '.faq-expand-all', function () {
        $('.faq-list details').attr('open', true);
    });

    // Collapse all
    $content.on('click', '.faq-collapse-all', function () {
        $('.faq-list details').removeAttr('open');
    });

});


/* MediaWiki:Common.js - test if it's loading */
// alert("Common.js is running");