mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-28 08:00:32 +00:00
def03877ce
Bug: T208951 Change-Id: I7cd5ab010596d964fc0896ed250f40d5b6344f6e
55 lines
1.5 KiB
JavaScript
55 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' ),
|
|
user = M.require( 'mobile.startup/user' );
|
|
|
|
// 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: user.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: user.isAnon(),
|
|
title: M.getCurrentPage().title
|
|
} );
|
|
} );
|
|
} );
|
|
|
|
/**
|
|
* Enable the categories button
|
|
* @ignore
|
|
*/
|
|
function initButton() {
|
|
$( '.category-button' ).removeClass( 'hidden' );
|
|
}
|
|
|
|
$( initButton );
|
|
|
|
}( mw.mobileFrontend ) );
|