Hygiene: Do not pass mainMenu to Skin
This wires the interaction between the skin and the main menu into the initialisation script. Change-Id: I4fac234cb9ead7e99dc52f72819cd4a3c715de1c Depends-On: Ife64c87716a0f56b55a030a3e4224075af3c6d8c
This commit is contained in:
parent
38474ed73f
commit
bf907afd46
|
@ -20,13 +20,32 @@
|
|||
el: 'body',
|
||||
tabletModules: [ 'skins.minerva.tablet.scripts' ],
|
||||
page: getCurrentPage(),
|
||||
referencesGateway: ReferencesMobileViewGateway.getSingleton(),
|
||||
mainMenu: mainMenu
|
||||
referencesGateway: ReferencesMobileViewGateway.getSingleton()
|
||||
};
|
||||
|
||||
skin = new Skin( skinData );
|
||||
M.define( 'skins.minerva.scripts/skin', skin );
|
||||
|
||||
/**
|
||||
* Close navigation if skin is tapped
|
||||
* @param {jQuery.Event} ev
|
||||
* @private
|
||||
*/
|
||||
function onSkinClick( ev ) {
|
||||
var $target = this.$( ev.target );
|
||||
|
||||
// Make sure the menu is open and we are not clicking on the menu button
|
||||
if (
|
||||
mainMenu &&
|
||||
mainMenu.isOpen() &&
|
||||
!$target.hasClass( 'main-menu-button' )
|
||||
) {
|
||||
mainMenu.closeNavigationDrawers();
|
||||
ev.preventDefault();
|
||||
}
|
||||
}
|
||||
skin.on( 'click', onSkinClick.bind( skin ) );
|
||||
|
||||
( function ( wgRedirectedFrom ) {
|
||||
// If the user has been redirected, then show them a toast message (see
|
||||
// https://phabricator.wikimedia.org/T146596).
|
||||
|
|
Loading…
Reference in New Issue