wiki.techinc.nl/resources/lib/oojs-ui/oojs-ui-mediawiki.js
Roan Kattouw 09c55592a7 Update OOjs UI to v0.1.0-pre (7922a50558)
New changes:
491d279 Change document order of tools and actions to fix floating
25840d5 Add lang and dir attributes to the accelerator element
8a87ddf build: Update various devDependencies to latest
b0de093 Fixed RuboCop Style/AndOr offense
577ed71 Fixed RuboCop Style/AsciiComments offense
565251b Fixed RuboCop Style/EmptyLineBetweenDefs offence
328710e Fixed RuboCop Style/EmptyLines offense
f2a1811 Fixed RuboCop Style/NegatedIf offense
51e041a Fixed RuboCop Style/SignalException offense
6b3bc5c Fixed RuboCop Style/SpaceAroundEqualsInParameterDefault offense
9224811 Fixed RuboCop Style/NilComparison offense
6ff2b19 Fixed RuboCop Style/SpaceAfterComma offense
22c86e2 Fixed RuboCop Style/TrailingBlankLines offense
33fc646 Consistently use @return annotation
709546c Localisation updates from https://translatewiki.net.
6e6dfae build: Clean up fileExists config

Change-Id: I528111c92b89e0302d679ed817a98671035cd8aa
2014-11-19 15:19:06 -08:00

68 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* OOjs UI v0.1.0-pre (7922a50558)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 20112014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
* Date: 2014-11-19T23:18:49Z
*/
/**
* @class
* @extends OO.ui.Theme
*
* @constructor
*/
OO.ui.MediaWikiTheme = function OoUiMediaWikiTheme() {
// Parent constructor
OO.ui.MediaWikiTheme.super.call( this );
};
/* Setup */
OO.inheritClass( OO.ui.MediaWikiTheme, OO.ui.Theme );
/* Methods */
/**
* @inheritdoc
*/
OO.ui.MediaWikiTheme.prototype.getElementClasses = function ( element ) {
// Parent method
var variant,
variants = {
invert: false,
primary: false,
constructive: false,
destructive: false
},
// Parent method
classes = OO.ui.MediaWikiTheme.super.prototype.getElementClasses.call( this, element );
if ( element.supports( [ 'isFramed', 'isDisabled', 'hasFlag' ] ) ) {
if ( element.isFramed() && !element.isDisabled() ) {
if (
element.hasFlag( 'primary' ) ||
element.hasFlag( 'constructive' ) ||
element.hasFlag( 'destructive' )
) {
variants.invert = true;
}
} else {
variants.primary = element.hasFlag( 'primary' );
variants.constructive = element.hasFlag( 'constructive' );
variants.destructive = element.hasFlag( 'destructive' );
}
}
for ( variant in variants ) {
classes[variants[variant] ? 'on' : 'off'].push( 'oo-ui-image-' + variant );
}
return classes;
};
/* Instantiation */
OO.ui.theme = new OO.ui.MediaWikiTheme();