Merge "selenium: invoke jobs to enforce eventual consistency"
[lhc/web/wiklou.git] / resources / lib / ooui / oojs-ui-wikimediaui.js
1 /*!
2 * OOUI v0.28.2
3 * https://www.mediawiki.org/wiki/OOUI
4 *
5 * Copyright 2011–2018 OOUI Team and other contributors.
6 * Released under the MIT license
7 * http://oojs.mit-license.org
8 *
9 * Date: 2018-09-11T23:05:15Z
10 */
11 ( function ( OO ) {
12
13 'use strict';
14
15 /**
16 * @class
17 * @extends OO.ui.Theme
18 *
19 * @constructor
20 */
21 OO.ui.WikimediaUITheme = function OoUiWikimediaUITheme() {
22 // Parent constructor
23 OO.ui.WikimediaUITheme.parent.call( this );
24 };
25
26 /* Setup */
27
28 OO.inheritClass( OO.ui.WikimediaUITheme, OO.ui.Theme );
29
30 /* Methods */
31
32 /**
33 * @inheritdoc
34 */
35 OO.ui.WikimediaUITheme.prototype.getElementClasses = function ( element ) {
36 // Parent method
37 var variant, isFramed, isActive, isToolOrGroup,
38 variants = {
39 warning: false,
40 invert: false,
41 progressive: false,
42 destructive: false
43 },
44 // Parent method
45 classes = OO.ui.WikimediaUITheme.parent.prototype.getElementClasses.call( this, element );
46
47 if (
48 element instanceof OO.ui.IconWidget &&
49 element.$element.hasClass( 'oo-ui-checkboxInputWidget-checkIcon' )
50 ) {
51 // Icon on CheckboxInputWidget
52 variants.invert = true;
53 } else if ( element.supports( [ 'hasFlag' ] ) ) {
54 isFramed = element.supports( [ 'isFramed' ] ) && element.isFramed();
55 isActive = element.supports( [ 'isActive' ] ) && element.isActive();
56 isToolOrGroup =
57 // Check if the class exists, as classes that are not in the 'core' module may not be loaded
58 ( OO.ui.Tool && element instanceof OO.ui.Tool ) ||
59 ( OO.ui.ToolGroup && element instanceof OO.ui.ToolGroup );
60 if (
61 // Button with a dark background
62 isFramed && ( isActive || element.isDisabled() || element.hasFlag( 'primary' ) ) ||
63 // Toolbar with a dark background
64 isToolOrGroup && element.hasFlag( 'primary' )
65 ) {
66 // … use white icon / indicator, regardless of other flags
67 variants.invert = true;
68 } else if ( !isFramed && element.isDisabled() ) {
69 // Frameless disabled button, always use black icon / indicator regardless of other flags
70 variants.invert = false;
71 } else if ( !element.isDisabled() ) {
72 // Any other kind of button, use the right colored icon / indicator if available
73 variants.progressive = element.hasFlag( 'progressive' ) ||
74 // Active tools/toolgroups
75 ( isToolOrGroup && isActive ) ||
76 // Pressed or selected outline/menu option widgets
77 (
78 (
79 element instanceof OO.ui.MenuOptionWidget ||
80 // Check if the class exists, as classes that are not in the 'core' module may not be loaded
81 ( OO.ui.OutlineOptionWidget && element instanceof OO.ui.OutlineOptionWidget )
82 ) &&
83 ( element.isPressed() || element.isSelected() )
84 );
85
86 variants.destructive = element.hasFlag( 'destructive' );
87 variants.warning = element.hasFlag( 'warning' );
88 }
89 }
90
91 for ( variant in variants ) {
92 classes[ variants[ variant ] ? 'on' : 'off' ].push( 'oo-ui-image-' + variant );
93 }
94
95 return classes;
96 };
97
98 /**
99 * @inheritdoc
100 */
101 OO.ui.WikimediaUITheme.prototype.getDialogTransitionDuration = function () {
102 return 250;
103 };
104
105 /* Instantiation */
106
107 OO.ui.theme = new OO.ui.WikimediaUITheme();
108
109 }( OO ) );
110
111 //# sourceMappingURL=oojs-ui-wikimediaui.js.map.json