2019-07-02 21:10:10 +00:00
|
|
|
var MainMenu = require( './menu/MainMenu.js' ),
|
|
|
|
mainMenu = createMainMenu();
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2019-07-02 21:10:10 +00:00
|
|
|
/**
|
|
|
|
* 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', {} );
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2019-07-02 21:10:10 +00:00
|
|
|
options.activator = '.header .main-menu-button';
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2019-07-02 21:10:10 +00:00
|
|
|
return new MainMenu( options );
|
|
|
|
}
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2019-07-02 21:10:10 +00:00
|
|
|
$( 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' );
|
|
|
|
}
|
|
|
|
} );
|
2017-07-12 15:12:40 +00:00
|
|
|
|
2019-07-02 21:10:10 +00:00
|
|
|
module.exports = mainMenu;
|