Merge "Remove not used private member variable mParserWarnings from OutputPage"
[mediawiki.git] / resources / lib / oojs-ui / oojs-ui-mediawiki.js
blob677ab5b450b0c5804ee78a3e898415736bc592ef
1 /*!
2  * OOjs UI v0.14.1
3  * https://www.mediawiki.org/wiki/OOjs_UI
4  *
5  * Copyright 2011–2015 OOjs UI Team and other contributors.
6  * Released under the MIT license
7  * http://oojs.mit-license.org
8  *
9  * Date: 2015-12-08T21:43:47Z
10  */
11 /**
12  * @class
13  * @extends OO.ui.Theme
14  *
15  * @constructor
16  */
17 OO.ui.MediaWikiTheme = function OoUiMediaWikiTheme() {
18         // Parent constructor
19         OO.ui.MediaWikiTheme.parent.call( this );
22 /* Setup */
24 OO.inheritClass( OO.ui.MediaWikiTheme, OO.ui.Theme );
26 /* Methods */
28 /**
29  * @inheritdoc
30  */
31 OO.ui.MediaWikiTheme.prototype.getElementClasses = function ( element ) {
32         // Parent method
33         var variant, isFramed, isActive,
34                 variants = {
35                         warning: false,
36                         invert: false,
37                         progressive: false,
38                         constructive: false,
39                         destructive: false
40                 },
41                 // Parent method
42                 classes = OO.ui.MediaWikiTheme.parent.prototype.getElementClasses.call( this, element );
44         if ( element.supports( [ 'hasFlag' ] ) ) {
45                 isFramed = element.supports( [ 'isFramed' ] ) && element.isFramed();
46                 isActive = element.supports( [ 'isActive' ] ) && element.isActive();
47                 if (
48                         ( isFramed && ( isActive || element.isDisabled() || element.hasFlag( 'primary' ) ) ) ||
49                         ( !isFramed && element.hasFlag( 'primary' ) )
50                 ) {
51                         variants.invert = true;
52                 } else {
53                         variants.progressive = element.hasFlag( 'progressive' );
54                         variants.constructive = element.hasFlag( 'constructive' );
55                         variants.destructive = element.hasFlag( 'destructive' );
56                         variants.warning = element.hasFlag( 'warning' );
57                 }
58         }
60         for ( variant in variants ) {
61                 classes[ variants[ variant ] ? 'on' : 'off' ].push( 'oo-ui-image-' + variant );
62         }
64         return classes;
67 /* Instantiation */
69 OO.ui.theme = new OO.ui.MediaWikiTheme();