2018-11-16 15:16:25 +00:00
|
|
|
( function ( M ) {
|
2019-02-07 16:09:20 +00:00
|
|
|
var MainMenu = M.require( 'skins.minerva.scripts/MainMenu' ),
|
2017-07-12 15:12:40 +00:00
|
|
|
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 () {
|
2019-01-09 13:57:26 +00:00
|
|
|
// eslint-disable-next-line jquery/no-global-selector
|
2017-07-12 15:12:40 +00:00
|
|
|
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' );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2019-02-07 16:09:20 +00:00
|
|
|
M.define( 'skins.minerva.scripts/mainMenu', mainMenu );
|
2018-11-16 15:16:25 +00:00
|
|
|
}( mw.mobileFrontend ) );
|