mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-01 09:16:34 +00:00
6df395f141
Bug: T225423 Change-Id: Icfbd90c52d9f27ee58bde15c010f705b081285ab
35 lines
1,001 B
JavaScript
35 lines
1,001 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() {
|
|
// Failsafe in case this is not defined e.g. T225423
|
|
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 ) );
|