MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Manual revert |
No edit summary |
||
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. */ | ||
mw.loader.using(['mediawiki.util']).then(function () { | |||
function initCollapsiblePortlet(name) { | |||
var portal = document.getElementById('p-' + name); | |||
if (!portal) return; | |||
var heading = portal.querySelector('.vector-menu-heading, h3'); | |||
var content = portal.querySelector('.vector-menu-content, .body'); | |||
var | if (!heading || !content) return; | ||
/ | // Debugging: confirm elements | ||
console.log('Found portal:', name, heading, content); | |||
// Rest of your code unchanged... | |||
} | |||
function bootCollapsibleSidebars() { | |||
COLLAPSIBLE_SECTIONS.forEach(initCollapsiblePortlet); | |||
function | |||
} | } | ||
mw.hook('wikipage.content').add(bootCollapsibleSidebars); | |||
$(bootCollapsibleSidebars); | |||
}); | |||
} | |||
Revision as of 14:59, 24 August 2025
/* Any JavaScript here will be loaded for all users on every page load. */ mw.loader.using(['mediawiki.util']).then(function () { function initCollapsiblePortlet(name) { var portal = document.getElementById('p-' + name); if (!portal) return; var heading = portal.querySelector('.vector-menu-heading, h3'); var content = portal.querySelector('.vector-menu-content, .body'); if (!heading || !content) return; // Debugging: confirm elements console.log('Found portal:', name, heading, content); // Rest of your code unchanged... } function bootCollapsibleSidebars() { COLLAPSIBLE_SECTIONS.forEach(initCollapsiblePortlet); } mw.hook('wikipage.content').add(bootCollapsibleSidebars); $(bootCollapsibleSidebars); });