3 * https://www.mediawiki.org/wiki/OOjs_UI
5 * Copyright 2011–2017 OOjs UI Team and other contributors.
6 * Released under the MIT license
7 * http://oojs.mit-license.org
9 * Date: 2017-01-18T00:07:07Z
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();
51 if ( isFramed
&& ( isActive
|| element
.isDisabled() || element
.hasFlag( 'primary' ) ) ) {
52 // Button with a dark background, use white icon
53 variants
.invert
= true;
54 } else if ( !isFramed
&& element
.isDisabled() ) {
55 // Frameless disabled button, always use black icon regardless of flags
56 variants
.invert
= false;
57 } else if ( !element
.isDisabled() ) {
58 // Any other kind of button, use the right colored icon if available
59 variants
.progressive
= element
.hasFlag( 'progressive' );
60 variants
.constructive
= element
.hasFlag( 'constructive' );
61 variants
.destructive
= element
.hasFlag( 'destructive' );
62 variants
.warning
= element
.hasFlag( 'warning' );
66 for ( variant
in variants
) {
67 classes
[ variants
[ variant
] ? 'on' : 'off' ].push( 'oo-ui-image-' + variant
);
76 OO
.ui
.MediaWikiTheme
.prototype.getDialogTransitionDuration = function () {
82 OO
.ui
.theme
= new OO
.ui
.MediaWikiTheme();