mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-01 01:06:31 +00:00
5bfd949f9a
This patch removes the remaining usages of M.on/M.off/M.emit (functionality derived from moduleLoader.js in MobileFrontend) in Minerva and continues the work of Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2 (patch for MobileFrontend). This patch and the patch for MobileFrontend should be merged together as they both depend on eachother. Depends-On: Id990b0e1a53221d5c1cb3e3012aed0e27d801fc2 Bug: T156186 Change-Id: I005d2fcdbf91c2f1ac98178dfa388aa8174e7530
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
( function ( M ) {
|
|
|
|
var loader = M.require( 'mobile.startup/rlModuleLoader' ),
|
|
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
|
overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ),
|
|
eventBus = M.require( 'mobile.startup/eventBusSingleton' ),
|
|
isAnon = mw.user.isAnon();
|
|
|
|
// check the categories feature has been turned on
|
|
if ( !features.categories ) {
|
|
return;
|
|
}
|
|
|
|
// categories overlay
|
|
overlayManager.add( /^\/categories$/, function () {
|
|
return loader.loadModule( 'mobile.categories.overlays', true ).then( function ( loadingOverlay ) {
|
|
var CategoryOverlay = M.require( 'mobile.categories.overlays/CategoryOverlay' );
|
|
eventBus.on( 'category-added', function () {
|
|
window.location.hash = '#/categories';
|
|
} );
|
|
|
|
loadingOverlay.hide();
|
|
return new CategoryOverlay( {
|
|
api: new mw.Api(),
|
|
isAnon: isAnon,
|
|
title: M.getCurrentPage().title,
|
|
eventBus: eventBus
|
|
} );
|
|
} );
|
|
} );
|
|
|
|
// add categories overlay
|
|
overlayManager.add( /^\/categories\/add$/, function () {
|
|
return loader.loadModule( 'mobile.categories.overlays' ).then( function ( loadingOverlay ) {
|
|
var CategoryAddOverlay = M.require( 'mobile.categories.overlays/CategoryAddOverlay' );
|
|
|
|
loadingOverlay.hide();
|
|
return new CategoryAddOverlay( {
|
|
api: new mw.Api(),
|
|
isAnon: isAnon,
|
|
title: M.getCurrentPage().title,
|
|
eventBus: eventBus
|
|
} );
|
|
} );
|
|
} );
|
|
|
|
/**
|
|
* Enable the categories button
|
|
* @ignore
|
|
*/
|
|
function initButton() {
|
|
$( '.category-button' ).removeClass( 'hidden' );
|
|
}
|
|
|
|
$( initButton );
|
|
|
|
}( mw.mobileFrontend ) );
|