MediaWiki:Common.js: Difference between revisions

No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 1,027: Line 1,027:
   } else {
   } else {
     setTimeout( initMobileToc, 400 );
     setTimeout( initMobileToc, 400 );
  }
}() );
/* ── Mobile overrides — injected after readerToolbar's inline style ── */
( function () {
  if ( window.innerWidth > 768 ) return;
  function injectMobileStyles() {
    if ( document.getElementById( 'gr-mobile-css' ) ) return;
    var s = document.createElement( 'style' );
    s.id = 'gr-mobile-css';
    s.textContent = [
      'html{font-size:18px!important;}',
      'html body #gr-static-bar{height:auto!important;min-height:52px!important;padding:6px 8px!important;flex-wrap:nowrap!important;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none!important;gap:4px!important;}',
      'html body #gr-static-bar::-webkit-scrollbar{display:none!important;}',
      'html body .gr-controls .gr-btn{height:44px!important;min-width:44px!important;font-size:15px!important;padding:0 10px!important;flex-shrink:0!important;}',
      'html body .gr-controls .gr-icon-btn{width:44px!important;padding:0!important;}',
      'html body .gr-script-sel{height:40px!important;font-size:14px!important;min-width:90px!important;max-width:120px!important;}',
      'html body .gr-controls .gr-sep{display:none!important;}',
      'html body .gr-btn-staging{display:none!important;}',
      'html body .vector-column-start,html body #vector-toc,html body .vector-toc-landmark,html body .mw-table-of-contents-container,html body .vector-sticky-pinned-container{display:none!important;}',
      'html body .mw-page-container,html body .vector-page-container{max-width:100%!important;padding:0!important;margin:0!important;}',
      'html body #mw-content-text,html body .mw-body,html body .mw-body-content{padding:8px 14px 32px!important;margin:0!important;max-width:100%!important;width:100%!important;box-sizing:border-box!important;}',
      'html body .mw-parser-output{font-size:18px!important;line-height:1.8!important;max-width:100%!important;}',
      'html body .mw-parser-output h2,html body .mw-parser-output .mw-heading2 h2{font-size:1.1em!important;width:100%!important;margin-top:1.2em!important;}',
      'html body .mw-parser-output h3,html body .mw-parser-output .mw-heading3 h3{font-size:1em!important;width:100%!important;}',
      'html body .gr-home-grid{display:flex!important;flex-direction:column!important;flex-wrap:nowrap!important;gap:14px!important;overflow-x:hidden!important;width:100%!important;}',
      'html body .gr-home-card{flex:0 0 auto!important;width:100%!important;max-width:100%!important;min-width:unset!important;box-sizing:border-box!important;}',
      'html body .gr-toggle-btn{font-size:15px!important;padding:10px 20px!important;min-height:44px!important;}',
      'html body #gra-toggle{bottom:80px!important;right:14px!important;width:54px!important;height:54px!important;}',
    ].join( '' );
    document.head.appendChild( s );
  }
  /* Run after readerToolbar's injectStyles() has fired */
  if ( document.readyState === 'loading' ) {
    document.addEventListener( 'DOMContentLoaded', injectMobileStyles );
  } else {
    injectMobileStyles();
   }
   }
}() );
}() );