3bed284b37
Having module definitions living inside SkinMonobook makes them less discoverable. It also shouldn't be necessary - even if there are soft dependencies on other modules. A new file resources/optional-enhancements.js is added which will load the two optional dependencies based on whether they have been installed on the client. Bug: T203023 Change-Id: If9a88db52deb0cc91d58cbb40693d4cd448eabbc
23 lines
783 B
JavaScript
23 lines
783 B
JavaScript
/* eslint-disable no-implicit-globals */
|
|
/**
|
|
* Loads additional modules based on whether Echo or ULS extensions
|
|
* have been installed.
|
|
*
|
|
* @return {jQuery.Deferred}
|
|
*/
|
|
function loadOptionalDependencies() {
|
|
var optionalDependencies = [];
|
|
// If the `ext.echo.init` module is null it means Echo has not been installed.
|
|
// The Monobook Echo module should only be added if Echo is installed and user is logged in.
|
|
if ( mw.loader.getState( 'ext.echo.init' ) !== null && !mw.user.isAnon() ) {
|
|
optionalDependencies.push( 'skins.monobook.mobile.echohack' );
|
|
}
|
|
|
|
if ( mw.loader.getState( 'ext.uls.interface' ) !== null ) {
|
|
optionalDependencies.push( 'skins.monobook.mobile.uls' );
|
|
}
|
|
|
|
return mw.loader.load( optionalDependencies );
|
|
}
|
|
|
|
module.exports = loadOptionalDependencies;
|