mediawiki-extensions-Visual.../modules/oojs-ui/elements/OO.ui.PopuppableElement.js
Roan Kattouw 2ea9437e32 Get rid of OO.ui.extendObject and OO.ui.indexOf
Replaced uses of extendObject with $.extend . Replaced the one use of
OO.ui.indexOf with Array.prototype.indexOf because that's what
everything else was already using.

Change-Id: I63f40989057b8065ec977efafbf68d6e22c8e679
2013-10-31 15:09:44 -07:00

63 lines
1.3 KiB
JavaScript

/*!
* ObjectOriented UserInterface PopuppableElement class.
*
* @copyright 2011-2013 OOJS Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Popuppable element.
*
* @class
* @abstract
*
* @constructor
* @param {Object} [config] Configuration options
* @cfg {number} [popupWidth=320] Width of popup
* @cfg {number} [popupHeight] Height of popup
* @cfg {Object} [popup] Configuration to pass to popup
*/
OO.ui.PopuppableElement = function OoUiPopuppableElement( config ) {
// Configuration initialization
config = $.extend( { 'popupWidth': 320 }, config );
// Properties
this.popup = new OO.ui.PopupWidget( $.extend(
{ 'align': 'center', 'autoClose': true },
config.popup,
{ '$$': this.$$, '$autoCloseIgnore': this.$ }
) );
this.popupWidth = config.popupWidth;
this.popupHeight = config.popupHeight;
};
/* Methods */
/**
* Get popup.
*
* @method
* @returns {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();
};