2014-09-29 23:17:34 +00:00
|
|
|
|
/*!
|
2015-12-08 21:46:11 +00:00
|
|
|
|
* OOjs UI v0.14.1
|
2014-09-29 23:17:34 +00:00
|
|
|
|
* https://www.mediawiki.org/wiki/OOjs_UI
|
|
|
|
|
|
*
|
2015-07-22 19:41:02 +00:00
|
|
|
|
* Copyright 2011–2015 OOjs UI Team and other contributors.
|
2014-09-29 23:17:34 +00:00
|
|
|
|
* Released under the MIT license
|
|
|
|
|
|
* http://oojs.mit-license.org
|
|
|
|
|
|
*
|
2015-12-08 21:46:11 +00:00
|
|
|
|
* Date: 2015-12-08T21:43:47Z
|
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();
|
2015-07-01 19:11:28 +00:00
|
|
|
|
if (
|
2015-10-13 20:40:33 +00:00
|
|
|
|
( isFramed && ( isActive || element.isDisabled() || element.hasFlag( 'primary' ) ) ) ||
|
2015-07-01 19:11:28 +00:00
|
|
|
|
( !isFramed && element.hasFlag( 'primary' ) )
|
|
|
|
|
|
) {
|
2014-12-12 20:22:29 +00:00
|
|
|
|
variants.invert = true;
|
2014-09-29 23:17:34 +00:00
|
|
|
|
} else {
|
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;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Instantiation */
|
|
|
|
|
|
|
|
|
|
|
|
OO.ui.theme = new OO.ui.MediaWikiTheme();
|