MediaWiki:Gadgets/vectorScripts/main.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/*** Mobile navigation toggle button ***/
$( function () {
const BUTTON_CLASS = 'mobile-nav-toggle'
if (document.querySelector('button.' + BUTTON_CLASS)){return;} // early return to avoid double button if this runs twice
let mobileSidebarButton = document.createElement( 'button' );
mobileSidebarButton.className = BUTTON_CLASS;
mobileSidebarButton.addEventListener( 'click', function () {
mobileSidebarButton.classList.toggle( 'nav--expanded' );
} );
document.body.classList.add( 'has-vector-mobile-menu' );
document.getElementById( 'mw-panel' ).prepend( mobileSidebarButton );
} );
/*** End mobile navigation toggle button ***/