MediaWiki:Mobile.js: Difference between revisions
Content deleted Content added
No edit summary Tag: Manual revert |
No edit summary Tag: Reverted |
||
Line 156:
}, { passive: true });
})();
// === Auto-expand all H2 sections on mobile ===
mw.loader.using('mediawiki.util', function () {
// Run only on mobile skins
var skin = mw.config.get('skin');
if (skin === 'minerva' || (skin === 'vector-2022' && window.innerWidth < 720)) {
// Delay to ensure DOM ready
mw.hook('wikipage.content').add(function ($content) {
// Expand all section headers that are collapsed
setTimeout(function () {
// Target collapsible H2s in mobile
$content.find('.section-heading, .mf-section-heading, .vector-section-heading').each(function () {
var $heading = $(this);
// Simulate click if section collapsed
if ($heading.hasClass('collapsible-heading') || $heading.hasClass('collapsible-heading-collapsed')) {
$heading.trigger('click');
}
});
}, 500);
});
}
});
| |||