mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-03 18:26:16 +00:00
45 lines
900 B
JavaScript
45 lines
900 B
JavaScript
|
( function ( M ) {
|
||
|
|
||
|
var Icon = M.require( 'mobile.startup/Icon' );
|
||
|
|
||
|
function getIconFromAmbox( $box ) {
|
||
|
var glyph,
|
||
|
names = [
|
||
|
'speedy',
|
||
|
'delete',
|
||
|
'protection',
|
||
|
'pov',
|
||
|
'move',
|
||
|
'style',
|
||
|
'content'
|
||
|
];
|
||
|
|
||
|
// since objects have no concept of ordering we repeat ourselves here
|
||
|
names.forEach( function ( name ) {
|
||
|
if ( !glyph && $box.hasClass( 'ambox-' + name ) ) {
|
||
|
// with a match, exit
|
||
|
glyph = name;
|
||
|
}
|
||
|
} );
|
||
|
|
||
|
glyph = glyph || 'default';
|
||
|
return new Icon( {
|
||
|
glyphPrefix: 'minerva',
|
||
|
name: 'issue-' + glyph
|
||
|
} );
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @module skins.minerva.scripts/utils
|
||
|
*/
|
||
|
M.define( 'skins.minerva.scripts/utils', {
|
||
|
/**
|
||
|
* Extract an icon for use with the issue.
|
||
|
* @param {jQuery.Object} $box element to extract the icon from
|
||
|
* @return {Icon} representing the icon
|
||
|
*/
|
||
|
getIconFromAmbox: getIconFromAmbox
|
||
|
} );
|
||
|
|
||
|
}( mw.mobileFrontend ) );
|