/*!
- * OOjs UI v0.6.0
+ * OOjs UI v0.6.2
* https://www.mediawiki.org/wiki/OOjs_UI
*
- * Copyright 2011–2014 OOjs Team and other contributors.
+ * Copyright 2011–2015 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2014-12-16T21:00:55Z
+ * Date: 2015-01-10T01:25:19Z
*/
( function ( OO ) {
* @return {string} Translated message with parameters substituted
*/
OO.ui.msg = function ( key ) {
- var message = messages[key], params = Array.prototype.slice.call( arguments, 1 );
+ var message = messages[key],
+ params = Array.prototype.slice.call( arguments, 1 );
if ( typeof message === 'string' ) {
// Perform $1 substitution
message = message.replace( /\$(\d+)/g, function ( unused, n ) {
* @param {Object} [config] Configuration options
* @cfg {Function} [$] jQuery for the frame the widget is in
* @cfg {string[]} [classes] CSS class names to add
+ * @cfg {string} [id] HTML id attribute
* @cfg {string} [text] Text to insert
* @cfg {jQuery} [$content] Content elements to append (after text)
* @cfg {Mixed} [data] Element data
if ( $.isArray( config.classes ) ) {
this.$element.addClass( config.classes.join( ' ' ) );
}
+ if ( config.id ) {
+ this.$element.attr( 'id', config.id );
+ }
if ( config.text ) {
this.$element.text( config.text );
}
right = parseFloat( style ? style.borderRightWidth : $el.css( 'borderRightWidth' ) ) || 0;
return {
- top: Math.round( top ),
- left: Math.round( left ),
- bottom: Math.round( bottom ),
- right: Math.round( right )
+ top: top,
+ left: left,
+ bottom: bottom,
+ right: right
};
};
// Temporarily resize the frame so getBodyHeight() can use scrollHeight measurements.
// Disable transitions first, otherwise we'll get values from when the window was animating.
this.withoutSizeTransitions( function () {
- var oldHeight = frameStyleObj.height, oldPosition = bodyStyleObj.position;
+ var oldHeight = frameStyleObj.height,
+ oldPosition = bodyStyleObj.position;
frameStyleObj.height = '1px';
// Force body to resize to new width
bodyStyleObj.position = 'relative';
bodyStyleObj.position = oldPosition;
} );
- return Math.round(
+ return (
// Add buffer for border
( this.$frame.outerHeight() - this.$frame.innerHeight() ) +
// Use combined heights of children
*
* Windows will be closed before they are removed.
*
- * @param {string} name Symbolic name of window to remove
+ * @param {string[]} names Symbolic names of windows to remove
* @return {jQuery.Promise} Promise resolved when window is closed and removed
* @throws {Error} If windows being removed are not being managed
*/
/**
* Destroy window manager.
- *
- * Windows will not be closed, only removed from the DOM.
*/
OO.ui.WindowManager.prototype.destroy = function () {
this.toggleGlobalEvents( false );
this.toggleAriaIsolation( false );
+ this.clearWindows();
this.$element.remove();
};
/**
- * @abstract
* @class
*
* @constructor
.addClass( 'oo-ui-indicatorElement-indicator' )
.toggleClass( 'oo-ui-indicator-' + this.indicator, !!this.indicator );
if ( this.indicatorTitle !== null ) {
- this.$indicatorTitle.attr( 'title', this.indicatorTitle );
+ this.$indicator.attr( 'title', this.indicatorTitle );
}
};
$scrollable.height();
$scrollable.contents().show();
- bodyHeight = Math.round( this.text.$element.outerHeight( true ) );
+ bodyHeight = this.text.$element.outerHeight( true );
$scrollable[0].style.overflow = oldOverflow;
return bodyHeight;
* @param {Object} [config] Configuration options
* @cfg {string} [type='text'] HTML tag `type` attribute
* @cfg {string} [placeholder] Placeholder text
+ * @cfg {boolean} [autofocus=false] Ask the browser to focus this widget, using the 'autofocus' HTML
+ * attribute
* @cfg {boolean} [readOnly=false] Prevent changes
* @cfg {boolean} [multiline=false] Allow multiple lines of text
* @cfg {boolean} [autosize=false] Automatically resize to fit content
if ( config.placeholder ) {
this.$input.attr( 'placeholder', config.placeholder );
}
+ if ( config.autofocus ) {
+ this.$input.attr( 'autofocus', 'autofocus' );
+ }
this.$element.attr( 'role', 'textbox' );
};
popupOffset = this.width * ( { left: 0, center: -0.5, right: -1 } )[this.align];
// Figure out if this will cause the popup to go beyond the edge of the container
- originOffset = Math.round( this.$element.offset().left );
- containerLeft = Math.round( this.$container.offset().left );
+ originOffset = this.$element.offset().left;
+ containerLeft = this.$container.offset().left;
containerWidth = this.$container.innerWidth();
containerRight = containerLeft + containerWidth;
popupLeft = popupOffset - this.containerPadding;
// Initialization
this.setProgress( config.progress !== undefined ? config.progress : false );
- this.$bar.addClass( 'oo-ui-progressBarWidget-bar');
+ this.$bar.addClass( 'oo-ui-progressBarWidget-bar' );
this.$element
.attr( {
role: 'progressbar',