mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-17 11:13:34 +00:00
5593b23aa8
Replace all occurrences of `M.require( 'mobile.startup/pathToModule' )` with `M.require( 'mobile.startup' ).pathToModule`. Where multiple requires existed, add an intermediate variable, `var mobile = M.require( 'mobile.startup' )`, and dot off that. This changes improves the consistency of MinervaNeue which currently contains a mix of require styles and eliminates any deprecated requires. Bug: T208915 Change-Id: If14f280672d914d07275197100b12421bb217b67
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
( function ( M, mwMsg ) {
|
|
var
|
|
Overlay = M.require( 'mobile.startup' ).Overlay,
|
|
IssueList = M.require( 'skins.minerva.scripts/IssueList' ),
|
|
KEYWORD_ALL_SECTIONS = 'all',
|
|
NS_MAIN = 0,
|
|
NS_TALK = 1,
|
|
NS_CATEGORY = 14;
|
|
|
|
/**
|
|
* Overlay for displaying page issues
|
|
*
|
|
* @param {IssueSummary[]} issues list of page issue summaries for display.
|
|
* @param {string} section
|
|
* @param {number} namespaceID
|
|
* @return {Overlay}
|
|
*/
|
|
function pageIssuesOverlay( issues, section, namespaceID ) {
|
|
var overlay,
|
|
// Note only the main namespace is expected to make use of section issues, so the
|
|
// heading will always be minerva-meta-data-issues-section-header regardless of
|
|
// namespace.
|
|
headingText = section === '0' || section === KEYWORD_ALL_SECTIONS ?
|
|
getNamespaceHeadingText( namespaceID ) :
|
|
mwMsg( 'minerva-meta-data-issues-section-header' );
|
|
|
|
overlay = new Overlay( {
|
|
className: 'overlay overlay-issues',
|
|
heading: '<strong>' + headingText + '</strong>'
|
|
} );
|
|
|
|
overlay.$( '.overlay-content' ).append(
|
|
new IssueList( issues ).$el
|
|
);
|
|
return overlay;
|
|
}
|
|
|
|
/**
|
|
* Obtain a suitable heading for the issues overlay based on the namespace
|
|
* @param {number} namespaceID is the namespace to generate heading for
|
|
* @return {string} heading for overlay
|
|
*/
|
|
function getNamespaceHeadingText( namespaceID ) {
|
|
switch ( namespaceID ) {
|
|
case NS_CATEGORY:
|
|
return mw.msg( 'mobile-frontend-meta-data-issues-categories' );
|
|
case NS_TALK:
|
|
return mw.msg( 'mobile-frontend-meta-data-issues-talk' );
|
|
case NS_MAIN:
|
|
return mw.msg( 'mobile-frontend-meta-data-issues' );
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
|
|
M.define( 'skins.minerva.scripts/pageIssuesOverlay', pageIssuesOverlay );
|
|
}( mw.mobileFrontend, mw.msg ) );
|