2014-09-29 23:17:34 +00:00
|
|
|
|
/*!
|
2016-08-16 21:22:47 +00:00
|
|
|
|
* OOjs UI v0.17.8
|
2014-09-29 23:17:34 +00:00
|
|
|
|
* https://www.mediawiki.org/wiki/OOjs_UI
|
|
|
|
|
|
*
|
2016-01-12 23:08:50 +00:00
|
|
|
|
* Copyright 2011–2016 OOjs UI Team and other contributors.
|
2014-09-29 23:17:34 +00:00
|
|
|
|
* Released under the MIT license
|
|
|
|
|
|
* http://oojs.mit-license.org
|
|
|
|
|
|
*
|
2016-08-16 21:22:47 +00:00
|
|
|
|
* Date: 2016-08-16T21:13:48Z
|
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
|
|
|
|
|
|
*/
|
|
|
|
|
|
OO.ui.MediaWikiTheme = function OoUiMediaWikiTheme() {
|
|
|
|
|
|
// Parent constructor
|
2015-06-23 22:04:51 +00:00
|
|
|
|
OO.ui.MediaWikiTheme.parent.call( this );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Setup */
|
|
|
|
|
|
|
|
|
|
|
|
OO.inheritClass( OO.ui.MediaWikiTheme, OO.ui.Theme );
|
|
|
|
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @inheritdoc
|
|
|
|
|
|
*/
|
|
|
|
|
|
OO.ui.MediaWikiTheme.prototype.getElementClasses = function ( element ) {
|
|
|
|
|
|
// Parent method
|
2015-10-13 20:40:33 +00:00
|
|
|
|
var variant, isFramed, isActive,
|
2014-09-29 23:17:34 +00:00
|
|
|
|
variants = {
|
2015-03-12 19:12:01 +00:00
|
|
|
|
warning: false,
|
2014-09-29 23:17:34 +00:00
|
|
|
|
invert: false,
|
2014-12-12 20:22:29 +00:00
|
|
|
|
progressive: false,
|
2014-09-29 23:17:34 +00:00
|
|
|
|
constructive: false,
|
|
|
|
|
|
destructive: false
|
|
|
|
|
|
},
|
|
|
|
|
|
// Parent method
|
2015-10-13 20:40:33 +00:00
|
|
|
|
classes = OO.ui.MediaWikiTheme.parent.prototype.getElementClasses.call( this, element );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
|
2015-04-03 22:05:42 +00:00
|
|
|
|
if ( element.supports( [ 'hasFlag' ] ) ) {
|
|
|
|
|
|
isFramed = element.supports( [ 'isFramed' ] ) && element.isFramed();
|
2015-10-13 20:40:33 +00:00
|
|
|
|
isActive = element.supports( [ 'isActive' ] ) && element.isActive();
|
2016-08-16 21:22:47 +00:00
|
|
|
|
if ( isFramed && ( isActive || element.isDisabled() || element.hasFlag( 'primary' ) ) ) {
|
2016-03-16 19:22:40 +00:00
|
|
|
|
// Button with a dark background, use white icon
|
2014-12-12 20:22:29 +00:00
|
|
|
|
variants.invert = true;
|
2016-03-16 19:22:40 +00:00
|
|
|
|
} else if ( !isFramed && element.isDisabled() ) {
|
|
|
|
|
|
// Frameless disabled button, always use black icon regardless of flags
|
|
|
|
|
|
variants.invert = false;
|
2014-09-29 23:17:34 +00:00
|
|
|
|
} else {
|
2016-03-16 19:22:40 +00:00
|
|
|
|
// Any other kind of button, use the right colored icon if available
|
2014-12-12 20:22:29 +00:00
|
|
|
|
variants.progressive = element.hasFlag( 'progressive' );
|
2014-09-29 23:17:34 +00:00
|
|
|
|
variants.constructive = element.hasFlag( 'constructive' );
|
|
|
|
|
|
variants.destructive = element.hasFlag( 'destructive' );
|
2015-03-12 19:12:01 +00:00
|
|
|
|
variants.warning = element.hasFlag( 'warning' );
|
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
|
|
|
|
|
|
*/
|
|
|
|
|
|
OO.ui.MediaWikiTheme.prototype.getDialogTransitionDuration = function () {
|
|
|
|
|
|
return 250;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2014-09-29 23:17:34 +00:00
|
|
|
|
/* Instantiation */
|
|
|
|
|
|
|
|
|
|
|
|
OO.ui.theme = new OO.ui.MediaWikiTheme();
|
2016-02-02 22:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
}( OO ) );
|