mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/menu.js
Niedzielski 6241c8dad7 Revert "MainMenu no longer manages classes on the body tag"
This reverts commit 354de09fa7.

When tapping notifications, both main and notification
menus are shown.

Change-Id: Iaa3ca4d2c7eadb1c9888b514d08895c658336d10
2019-08-07 23:43:43 +00:00

32 lines
832 B
JavaScript

var MainMenu = require( './menu/MainMenu.js' ),
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' );
}
} );
module.exports = mainMenu;