mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts.top/init.js
Ed Sanders 63ead8075d build: Update eslint-config-wikimedia to 0.10.0
* Add inline exceptions for global selectors
* Exception for $.animate in scrolling code
* Fix $ prefixing in search.js
* Fix repeated selectors in search.js & toc.js
* Disable no-parse-html-literal in tests

Change-Id: Id58fe11d1e09714501a378e4ca7ed9588f02f32d
2019-01-24 17:59:40 +00:00

34 lines
944 B
JavaScript

( function ( M ) {
var MainMenu = M.require( 'skins.minerva.mainMenu/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.top/mainMenu', mainMenu );
}( mw.mobileFrontend ) );