Minerva is responsible for loading tablet modules in tablet mode

Since Minerva is the only skin which does this kind of thing, it
was premature to add this logic to the Skin module.

By forcing Minerva to do this itself, we allow MobileFrontend to
be responsible for creating a Skin without having to know about
what that skin may want to load in tablet mode.
(see I8503c26bd064ae0d203f95a35031468c7c678ac1)

Bug: T173454
Change-Id: I32e2b4a10799a06138bfee08abc6769a6b96004d
This commit is contained in:
jdlrobson 2017-10-11 15:22:22 -07:00
parent 42e23ff4bc
commit c04c58a4d7
2 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,7 @@
var inSample, inStable, experiment,
toast = M.require( 'mobile.startup/toast' ),
time = M.require( 'mobile.startup/time' ),
browser = M.require( 'mobile.startup/Browser' ).getSingleton(),
token = mw.storage.get( 'mobile-betaoptin-token' ),
BetaOptinPanel = M.require( 'mobile.betaoptin/BetaOptinPanel' ),
loader = M.require( 'mobile.startup/rlModuleLoader' ),
@ -73,6 +74,18 @@
return lang ? lang.toLowerCase() : undefined;
}
/**
* Loads tablet modules when the skin is in tablet mode and the
* current page is in the main namespace.
* @method
* @ignore
*/
function loadTabletModules() {
if ( browser.isWideScreen() && page.inNamespace( '' ) ) {
mw.loader.using( 'skins.minerva.tablet.scripts' );
}
}
/**
* Load image overlay
* @method
@ -243,6 +256,8 @@
initModifiedInfo();
initRegistrationInfo();
initHistoryLink( $( '.last-modifier-tagline a' ) );
M.on( 'resize', loadTabletModules );
loadTabletModules();
} );
M.define( 'skins.minerva.scripts/overlayManager', overlayManager );

View File

@ -18,7 +18,6 @@
),
skinData = {
el: 'body',
tabletModules: [ 'skins.minerva.tablet.scripts' ],
page: getCurrentPage(),
referencesGateway: ReferencesMobileViewGateway.getSingleton()
};