2014-09-29 23:17:34 +00:00
|
|
|
|
/*!
|
2019-03-26 23:19:10 +00:00
|
|
|
|
* OOUI v0.31.2
|
2018-01-17 05:47:34 +00:00
|
|
|
|
* https://www.mediawiki.org/wiki/OOUI
|
2014-09-29 23:17:34 +00:00
|
|
|
|
*
|
2019-01-11 16:19:16 +00:00
|
|
|
|
* Copyright 2011–2019 OOUI Team and other contributors.
|
2014-09-29 23:17:34 +00:00
|
|
|
|
* Released under the MIT license
|
|
|
|
|
|
* http://oojs.mit-license.org
|
|
|
|
|
|
*
|
2019-03-26 23:19:10 +00:00
|
|
|
|
* Date: 2019-03-26T23:00:40Z
|
2014-09-29 23:17:34 +00:00
|
|
|
|
*/
|
2016-02-02 22:10:54 +00:00
|
|
|
|
( function ( OO ) {
|
|
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
2014-09-29 23:17:34 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @class
|
2014-10-30 00:10:22 +00:00
|
|
|
|
* @extends OO.ui.Theme
|
2014-09-29 23:17:34 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @constructor
|
|
|
|
|
|
*/
|
2017-05-31 19:26:04 +00:00
|
|
|
|
OO.ui.WikimediaUITheme = function OoUiWikimediaUITheme() {
|
2014-09-29 23:17:34 +00:00
|
|
|
|
// Parent constructor
|
2017-05-31 19:26:04 +00:00
|
|
|
|
OO.ui.WikimediaUITheme.parent.call( this );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
|
|
2017-05-31 19:26:04 +00:00
|
|
|
|
OO.inheritClass( OO.ui.WikimediaUITheme, OO.ui.Theme );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @inheritdoc
|
|
|
|
|
|
*/
|
2017-05-31 19:26:04 +00:00
|
|
|
|
OO.ui.WikimediaUITheme.prototype.getElementClasses = function ( element ) {
|
2014-09-29 23:17:34 +00:00
|
|
|
|
// Parent method
|
2018-03-21 00:36:37 +00:00
|
|
|
|
var variant, isFramed, isActive, isToolOrGroup,
|
2014-09-29 23:17:34 +00:00
|
|
|
|
variants = {
|
|
|
|
|
|
invert: false,
|
2014-12-12 20:22:29 +00:00
|
|
|
|
progressive: false,
|
2019-03-07 09:22:27 +00:00
|
|
|
|
destructive: false,
|
|
|
|
|
|
error: false,
|
2019-03-14 01:03:02 +00:00
|
|
|
|
warning: false,
|
|
|
|
|
|
success: false
|
2014-09-29 23:17:34 +00:00
|
|
|
|
},
|
|
|
|
|
|
// Parent method
|
2017-05-31 19:26:04 +00:00
|
|
|
|
classes = OO.ui.WikimediaUITheme.parent.prototype.getElementClasses.call( this, element );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
|
2018-04-11 01:48:10 +00:00
|
|
|
|
if (
|
|
|
|
|
|
element instanceof OO.ui.IconWidget &&
|
|
|
|
|
|
element.$element.hasClass( 'oo-ui-checkboxInputWidget-checkIcon' )
|
|
|
|
|
|
) {
|
|
|
|
|
|
// Icon on CheckboxInputWidget
|
|
|
|
|
|
variants.invert = true;
|
|
|
|
|
|
} else if ( element.supports( [ 'hasFlag' ] ) ) {
|
2015-04-03 22:05:42 +00:00
|
|
|
|
isFramed = element.supports( [ 'isFramed' ] ) && element.isFramed();
|
2015-10-13 20:40:33 +00:00
|
|
|
|
isActive = element.supports( [ 'isActive' ] ) && element.isActive();
|
2018-03-21 00:36:37 +00:00
|
|
|
|
isToolOrGroup =
|
2019-03-07 09:22:27 +00:00
|
|
|
|
// Check if the class exists, as classes that are not in the 'core' module may
|
|
|
|
|
|
// not be loaded.
|
2018-03-21 00:36:37 +00:00
|
|
|
|
( OO.ui.Tool && element instanceof OO.ui.Tool ) ||
|
|
|
|
|
|
( OO.ui.ToolGroup && element instanceof OO.ui.ToolGroup );
|
2017-04-18 23:41:08 +00:00
|
|
|
|
if (
|
2019-03-07 09:22:27 +00:00
|
|
|
|
// Button with a dark background.
|
2017-04-18 23:41:08 +00:00
|
|
|
|
isFramed && ( isActive || element.isDisabled() || element.hasFlag( 'primary' ) ) ||
|
2019-03-07 09:22:27 +00:00
|
|
|
|
// Toolbar with a dark background.
|
2018-03-21 00:36:37 +00:00
|
|
|
|
isToolOrGroup && element.hasFlag( 'primary' )
|
2017-04-18 23:41:08 +00:00
|
|
|
|
) {
|
|
|
|
|
|
// … use white icon / indicator, regardless of other flags
|
2014-12-12 20:22:29 +00:00
|
|
|
|
variants.invert = true;
|
2016-03-16 19:22:40 +00:00
|
|
|
|
} else if ( !isFramed && element.isDisabled() ) {
|
2019-03-07 09:22:27 +00:00
|
|
|
|
// Frameless disabled button, always use black icon / indicator regardless of
|
|
|
|
|
|
// other flags.
|
2016-03-16 19:22:40 +00:00
|
|
|
|
variants.invert = false;
|
2016-09-13 18:48:04 +00:00
|
|
|
|
} else if ( !element.isDisabled() ) {
|
2019-03-07 09:22:27 +00:00
|
|
|
|
// Any other kind of button, use the right colored icon / indicator if available.
|
2018-03-21 00:36:37 +00:00
|
|
|
|
variants.progressive = element.hasFlag( 'progressive' ) ||
|
|
|
|
|
|
// Active tools/toolgroups
|
|
|
|
|
|
( isToolOrGroup && isActive ) ||
|
2018-06-06 16:49:23 +00:00
|
|
|
|
// Pressed or selected outline/menu option widgets
|
2018-03-21 00:36:37 +00:00
|
|
|
|
(
|
2018-06-06 16:49:23 +00:00
|
|
|
|
(
|
|
|
|
|
|
element instanceof OO.ui.MenuOptionWidget ||
|
2019-03-07 09:22:27 +00:00
|
|
|
|
// Check if the class exists, as classes that are not in the 'core' module
|
|
|
|
|
|
// may not be loaded.
|
|
|
|
|
|
(
|
|
|
|
|
|
OO.ui.OutlineOptionWidget &&
|
|
|
|
|
|
element instanceof OO.ui.OutlineOptionWidget
|
|
|
|
|
|
)
|
2018-06-06 16:49:23 +00:00
|
|
|
|
) &&
|
2018-03-21 00:36:37 +00:00
|
|
|
|
( element.isPressed() || element.isSelected() )
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2014-09-29 23:17:34 +00:00
|
|
|
|
variants.destructive = element.hasFlag( 'destructive' );
|
2019-03-07 09:22:27 +00:00
|
|
|
|
variants.error = element.hasFlag( 'error' );
|
2015-03-12 19:12:01 +00:00
|
|
|
|
variants.warning = element.hasFlag( 'warning' );
|
2019-03-14 01:03:02 +00:00
|
|
|
|
variants.success = element.hasFlag( 'success' );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for ( variant in variants ) {
|
2015-01-31 01:18:26 +00:00
|
|
|
|
classes[ variants[ variant ] ? 'on' : 'off' ].push( 'oo-ui-image-' + variant );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return classes;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2016-07-12 20:30:06 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @inheritdoc
|
|
|
|
|
|
*/
|
2017-05-31 19:26:04 +00:00
|
|
|
|
OO.ui.WikimediaUITheme.prototype.getDialogTransitionDuration = function () {
|
2016-07-12 20:30:06 +00:00
|
|
|
|
return 250;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2014-09-29 23:17:34 +00:00
|
|
|
|
/* Instantiation */
|
|
|
|
|
|
|
2017-05-31 19:26:04 +00:00
|
|
|
|
OO.ui.theme = new OO.ui.WikimediaUITheme();
|
2016-02-02 22:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
}( OO ) );
|
2017-05-10 01:21:26 +00:00
|
|
|
|
|
2018-05-29 23:31:25 +00:00
|
|
|
|
//# sourceMappingURL=oojs-ui-wikimediaui.js.map.json
|