/*!
- * OOjs UI v0.1.0-pre (ac6848398c)
+ * OOjs UI v0.1.0-pre (eca1fc20e7)
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2014 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: Wed Apr 09 2014 17:58:17 GMT-0700 (PDT)
+ * Date: Fri Apr 11 2014 16:47:56 GMT-0700 (PDT)
*/
( function ( OO ) {
* This may be ignored if getTagName is overridden.
*
* @static
- * @property {string}
* @inheritable
+ * @property {string}
*/
OO.ui.Element.static.tagName = 'div';
return OO.ui.Element.scrollIntoView( this.$element[0], config );
};
+/**
+ * Bind a handler for an event on this.$element
+ * @see #static-method-onDOMEvent
+ * @param {string} event
+ * @param {Function} callback
+ */
+OO.ui.Element.prototype.onDOMEvent = function ( event, callback ) {
+ OO.ui.Element.onDOMEvent( this.$element, event, callback );
+};
+
+/**
+ * Unbind a handler bound with #offDOMEvent
+ * @see #static-method-offDOMEvent
+ * @param {string} event
+ * @param {Function} callback
+ */
+OO.ui.Element.prototype.offDOMEvent = function ( event, callback ) {
+ OO.ui.Element.offDOMEvent( this.$element, event, callback );
+};
+
( function () {
// Static
var specialFocusin;
};
/**
- * Bind a handler for an event on the DOM element.
+ * Bind a handler for an event on a DOM element.
*
* Uses jQuery internally for everything except for events which are
* known to have issues in the browser or in jQuery. This method
* should become obsolete eventually.
*
- * @param {string} event
- * @param {Function} callback
+ * @static
+ * @param {HTMLElement|jQuery} el DOM element
+ * @param {string} event Event to bind
+ * @param {Function} callback Callback to call when the event fires
*/
- OO.ui.Element.prototype.onDOMEvent = function ( event, callback ) {
+ OO.ui.Element.onDOMEvent = function ( el, event, callback ) {
var orig;
if ( event === 'focusin' ) {
orig = $.event.special.focusin;
$.event.special.focusin = specialFocusin;
- this.$element.on( event, callback );
+ $( el ).on( event, callback );
// Restore
$.event.special.focusin = orig;
} else {
- this.$element.on( event, callback );
+ $( el ).on( event, callback );
}
};
/**
- * @param {string} event
- * @param {Function} callback
+ * Unbind a handler bound with #static-method-onDOMEvent.
+ *
+ * @static
+ * @param {HTMLElement|jQuery} el DOM element
+ * @param {string} event Event to unbind
+ * @param {Function} [callback] Callback to unbind
*/
- OO.ui.Element.prototype.offDOMEvent = function ( event, callback ) {
+ OO.ui.Element.offDOMEvent = function ( el, event, callback ) {
var orig;
if ( event === 'focusin' ) {
orig = $.event.special.focusin;
$.event.special.focusin = specialFocusin;
- this.$element.off( event, callback );
+ $( el ).off( event, callback );
$.event.special.focusin = orig;
} else {
- this.$element.off( event, callback );
+ $( el ).off( event, callback );
}
};
}() );
// Properties
this.$ = OO.ui.Element.getJQuery( doc, this );
- this.$content = this.$( '.oo-ui-frame-content' );
+ this.$content = this.$( '.oo-ui-frame-content' ).attr( 'tabIndex', 0 );
this.$document = this.$( doc );
this.constructor.static.transplantStyles(
};
/**
- * Sets the size of the frame.
+ * Set the size of the frame.
*
* @param {number} width Frame width in pixels
* @param {number} height Frame height in pixels
this.frame.run( OO.ui.bind( function () {
this.$element.show();
this.visible = true;
- this.frame.$element.focus();
this.emit( 'opening', data );
this.setup( data );
this.emit( 'open', data );
this.opening = false;
+ // Focus the content div (which has a tabIndex) to inactivate
+ // (but not clear) selections in the parent frame.
+ // Must happen after the window has opened.
+ this.frame.$content.focus();
}, this ) );
}
*
* @abstract
* @static
- * @property {string}
* @inheritable
+ * @property {string}
*/
OO.ui.Dialog.static.name = '';
* Map of symbolic size names and CSS classes.
*
* @static
- * @property {Object}
* @inheritable
+ * @property {Object}
*/
OO.ui.Dialog.static.sizeCssClasses = {
'small': 'oo-ui-dialog-small',
/**
* Element with a button.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {jQuery} $button Button node, assigned to #$button
/**
* Handles mouse down events.
*
- * @method
* @param {jQuery.Event} e Mouse down event
*/
OO.ui.ButtonedElement.prototype.onMouseDown = function () {
- this.tabIndex = this.$button.attr( 'tabIndex' );
+ // tabIndex should generally be interacted with via the property,
+ // but it's not possible to reliably unset a tabIndex via a property
+ // so we use the (lowercase) "tabindex" attribute instead.
+ this.tabIndex = this.$button.attr( 'tabindex' );
// Remove the tab-index while the button is down to prevent the button from stealing focus
this.$button
- .removeAttr( 'tabIndex' )
+ .removeAttr( 'tabindex' )
.addClass( 'oo-ui-buttonedElement-pressed' );
this.getElementDocument().addEventListener( 'mouseup', this.onMouseUpHandler, true );
};
/**
* Handles mouse up events.
*
- * @method
* @param {jQuery.Event} e Mouse up event
*/
OO.ui.ButtonedElement.prototype.onMouseUp = function () {
// Restore the tab-index after the button is up to restore the button's accesssibility
this.$button
- .attr( 'tabIndex', this.tabIndex )
+ .attr( 'tabindex', this.tabIndex )
.removeClass( 'oo-ui-buttonedElement-pressed' );
this.getElementDocument().removeEventListener( 'mouseup', this.onMouseUpHandler, true );
};
/**
* Set active state.
*
- * @method
* @param {boolean} [value] Make button active
* @chainable
*/
/**
* Element that can be automatically clipped to visible boundaies.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {jQuery} $clippable Nodes to clip, assigned to #$clippable
/**
* Set clipping.
*
- * @method
* @param {boolean} value Enable clipping
* @chainable
*/
/**
* Check if the element will be clipped to fit the visible area of the nearest scrollable container.
*
- * @method
* @return {boolean} Element will be clipped to the visible area
*/
OO.ui.ClippableElement.prototype.isClipping = function () {
/**
* Check if the bottom or right of the element is being clipped by the nearest scrollable container.
*
- * @method
* @return {boolean} Part of the element is being clipped
*/
OO.ui.ClippableElement.prototype.isClipped = function () {
/**
* Set the ideal size.
*
- * @method
* @param {number|string} [width] Width as a number of pixels or CSS string with unit suffix
* @param {number|string} [height] Height as a number of pixels or CSS string with unit suffix
*/
* Element will be clipped the bottom or right of the element is within 10px of the edge of, or
* overlapped by, the visible area of the nearest scrollable container.
*
- * @method
* @chainable
*/
OO.ui.ClippableElement.prototype.clip = function () {
* A flag, when set, adds a CSS class on the `$element` by combing `oo-ui-flaggableElement-` with
* the flag name. Flags are primarily useful for styling.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {Object} [config] Configuration options
/**
* Check if a flag is set.
*
- * @method
- * @param {string} flag Flag name to check
- * @returns {boolean} Has flag
+ * @param {string} flag Name of flag
+ * @return {boolean} Has flag
*/
OO.ui.FlaggableElement.prototype.hasFlag = function ( flag ) {
return flag in this.flags;
};
/**
- * Get the names of all flags.
+ * Get the names of all flags set.
*
- * @method
- * @returns {string[]} flags Flag names
+ * @return {string[]} flags Flag names
*/
OO.ui.FlaggableElement.prototype.getFlags = function () {
return Object.keys( this.flags );
/**
* Add one or more flags.
*
- * @method
* @param {string[]|Object.<string, boolean>} flags List of flags to add, or list of set/remove
* values, keyed by flag name
* @chainable
/**
* Element containing a sequence of child elements.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {jQuery} $group Container node, assigned to #$group
/**
* Get items.
*
- * @method
- * @returns {OO.ui.Element[]} Items
+ * @return {OO.ui.Element[]} Items
*/
OO.ui.GroupElement.prototype.getItems = function () {
return this.items.slice( 0 );
/**
* Add items.
*
- * @method
* @param {OO.ui.Element[]} items Item
* @param {number} [index] Index to insert items at
* @chainable
*
* Items will be detached, not removed, so they can be used later.
*
- * @method
* @param {OO.ui.Element[]} items Items to remove
* @chainable
*/
*
* Items will be detached, not removed, so they can be used later.
*
- * @method
* @chainable
*/
OO.ui.GroupElement.prototype.clearItems = function () {
this.items = [];
this.$items.detach();
this.$items = this.$( [] );
+
+ return this;
};
/**
* Element containing an icon.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {jQuery} $icon Icon node, assigned to #$icon
/**
* Set icon.
*
- * @method
* @param {Object|string} icon Symbolic icon name, or map of icon names keyed by language ID;
* use the 'default' key to specify the icon to be used when there is no icon in the user's
* language
/**
* Get icon.
*
- * @method
- * @returns {string} Icon
+ * @return {string} Icon
*/
OO.ui.IconedElement.prototype.getIcon = function () {
return this.icon;
/**
* Element containing an indicator.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {jQuery} $indicator Indicator node, assigned to #$indicator
/**
* Set indicator.
*
- * @method
* @param {string|null} indicator Symbolic name of indicator to use or null for no indicator
* @chainable
*/
/**
* Set indicator label.
*
- * @method
* @param {string|Function|null} indicator Indicator title text, a function that return text or null
* for no indicator title
* @chainable
/**
* Get indicator.
*
- * @method
- * @returns {string} title Symbolic name of indicator
+ * @return {string} title Symbolic name of indicator
*/
OO.ui.IndicatedElement.prototype.getIndicator = function () {
return this.indicator;
/**
* Get indicator title.
*
- * @method
- * @returns {string} Indicator title text
+ * @return {string} Indicator title text
*/
OO.ui.IndicatedElement.prototype.getIndicatorTitle = function () {
return this.indicatorTitle;
/**
* Element containing a label.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {jQuery} $label Label node, assigned to #$label
* An empty string will result in the label being hidden. A string containing only whitespace will
* be converted to a single
*
- * @method
* @param {jQuery|string|Function|null} label Label nodes; text; a function that retuns nodes or
* text; or null for no label
* @chainable
/**
* Get the label.
*
- * @method
- * @returns {jQuery|string|Function|null} label Label nodes; text; a function that returns nodes or
+ * @return {jQuery|string|Function|null} label Label nodes; text; a function that returns nodes or
* text; or null for no label
*/
OO.ui.LabeledElement.prototype.getLabel = function () {
/**
* Fit the label.
*
- * @method
* @chainable
*/
OO.ui.LabeledElement.prototype.fitLabel = function () {
/**
* Popuppable element.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {Object} [config] Configuration options
/**
* Get popup.
*
- * @method
- * @returns {OO.ui.PopupWidget} Popup widget
+ * @return {OO.ui.PopupWidget} Popup widget
*/
OO.ui.PopuppableElement.prototype.getPopup = function () {
return this.popup;
/**
* Show popup.
- *
- * @method
*/
OO.ui.PopuppableElement.prototype.showPopup = function () {
this.popup.show().display( this.popupWidth, this.popupHeight );
/**
* Hide popup.
- *
- * @method
*/
OO.ui.PopuppableElement.prototype.hidePopup = function () {
this.popup.hide();
/**
* Element with a title.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {jQuery} $label Titled node, assigned to #$titled
/**
* Set title.
*
- * @method
* @param {string|Function|null} title Title text, a function that returns text or null for no title
* @chainable
*/
/**
* Get title.
*
- * @method
- * @returns {string} Title string
+ * @return {string} Title string
*/
OO.ui.TitledElement.prototype.getTitle = function () {
return this.title;
*
* @abstract
* @static
- * @property {string}
* @inheritable
+ * @property {string}
*/
OO.ui.Tool.static.name = '';
*
* @abstract
* @static
- * @property {string}
* @inheritable
+ * @property {string}
*/
OO.ui.Tool.static.group = '';
*
* @abstract
* @static
- * @property {string|Function} Title text or a function that returns text
* @inheritable
+ * @property {string|Function} Title text or a function that returns text
*/
OO.ui.Tool.static.title = '';
* Tool can be automatically added to catch-all groups.
*
* @static
- * @property {boolean}
* @inheritable
+ * @property {boolean}
*/
OO.ui.Tool.static.autoAddToCatchall = true;
* Check if this tool is compatible with given data.
*
* @static
- * @method
* @inheritable
* @param {Mixed} data Data to check
* @return {boolean} Tool can be used with data
* Show labels in tooltips.
*
* @static
- * @property {boolean}
* @inheritable
+ * @property {boolean}
*/
OO.ui.ToolGroup.static.titleTooltips = false;
* Show acceleration labels in tooltips.
*
* @static
- * @property {boolean}
* @inheritable
+ * @property {boolean}
*/
OO.ui.ToolGroup.static.accelTooltips = false;
* Automatically disable the toolgroup when all tools are disabled
*
* @static
- * @property {boolean}
* @inheritable
+ * @property {boolean}
*/
OO.ui.ToolGroup.static.autoDisable = true;
/**
* Get a default set of classes to be registered on construction
+ *
* @return {Function[]} Default classes
*/
OO.ui.ToolGroupFactory.static.getDefaultClasses = function () {
/**
* Handle label mouse click events.
*
- * @method
* @param {jQuery.Event} e Mouse click event
*/
OO.ui.FieldLayout.prototype.onLabelClick = function () {
/**
* Get the field.
*
- * @returns {OO.ui.Widget} Field widget
+ * @return {OO.ui.Widget} Field widget
*/
OO.ui.FieldLayout.prototype.getField = function () {
return this.field;
/**
* Set grid dimensions.
*
- * @method
* @param {number[]} widths Widths of columns as ratios
* @param {number[]} heights Heights of rows as ratios
* @fires layout
/**
* Update panel positions and sizes.
*
- * @method
* @fires update
*/
OO.ui.GridLayout.prototype.update = function () {
*
* The x and y position is affected by the current grid layout.
*
- * @method
* @param {number} x Horizontal position
* @param {number} y Vertical position
- * @returns {OO.ui.PanelLayout} The panel at the given postion
+ * @return {OO.ui.PanelLayout} The panel at the given postion
*/
OO.ui.GridLayout.prototype.getPanel = function ( x, y ) {
return this.panels[( x * this.widths.length ) + y];
/**
* Handle stack layout focus.
*
- * @method
* @param {jQuery.Event} e Focusin event
*/
OO.ui.BookletLayout.prototype.onStackLayoutFocus = function ( e ) {
/**
* Handle stack layout set events.
*
- * @method
* @param {OO.ui.PanelLayout|null} page The page panel that is now the current panel
*/
OO.ui.BookletLayout.prototype.onStackLayoutSet = function ( page ) {
/**
* Handle outline widget select events.
*
- * @method
* @param {OO.ui.OptionWidget|null} item Selected item
*/
OO.ui.BookletLayout.prototype.onOutlineWidgetSelect = function ( item ) {
/**
* Check if booklet has an outline.
*
- * @method
- * @returns {boolean} Booklet is outlined
+ * @return {boolean}
*/
OO.ui.BookletLayout.prototype.isOutlined = function () {
return this.outlined;
/**
* Check if booklet has editing controls.
*
- * @method
- * @returns {boolean} Booklet is outlined
+ * @return {boolean}
*/
OO.ui.BookletLayout.prototype.isEditable = function () {
return this.editable;
};
/**
- * Check if booklet has editing controls.
+ * Check if booklet has a visible outline.
*
- * @method
- * @returns {boolean} Booklet is outlined
+ * @return {boolean}
*/
OO.ui.BookletLayout.prototype.isOutlineVisible = function () {
return this.outlined && this.outlineVisible;
/**
* Get the outline widget.
*
- * @method
* @param {OO.ui.PageLayout} page Page to be selected
- * @returns {OO.ui.PageLayout|null} Closest page to another
+ * @return {OO.ui.PageLayout|null} Closest page to another
*/
OO.ui.BookletLayout.prototype.getClosestPage = function ( page ) {
var next, prev, level,
/**
* Get the outline widget.
*
- * @method
- * @returns {OO.ui.OutlineWidget|null} Outline widget, or null if boolet has no outline
+ * @return {OO.ui.OutlineWidget|null} Outline widget, or null if boolet has no outline
*/
OO.ui.BookletLayout.prototype.getOutline = function () {
return this.outlineWidget;
/**
* Get the outline controls widget. If the outline is not editable, null is returned.
*
- * @method
- * @returns {OO.ui.OutlineControlsWidget|null} The outline controls widget.
+ * @return {OO.ui.OutlineControlsWidget|null} The outline controls widget.
*/
OO.ui.BookletLayout.prototype.getOutlineControls = function () {
return this.outlineControlsWidget;
/**
* Get a page by name.
*
- * @method
* @param {string} name Symbolic name of page
- * @returns {OO.ui.PageLayout|undefined} Page, if found
+ * @return {OO.ui.PageLayout|undefined} Page, if found
*/
OO.ui.BookletLayout.prototype.getPage = function ( name ) {
return this.pages[name];
/**
* Get the current page name.
*
- * @method
- * @returns {string|null} Current page name
+ * @return {string|null} Current page name
*/
OO.ui.BookletLayout.prototype.getPageName = function () {
return this.currentPageName;
* When pages are added with the same names as existing pages, the existing pages will be
* automatically removed before the new pages are added.
*
- * @method
* @param {OO.ui.PageLayout[]} pages Pages to add
* @param {number} index Index to insert pages after
* @fires add
/**
* Remove a page from the layout.
*
- * @method
* @fires remove
* @chainable
*/
/**
* Clear all pages from the layout.
*
- * @method
* @fires remove
* @chainable
*/
/**
* Set the current page by name.
*
- * @method
* @fires set
* @param {string} name Symbolic name of page
*/
/**
* Call this after adding or removing items from the OutlineWidget.
*
- * @method
* @chainable
*/
OO.ui.BookletLayout.prototype.updateOutlineWidget = function () {
/**
* Get page name.
*
- * @returns {string} Symbolic name of page
+ * @return {string} Symbolic name of page
*/
OO.ui.PageLayout.prototype.getName = function () {
return this.name;
/**
* Check if page is active.
*
- * @returns {boolean} Page is active
+ * @return {boolean} Page is active
*/
OO.ui.PageLayout.prototype.isActive = function () {
return this.active;
/**
* Get outline item.
*
- * @returns {OO.ui.OutlineItemWidget|null} Outline item widget
+ * @return {OO.ui.OutlineItemWidget|null} Outline item widget
*/
OO.ui.PageLayout.prototype.getOutlineItem = function () {
return this.outlineItem;
*
* Adding an existing item (by value) will move it.
*
- * @method
* @param {OO.ui.PanelLayout[]} items Items to add
* @param {number} [index] Index to insert items after
* @chainable
*
* Items will be detached, not removed, so they can be used later.
*
- * @method
* @param {OO.ui.PanelLayout[]} items Items to remove
* @chainable
*/
*
* Items will be detached, not removed, so they can be used later.
*
- * @method
* @chainable
*/
OO.ui.StackLayout.prototype.clearItems = function () {
*
* Any currently shown item will be hidden.
*
- * @method
* @param {OO.ui.PanelLayout} item Item to show
* @chainable
*/
/**
* Horizontal bar layout of tools as icon buttons.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.ToolGroup
*
* @constructor
/**
* Popup list of tools with an icon and optional label.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.ToolGroup
* @mixins OO.ui.IconedElement
* @mixins OO.ui.IndicatedElement
*
* The event is actually generated from a mouseup, so it is not a normal blur event object.
*
- * @method
* @param {jQuery.Event} e Mouse up event
*/
OO.ui.PopupToolGroup.prototype.onBlur = function ( e ) {
/**
* Handle mouse up events.
*
- * @method
* @param {jQuery.Event} e Mouse up event
*/
OO.ui.PopupToolGroup.prototype.onHandleMouseUp = function () {
/**
* Handle mouse down events.
*
- * @method
* @param {jQuery.Event} e Mouse down event
*/
OO.ui.PopupToolGroup.prototype.onHandleMouseDown = function ( e ) {
* Switch into active mode.
*
* When active, mouseup events anywhere in the document will trigger deactivation.
- *
- * @method
*/
OO.ui.PopupToolGroup.prototype.setActive = function ( value ) {
value = !!value;
/**
* Drop down list layout of tools as labeled icon buttons.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.PopupToolGroup
*
* @constructor
/**
* Drop down menu layout of tools as selectable menu items.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.PopupToolGroup
*
* @constructor
*
* When the state changes, the title of each active item in the menu will be joined together and
* used as a label for the group. The label will be empty if none of the items are active.
- *
- * @method
*/
OO.ui.MenuToolGroup.prototype.onUpdateState = function () {
var name,
*
* Use together with OO.ui.ItemWidget to make disabled state inheritable.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.GroupElement
*
* @constructor
*
* This will also update the disabled state of child widgets.
*
- * @method
* @param {boolean} disabled Disable widget
* @chainable
*/
*
* Use together with OO.ui.GroupWidget to make disabled state inheritable.
*
- * @class
* @abstract
+ * @class
*
* @constructor
*/
*
* Checks parent if present, making disabled state inheritable.
*
- * @returns {boolean} Widget is disabled
+ * @return {boolean} Widget is disabled
*/
OO.ui.ItemWidget.prototype.isDisabled = function () {
return this.disabled ||
/**
* Button widget.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.Widget
* @mixins OO.ui.ButtonedElement
* @mixins OO.ui.IconedElement
/**
* Handles mouse click events.
*
- * @method
* @param {jQuery.Event} e Mouse click event
* @fires click
*/
/**
* Handles keypress events.
*
- * @method
* @param {jQuery.Event} e Keypress event
* @fires click
*/
/**
* Input widget.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.Widget
*
* @constructor
/**
* Get input element.
*
- * @method
* @param {Object} [config] Configuration options
- * @returns {jQuery} Input element
+ * @return {jQuery} Input element
*/
OO.ui.InputWidget.prototype.getInputElement = function () {
return this.$( '<input>' );
/**
* Handle potentially value-changing events.
*
- * @method
* @param {jQuery.Event} e Key down, mouse up, cut, paste, change, input, or select event
*/
OO.ui.InputWidget.prototype.onEdit = function () {
/**
* Get the value of the input.
*
- * @method
- * @returns {string} Input value
+ * @return {string} Input value
*/
OO.ui.InputWidget.prototype.getValue = function () {
return this.value;
/**
* Sets the direction of the current input, either RTL or LTR
*
- * @method
* @param {boolean} isRTL
*/
OO.ui.InputWidget.prototype.setRTL = function ( isRTL ) {
/**
* Set the value of the input.
*
- * @method
* @param {string} value New value
* @fires change
* @chainable
*
* Ensures value is a string, and converts undefined and null to empty strings.
*
- * @method
* @param {string} value Original value
- * @returns {string} Sanitized value
+ * @return {string} Sanitized value
*/
OO.ui.InputWidget.prototype.sanitizeValue = function ( value ) {
if ( value === undefined || value === null ) {
/**
* Simulate the behavior of clicking on a label bound to this input.
- *
- * @method
*/
OO.ui.InputWidget.prototype.simulateLabelClick = function () {
if ( !this.isDisabled() ) {
/**
* Check if the widget is read-only.
*
- * @method
- * @param {boolean} Input is read-only
+ * @return {boolean}
*/
OO.ui.InputWidget.prototype.isReadOnly = function () {
return this.readOnly;
*
* This should probably change the widgets's appearance and prevent it from being used.
*
- * @method
* @param {boolean} state Make input read-only
* @chainable
*/
/**
* Get input element.
*
- * @returns {jQuery} Input element
+ * @return {jQuery} Input element
*/
OO.ui.CheckboxInputWidget.prototype.getInputElement = function () {
return this.$( '<input type="checkbox" />' );
/**
* Get checked state of the checkbox
*
- * @returns {boolean} If the checkbox is checked
+ * @return {boolean} If the checkbox is checked
*/
OO.ui.CheckboxInputWidget.prototype.getValue = function () {
return this.value;
/**
* Handles label mouse click events.
*
- * @method
* @param {jQuery.Event} e Mouse click event
*/
OO.ui.LabelWidget.prototype.onClick = function () {
/**
* Handle input focus event.
*
- * @method
* @param {jQuery.Event} e Input focus event
*/
OO.ui.LookupInputWidget.prototype.onLookupInputFocus = function () {
/**
* Handle input blur event.
*
- * @method
* @param {jQuery.Event} e Input blur event
*/
OO.ui.LookupInputWidget.prototype.onLookupInputBlur = function () {
/**
* Handle input mouse down event.
*
- * @method
* @param {jQuery.Event} e Input mouse down event
*/
OO.ui.LookupInputWidget.prototype.onLookupInputMouseDown = function () {
/**
* Handle input change event.
*
- * @method
* @param {string} value New input value
*/
OO.ui.LookupInputWidget.prototype.onLookupInputChange = function () {
/**
* Open the menu.
*
- * @method
* @chainable
*/
OO.ui.LookupInputWidget.prototype.openLookupMenu = function () {
/**
* Populate lookup menu with current information.
*
- * @method
* @chainable
*/
OO.ui.LookupInputWidget.prototype.populateLookupMenu = function () {
/**
* Set selection in the lookup menu with current information.
*
- * @method
* @chainable
*/
OO.ui.LookupInputWidget.prototype.initializeLookupMenuSelection = function () {
/**
* Get lookup menu items for the current query.
*
- * @method
- * @returns {jQuery.Promise} Promise object which will be passed menu items as the first argument
+ * @return {jQuery.Promise} Promise object which will be passed menu items as the first argument
* of the done event
*/
OO.ui.LookupInputWidget.prototype.getLookupMenuItems = function () {
/**
* Get a new request object of the current lookup query value.
*
- * @method
* @abstract
- * @returns {jqXHR} jQuery AJAX object, or promise object with an .abort() method
+ * @return {jqXHR} jQuery AJAX object, or promise object with an .abort() method
*/
OO.ui.LookupInputWidget.prototype.getLookupRequest = function () {
// Stub, implemented in subclass
* Overriding methods should call #populateLookupMenu when results are available and cache results
* for future lookups in #lookupCache as an array of #OO.ui.MenuItemWidget objects.
*
- * @method
* @abstract
* @param {Mixed} data Response from server
*/
/**
* Get a list of menu item widgets from the data stored by the lookup request's done handler.
*
- * @method
* @abstract
* @param {Mixed} data Cached result data, usually an array
- * @returns {OO.ui.MenuItemWidget[]} Menu items
+ * @return {OO.ui.MenuItemWidget[]} Menu items
*/
OO.ui.LookupInputWidget.prototype.getLookupMenuItemsFromData = function () {
// Stub, implemented in subclass
*
* Use with OO.ui.SelectWidget.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.Widget
* @mixins OO.ui.IconedElement
* @mixins OO.ui.LabeledElement
/**
* Check if option can be selected.
*
- * @method
- * @returns {boolean} Item is selectable
+ * @return {boolean} Item is selectable
*/
OO.ui.OptionWidget.prototype.isSelectable = function () {
return this.constructor.static.selectable && !this.disabled;
/**
* Check if option can be highlighted.
*
- * @method
- * @returns {boolean} Item is highlightable
+ * @return {boolean} Item is highlightable
*/
OO.ui.OptionWidget.prototype.isHighlightable = function () {
return this.constructor.static.highlightable && !this.disabled;
/**
* Check if option can be pressed.
*
- * @method
- * @returns {boolean} Item is pressable
+ * @return {boolean} Item is pressable
*/
OO.ui.OptionWidget.prototype.isPressable = function () {
return this.constructor.static.pressable && !this.disabled;
/**
* Check if option is selected.
*
- * @method
- * @returns {boolean} Item is selected
+ * @return {boolean} Item is selected
*/
OO.ui.OptionWidget.prototype.isSelected = function () {
return this.selected;
/**
* Check if option is highlighted.
*
- * @method
- * @returns {boolean} Item is highlighted
+ * @return {boolean} Item is highlighted
*/
OO.ui.OptionWidget.prototype.isHighlighted = function () {
return this.highlighted;
/**
* Check if option is pressed.
*
- * @method
- * @returns {boolean} Item is pressed
+ * @return {boolean} Item is pressed
*/
OO.ui.OptionWidget.prototype.isPressed = function () {
return this.pressed;
/**
* Set selected state.
*
- * @method
* @param {boolean} [state=false] Select option
* @chainable
*/
/**
* Set highlighted state.
*
- * @method
* @param {boolean} [state=false] Highlight option
* @chainable
*/
/**
* Set pressed state.
*
- * @method
* @param {boolean} [state=false] Press option
* @chainable
*/
*
* While flashing, the visual style of the pressed state is removed if present.
*
- * @method
* @param {Function} [done] Callback to execute when flash effect is complete.
*/
OO.ui.OptionWidget.prototype.flash = function ( done ) {
/**
* Get option data.
*
- * @method
- * @returns {Mixed} Option data
+ * @return {Mixed} Option data
*/
OO.ui.OptionWidget.prototype.getData = function () {
return this.data;
*
* Use together with OO.ui.OptionWidget.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.Widget
* @mixins OO.ui.GroupElement
*
/**
* Handle mouse down events.
*
- * @method
* @private
* @param {jQuery.Event} e Mouse down event
*/
/**
* Handle mouse up events.
*
- * @method
* @private
* @param {jQuery.Event} e Mouse up event
*/
/**
* Handle mouse move events.
*
- * @method
* @private
* @param {jQuery.Event} e Mouse move event
*/
/**
* Handle mouse over events.
*
- * @method
* @private
* @param {jQuery.Event} e Mouse over event
*/
/**
* Handle mouse leave events.
*
- * @method
* @private
* @param {jQuery.Event} e Mouse over event
*/
/**
* Get the closest item to a jQuery.Event.
*
- * @method
* @private
* @param {jQuery.Event} e
- * @returns {OO.ui.OptionWidget|null} Outline item widget, `null` if none was found
+ * @return {OO.ui.OptionWidget|null} Outline item widget, `null` if none was found
*/
OO.ui.SelectWidget.prototype.getTargetItem = function ( e ) {
var $item = this.$( e.target ).closest( '.oo-ui-optionWidget' );
/**
* Get selected item.
*
- * @method
- * @returns {OO.ui.OptionWidget|null} Selected item, `null` if no item is selected
+ * @return {OO.ui.OptionWidget|null} Selected item, `null` if no item is selected
*/
OO.ui.SelectWidget.prototype.getSelectedItem = function () {
var i, len;
/**
* Get highlighted item.
*
- * @method
- * @returns {OO.ui.OptionWidget|null} Highlighted item, `null` if no item is highlighted
+ * @return {OO.ui.OptionWidget|null} Highlighted item, `null` if no item is highlighted
*/
OO.ui.SelectWidget.prototype.getHighlightedItem = function () {
var i, len;
/**
* Get an existing item with equivilant data.
*
- * @method
* @param {Object} data Item data to search for
- * @returns {OO.ui.OptionWidget|null} Item with equivilent value, `null` if none exists
+ * @return {OO.ui.OptionWidget|null} Item with equivilent value, `null` if none exists
*/
OO.ui.SelectWidget.prototype.getItemFromData = function ( data ) {
var hash = OO.getHash( data );
*
* Highlighting is mutually exclusive.
*
- * @method
* @param {OO.ui.OptionWidget} [item] Item to highlight, omit to deselect all
* @fires highlight
* @chainable
/**
* Select an item.
*
- * @method
* @param {OO.ui.OptionWidget} [item] Item to select, omit to deselect all
* @fires select
* @chainable
/**
* Press an item.
*
- * @method
* @param {OO.ui.OptionWidget} [item] Item to press, omit to depress all
* @fires press
* @chainable
* Identical to #selectItem, but may vary in subclasses that want to take additional action when
* an item is selected using the keyboard or mouse.
*
- * @method
* @param {OO.ui.OptionWidget} item Item to choose
* @fires choose
* @chainable
/**
* Get an item relative to another one.
*
- * @method
* @param {OO.ui.OptionWidget} item Item to start at
* @param {number} direction Direction to move in
- * @returns {OO.ui.OptionWidget|null} Item at position, `null` if there are no items in the menu
+ * @return {OO.ui.OptionWidget|null} Item at position, `null` if there are no items in the menu
*/
OO.ui.SelectWidget.prototype.getRelativeSelectableItem = function ( item, direction ) {
var inc = direction > 0 ? 1 : -1,
/**
* Get the next selectable item.
*
- * @method
- * @returns {OO.ui.OptionWidget|null} Item, `null` if ther aren't any selectable items
+ * @return {OO.ui.OptionWidget|null} Item, `null` if ther aren't any selectable items
*/
OO.ui.SelectWidget.prototype.getFirstSelectableItem = function () {
var i, len, item;
* When items are added with the same values as existing items, the existing items will be
* automatically removed before the new items are added.
*
- * @method
* @param {OO.ui.OptionWidget[]} items Items to add
* @param {number} [index] Index to insert items after
* @fires add
*
* Items will be detached, not removed, so they can be used later.
*
- * @method
* @param {OO.ui.OptionWidget[]} items Items to remove
* @fires remove
* @chainable
*
* Items will be detached, not removed, so they can be used later.
*
- * @method
* @fires remove
* @chainable
*/
/**
* Handles key down events.
*
- * @method
* @param {jQuery.Event} e Key down event
*/
OO.ui.MenuWidget.prototype.onKeyDown = function ( e ) {
/**
* Check if the menu is visible.
*
- * @method
- * @returns {boolean} Menu is visible
+ * @return {boolean} Menu is visible
*/
OO.ui.MenuWidget.prototype.isVisible = function () {
return this.visible;
};
/**
- * Bind key down listener
- *
- * @method
+ * Bind key down listener.
*/
OO.ui.MenuWidget.prototype.bindKeyDownListener = function () {
if ( this.$input ) {
};
/**
- * Unbind key down listener
- *
- * @method
+ * Unbind key down listener.
*/
OO.ui.MenuWidget.prototype.unbindKeyDownListener = function () {
if ( this.$input ) {
*
* This will close the menu when done, unlike selectItem which only changes selection.
*
- * @method
* @param {OO.ui.OptionWidget} item Item to choose
* @chainable
*/
*
* Adding an existing item (by value) will move it.
*
- * @method
* @param {OO.ui.MenuItemWidget[]} items Items to add
* @param {number} [index] Index to insert items after
* @chainable
/**
* Show the menu.
*
- * @method
* @chainable
*/
OO.ui.MenuWidget.prototype.show = function () {
/**
* Hide the menu.
*
- * @method
* @chainable
*/
OO.ui.MenuWidget.prototype.hide = function () {
/**
* Handles menu select events.
*
- * @method
* @param {OO.ui.MenuItemWidget} item Selected menu item
*/
OO.ui.InlineMenuWidget.prototype.onMenuSelect = function ( item ) {
/**
* Handles mouse click events.
*
- * @method
* @param {jQuery.Event} e Mouse click event
*/
OO.ui.InlineMenuWidget.prototype.onClick = function ( e ) {
/**
* Handle outline change events.
- *
- * @method
*/
OO.ui.OutlineControlsWidget.prototype.onOutlineChange = function () {
var i, len, firstMovable, lastMovable,
*
* Movablilty is used by outline controls.
*
- * @returns {boolean} Item is movable
+ * @return {boolean} Item is movable
*/
OO.ui.OutlineItemWidget.prototype.isMovable = function () {
return this.movable;
*
* Removablilty is used by outline controls.
*
- * @returns {boolean} Item is removable
+ * @return {boolean} Item is removable
*/
OO.ui.OutlineItemWidget.prototype.isRemovable = function () {
return this.removable;
/**
* Get indentation level.
*
- * @returns {number} Indentation level
+ * @return {number} Indentation level
*/
OO.ui.OutlineItemWidget.prototype.getLevel = function () {
return this.level;
/**
* Set indentation level.
*
- * @method
* @param {number} [level=0] Indentation level, in the range of [0,#maxLevel]
* @chainable
*/
/**
* Handles mouse down events.
*
- * @method
* @param {jQuery.Event} e Mouse down event
*/
OO.ui.PopupWidget.prototype.onMouseDown = function ( e ) {
};
/**
- * Bind mouse down listener
- *
- * @method
+ * Bind mouse down listener.
*/
OO.ui.PopupWidget.prototype.bindMouseDownListener = function () {
// Capture clicks outside popup
/**
* Handles close button click events.
- *
- * @method
*/
OO.ui.PopupWidget.prototype.onCloseButtonClick = function () {
if ( this.visible ) {
};
/**
- * Unbind mouse down listener
- *
- * @method
+ * Unbind mouse down listener.
*/
OO.ui.PopupWidget.prototype.unbindMouseDownListener = function () {
this.getElementWindow().removeEventListener( 'mousedown', this.onMouseDownHandler, true );
/**
* Check if the popup is visible.
*
- * @method
- * @returns {boolean} Popup is visible
+ * @return {boolean} Popup is visible
*/
OO.ui.PopupWidget.prototype.isVisible = function () {
return this.visible;
/**
* Set whether to show a tail.
*
- * @method
- * @returns {boolean} Make tail visible
+ * @return {boolean} Make tail visible
*/
OO.ui.PopupWidget.prototype.useTail = function ( value ) {
value = !!value;
/**
* Check if showing a tail.
*
- * @method
- * @returns {boolean} tail is visible
+ * @return {boolean} tail is visible
*/
OO.ui.PopupWidget.prototype.hasTail = function () {
return this.tail;
/**
* Show the context.
*
- * @method
* @fires show
* @chainable
*/
/**
* Hide the context.
*
- * @method
* @fires hide
* @chainable
*/
/**
* Updates the position and size.
*
- * @method
* @param {number} width Width
* @param {number} height Height
* @param {boolean} [transition=false] Use a smooth transition
/**
* Handles mouse click events.
*
- * @method
* @param {jQuery.Event} e Mouse click event
*/
OO.ui.PopupButtonWidget.prototype.onClick = function ( e ) {
/**
* Handle query key down events.
*
- * @method
* @param {jQuery.Event} e Key down event
*/
OO.ui.SearchWidget.prototype.onQueryKeydown = function ( e ) {
*
* Clears existing results. Subclasses should repopulate items according to new query.
*
- * @method
* @param {string} value New value
*/
OO.ui.SearchWidget.prototype.onQueryChange = function () {
*
* Selects highlighted item.
*
- * @method
* @param {string} value New value
*/
OO.ui.SearchWidget.prototype.onQueryEnter = function () {
/**
* Handle select widget highlight events.
*
- * @method
* @param {OO.ui.OptionWidget} item Highlighted item
* @fires highlight
*/
/**
* Handle select widget select events.
*
- * @method
* @param {OO.ui.OptionWidget} item Selected item
* @fires select
*/
/**
* Get the query input.
*
- * @method
- * @returns {OO.ui.TextInputWidget} Query input
+ * @return {OO.ui.TextInputWidget} Query input
*/
OO.ui.SearchWidget.prototype.getQuery = function () {
return this.query;
/**
* Get the results list.
*
- * @method
- * @returns {OO.ui.SelectWidget} Select list
+ * @return {OO.ui.SelectWidget} Select list
*/
OO.ui.SearchWidget.prototype.getResults = function () {
return this.results;
/* Methods */
/**
- * Handles key press events.
+ * Handle key press events.
*
* @param {jQuery.Event} e Key press event
* @fires enter If enter key is pressed and input is not multiline
};
/**
- * Handles element attach events.
+ * Handle element attach events.
*
* @param {jQuery.Event} e Element attach event
*/
/**
* Get input element.
*
- * @method
* @param {Object} [config] Configuration options
- * @returns {jQuery} Input element
+ * @return {jQuery} Input element
*/
OO.ui.TextInputWidget.prototype.getInputElement = function ( config ) {
return config.multiline ? this.$( '<textarea>' ) : this.$( '<input type="text" />' );
/* Methods */
/**
- * Checks if input supports multiple lines.
+ * Check if input supports multiple lines.
*
- * @method
- * @returns {boolean} Input supports multiple lines
+ * @return {boolean}
*/
OO.ui.TextInputWidget.prototype.isMultiline = function () {
return !!this.multiline;
};
/**
- * Checks if input automatically adjusts its size.
+ * Check if input automatically adjusts its size.
*
- * @method
- * @returns {boolean} Input automatically adjusts its size
+ * @return {boolean}
*/
OO.ui.TextInputWidget.prototype.isAutosizing = function () {
return !!this.autosize;
};
/**
- * Checks if input is pending.
+ * Check if input is pending.
*
- * @method
- * @returns {boolean} Input is pending
+ * @return {boolean}
*/
OO.ui.TextInputWidget.prototype.isPending = function () {
return !!this.pending;
};
/**
- * Increases the pending stack.
+ * Increase the pending stack.
*
- * @method
* @chainable
*/
OO.ui.TextInputWidget.prototype.pushPending = function () {
};
/**
- * Reduces the pending stack.
+ * Reduce the pending stack.
*
* Clamped at zero.
*
- * @method
* @chainable
*/
OO.ui.TextInputWidget.prototype.popPending = function () {
/**
* Handle window resize event.
*
- * @method
* @param {jQuery.Event} e Window resize event
*/
OO.ui.TextInputMenuWidget.prototype.onWindowResize = function () {
};
/**
- * Shows the menu.
+ * Show the menu.
*
- * @method
* @chainable
*/
OO.ui.TextInputMenuWidget.prototype.show = function () {
};
/**
- * Hides the menu.
+ * Hide the menu.
*
- * @method
* @chainable
*/
OO.ui.TextInputMenuWidget.prototype.hide = function () {
};
/**
- * Positions the menu.
+ * Position the menu.
*
- * @method
* @chainable
*/
OO.ui.TextInputMenuWidget.prototype.position = function () {
*
* Mixin for widgets with a boolean state.
*
- * @class
* @abstract
+ * @class
*
* @constructor
* @param {Object} [config] Configuration options
/**
* Get the value of the toggle.
*
- * @method
- * @returns {boolean} Toggle value
+ * @return {boolean}
*/
OO.ui.ToggleWidget.prototype.getValue = function () {
return this.value;
/**
* Set the value of the toggle.
*
- * @method
* @param {boolean} value New value
* @fires change
* @chainable
/**
* Switch that slides on and off.
*
- * @class
* @abstract
+ * @class
* @extends OO.ui.Widget
* @mixins OO.ui.ToggleWidget
*
/* Methods */
/**
- * Handles mouse down events.
+ * Handle mouse down events.
*
- * @method
* @param {jQuery.Event} e Mouse down event
*/
OO.ui.ToggleSwitchWidget.prototype.onClick = function ( e ) {