Hygiene: Cleanup initialisation files

* Remove deprecated module definitions
* Remove unnecessary check for Minerva skin (this is only
ever run by Minerva skin)
* Move overlayManager to place it is first used
* Make Skin::getMainMenu method redundant

Change-Id: I17ea52172e7fae0a8f0e06b8418c7ed5bb01ef64
This commit is contained in:
jdlrobson 2017-09-07 12:55:28 -04:00 committed by Jdlrobson
parent 69cb08262a
commit 38474ed73f
5 changed files with 11 additions and 12 deletions

View file

@ -12,6 +12,7 @@ editable page whilst logged in, although you must be in test group A to see the
( function ( M, $ ) {
var PageActionOverlay = require( 'mobile.pointerOverlay' ),
skin = M.require( 'skins.minerva.scripts/skin' ),
mainMenu = M.require( 'skins.minerva.scripts.top/mainMenu' ),
util = M.require( 'mobile.startup/util' ),
escapeHash = util.escapeHash,
inEditor = window.location.hash.indexOf( '#editor/' ) > -1,
@ -64,7 +65,7 @@ editable page whilst logged in, although you must be in test group A to see the
confirmMsg: mw.msg( 'mobile-frontend-editor-tutorial-confirm' ),
cancelMsg: mw.msg( 'mobile-frontend-editor-tutorial-cancel' )
} );
skin.mainMenu.on( 'open', function () {
mainMenu.on( 'open', function () {
editOverlay.hide();
} );
editOverlay.show();

View file

@ -3,7 +3,7 @@
* with the Toast notifications defined by common/toast.js.
*/
( function ( M, $ ) {
var mainMenu = M.require( 'skins.minerva.scripts/skin' ).getMainMenu(),
var mainMenu = M.require( 'skins.minerva.scripts.top/mainMenu' ),
router = require( 'mediawiki.router' ),
NotificationBadge = M.require( 'skins.minerva.notifications/NotificationBadge' ),
overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ),

View file

@ -7,7 +7,8 @@
loader = M.require( 'mobile.startup/rlModuleLoader' ),
router = require( 'mediawiki.router' ),
context = M.require( 'mobile.startup/context' ),
overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ),
OverlayManager = M.require( 'mobile.startup/OverlayManager' ),
overlayManager = new OverlayManager( require( 'mediawiki.router' ) ),
page = M.getCurrentPage(),
thumbs = page.getThumbnails(),
experiments = mw.config.get( 'wgMFExperiments' ) || {},
@ -243,4 +244,6 @@
initRegistrationInfo();
initHistoryLink( $( '.last-modifier-tagline a' ) );
} );
M.define( 'skins.minerva.scripts/overlayManager', overlayManager );
}( mw.mobileFrontend, jQuery ) );

View file

@ -1,9 +1,9 @@
// This initialises EventLogging for main menu and some prominent links in the UI.
// This code should only be loaded on the Minerva skin, it does not apply to other skins.
( function ( M, $ ) {
var skin = M.require( 'skins.minerva.scripts/skin' );
var mainMenu = M.require( 'skins.minerva.scripts.top/mainMenu' );
$( function () {
skin.getMainMenu().enableLogging();
mainMenu.enableLogging();
} );
}( mw.mobileFrontend, jQuery ) );

View file

@ -7,8 +7,6 @@
*/
( function ( M, $ ) {
var currentPage, skin,
OverlayManager = M.require( 'mobile.startup/OverlayManager' ),
overlayManager = new OverlayManager( require( 'mediawiki.router' ) ),
PageGateway = M.require( 'mobile.startup/PageGateway' ),
gateway = new PageGateway( new mw.Api() ),
Page = M.require( 'mobile.startup/Page' ),
@ -20,14 +18,14 @@
),
skinData = {
el: 'body',
tabletModules: mw.config.get( 'skin' ) === 'minerva' ? [ 'skins.minerva.tablet.scripts' ] : [],
tabletModules: [ 'skins.minerva.tablet.scripts' ],
page: getCurrentPage(),
referencesGateway: ReferencesMobileViewGateway.getSingleton(),
mainMenu: mainMenu
};
skin = new Skin( skinData );
M.define( 'skins.minerva.scripts/skin', skin ).deprecate( 'mobile.startup/skin' );
M.define( 'skins.minerva.scripts/skin', skin );
( function ( wgRedirectedFrom ) {
// If the user has been redirected, then show them a toast message (see
@ -145,7 +143,4 @@
console.log( mw.msg( 'mobile-frontend-console-recruit' ) );
}
/* eslint-enable no-console */
M.define( 'skins.minerva.scripts/overlayManager', overlayManager )
.deprecate( 'mobile.startup/overlayManager' );
}( mw.mobileFrontend, jQuery ) );