3 * https://www.mediawiki.org/wiki/OOjs_UI
5 * Copyright 2011–2016 OOjs UI Team and other contributors.
6 * Released under the MIT license
7 * http://oojs.mit-license.org
9 * Date: 2016-05-31T21:50:52Z
17 * @extends OO.ui.Theme
21 OO.ui.MediaWikiTheme = function OoUiMediaWikiTheme() {
23 OO.ui.MediaWikiTheme.parent.call( this );
28 OO.inheritClass( OO.ui.MediaWikiTheme, OO.ui.Theme );
35 OO.ui.MediaWikiTheme.prototype.getElementClasses = function ( element ) {
37 var variant, isFramed, isActive,
46 classes = OO.ui.MediaWikiTheme.parent.prototype.getElementClasses.call( this, element );
48 if ( element.supports( [ 'hasFlag' ] ) ) {
49 isFramed = element.supports( [ 'isFramed' ] ) && element.isFramed();
50 isActive = element.supports( [ 'isActive' ] ) && element.isActive();
52 ( isFramed && ( isActive || element.isDisabled() || element.hasFlag( 'primary' ) ) )
54 // Button with a dark background, use white icon
55 variants.invert = true;
56 } else if ( !isFramed && element.isDisabled() ) {
57 // Frameless disabled button, always use black icon regardless of flags
58 variants.invert = false;
60 // Any other kind of button, use the right colored icon if available
61 variants.progressive = element.hasFlag( 'progressive' );
62 variants.constructive = element.hasFlag( 'constructive' );
63 variants.destructive = element.hasFlag( 'destructive' );
64 variants.warning = element.hasFlag( 'warning' );
68 for ( variant in variants ) {
69 classes[ variants[ variant ] ? 'on' : 'off' ].push( 'oo-ui-image-' + variant );
77 OO.ui.theme = new OO.ui.MediaWikiTheme();