mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/menu.js
James D. Forrester 75a751f1c6 build: Upgrade eslint-config-wikimedia from 0.10.1 to 0.11.0
Change-Id: I36a88cbf8b468646c21d47c3b58433895e8ff31a
2019-04-04 18:01:40 +00:00

34 lines
942 B
JavaScript

( function ( M ) {
var MainMenu = M.require( 'skins.minerva.scripts/MainMenu' ),
mainMenu = createMainMenu();
/**
* Creates an instance of the `MainMenu`, using the `wgMinervaMenuData` for configuration.
*
* N.B. that the activator - the UI element that the user must click in order to open the main
* menu - is always `.header .main-menu-button`.
*
* @return {MainMenu}
*
* @ignore
*/
function createMainMenu() {
var options = mw.config.get( 'wgMinervaMenuData' );
options.activator = '.header .main-menu-button';
return new MainMenu( options );
}
$( function () {
// eslint-disable-next-line no-jquery/no-global-selector
if ( !$( '#mw-mf-page-left' ).find( '.menu' ).length ) {
// Now we have a main menu button register it.
mainMenu.registerClickEvents();
mainMenu.appendTo( '#mw-mf-page-left' );
}
} );
M.define( 'skins.minerva.scripts/mainMenu', mainMenu );
}( mw.mobileFrontend ) );