ย |
ย |
| Line 1: |
Line 1: |
| /* WikiDeal Mobile.js โ loaded by MobileFrontend (Minerva skin) | | /* Not loaded by this wiki (site JS disabled). Mobile section/TOC expansion lives in MediaWiki:Common.css. */ |
| *
| |
| * Goal: every article section is readable on mobile WITHOUT tapping the title.
| |
| * Minerva collapses sections by default (content-visibility:hidden + a toggle
| |
| * on the heading). We expand them all on load so the page reads like a fully
| |
| * open desktop article. Reversible: blanking this page restores default behaviour.
| |
| */
| |
| ( function () {
| |
| function expandAllSections() {
| |
| var heads = document.querySelectorAll( '.collapsible-heading' );
| |
| var blocks = document.querySelectorAll( '.collapsible-block' );
| |
| heads.forEach( function ( h ) { h.classList.add( 'open-block' ); } );
| |
| blocks.forEach( function ( b ) {
| |
| b.classList.add( 'open-block' );
| |
| b.style.setProperty( 'content-visibility', 'visible', 'important' );
| |
| b.style.setProperty( 'height', 'auto', 'important' );
| |
| } );
| |
| }
| |
| ย | |
| if ( document.readyState !== 'loading' ) {
| |
| expandAllSections();
| |
| } else {
| |
| document.addEventListener( 'DOMContentLoaded', expandAllSections );
| |
| }
| |
| ย | |
| // MobileFrontend may (re)collapse after its own JS runs; re-apply shortly after.
| |
| if ( window.mw && mw.hook ) {
| |
| mw.hook( 'wikipage.content' ).add( expandAllSections );
| |
| }
| |
| setTimeout( expandAllSections, 300 );
| |
| setTimeout( expandAllSections, 1200 );
| |
| }() );
| |