mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/menu.js
jdlrobson b356c7f134 Merge skins.minerva.scripts.top and skins.minerva.mainMenu into scripts
These modules can safely be merged.

Since skins.minerva.scripts.top is added via addModules to the HTML it must
be marked as deprecated and remain temporarily as a redirection to skins.minerva.scripts

All modules have been renamed to be in there new home - no deprecation notices are needed
as they are not used outside Minerva.

I leave skins.minerva.mainMenu.styles as it is used by Special:MobileMenu
and needs to continue to do so.

Change-Id: Ie919151630f4389f8e84e808bec003a6d3d07bd9
2019-02-07 18:10:15 -08:00

34 lines
939 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 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 ) );