Page MenuHomeWickedGov Phorge

HighlightPopupWidget.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

HighlightPopupWidget.js

const HighlightColorPickerWidget = require( './HighlightColorPickerWidget.js' );
/**
* A popup containing a color picker, for setting highlight colors.
*
* @class mw.rcfilters.ui.HighlightPopupWidget
* @ignore
* @extends OO.ui.PopupWidget
*
* @param {mw.rcfilters.Controller} controller RCFilters controller
* @param {Object} [config] Configuration object
*/
const HighlightPopupWidget = function MwRcfiltersUiHighlightPopupWidget( controller, config ) {
config = config || {};
// Parent
HighlightPopupWidget.super.call( this, Object.assign( {
autoClose: true,
anchor: false,
padded: true,
align: 'backwards',
horizontalPosition: 'end',
width: 290
}, config ) );
this.colorPicker = new HighlightColorPickerWidget( controller );
this.colorPicker.connect( this, { chooseColor: 'onChooseColor' } );
this.$body.append( this.colorPicker.$element );
};
/* Initialization */
OO.inheritClass( HighlightPopupWidget, OO.ui.PopupWidget );
/* Methods */
/**
* Set the button (or other widget) that this popup should hang off.
*
* @param {OO.ui.Widget} widget Widget the popup should orient itself to
*/
HighlightPopupWidget.prototype.setAssociatedButton = function ( widget ) {
this.setFloatableContainer( widget.$element );
this.$autoCloseIgnore = widget.$element;
};
/**
* Set the filter item that this popup should control the highlight color for.
*
* @param {mw.rcfilters.dm.FilterItem} item
*/
HighlightPopupWidget.prototype.setFilterItem = function ( item ) {
this.colorPicker.setFilterItem( item );
};
/**
* When the user chooses a color in the color picker, close the popup.
*/
HighlightPopupWidget.prototype.onChooseColor = function () {
this.toggle( false );
};
module.exports = HighlightPopupWidget;

File Metadata

Mime Type
text/plain
Expires
Wed, Aug 19, 04:11 (4 d, 19 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
27/b8/9d329e1c74c9d170c8a92cfbece6
Default Alt Text
HighlightPopupWidget.js (1 KB)

Event Timeline