mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-01 09:16:34 +00:00
e1b94f3f63
We are deprecating the MobileFrontend user module. Use the mw.user module in core instead which supports the same methods. Bug: T204866 Change-Id: I3d068198ab79fe85823a9d82ef4bd7ca07013d3b
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
( function ( M ) {
|
|
|
|
var loader = M.require( 'mobile.startup/rlModuleLoader' ),
|
|
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
|
overlayManager = M.require( 'skins.minerva.scripts/overlayManager' ),
|
|
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' );
|
|
M.on( 'category-added', function () {
|
|
window.location.hash = '#/categories';
|
|
} );
|
|
|
|
loadingOverlay.hide();
|
|
return new CategoryOverlay( {
|
|
api: new mw.Api(),
|
|
isAnon: isAnon,
|
|
title: M.getCurrentPage().title
|
|
} );
|
|
} );
|
|
} );
|
|
|
|
// 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
|
|
} );
|
|
} );
|
|
} );
|
|
|
|
/**
|
|
* Enable the categories button
|
|
* @ignore
|
|
*/
|
|
function initButton() {
|
|
$( '.category-button' ).removeClass( 'hidden' );
|
|
}
|
|
|
|
$( initButton );
|
|
|
|
}( mw.mobileFrontend ) );
|