this.controller = controller;
this.model = model;
+ this.selected = false;
this.checkboxWidget = new mw.rcfilters.ui.CheckboxInputWidget( {
value: this.model.getName(),
this.controller,
this.model,
{
- $overlay: config.$overlay || this.$element
+ $overlay: config.$overlay || this.$element,
+ title: mw.msg( 'rcfilters-highlightmenu-help' )
}
);
this.highlightButton.toggle( this.model.isHighlightEnabled() );
* @param {boolean} isSelected The checkbox is selected
*/
mw.rcfilters.ui.FilterItemWidget.prototype.onCheckboxChange = function ( isSelected ) {
- this.controller.updateFilter( this.model.getName(), isSelected );
+ this.controller.toggleFilterSelect( this.model.getName(), isSelected );
};
/**
this.setCurrentMuteState();
};
+ /**
+ * Set selected state on this widget
+ *
+ * @param {boolean} [isSelected] Widget is selected
+ */
+ mw.rcfilters.ui.FilterItemWidget.prototype.toggleSelected = function ( isSelected ) {
+ isSelected = isSelected !== undefined ? isSelected : !this.selected;
+
+ if ( this.selected !== isSelected ) {
+ this.selected = isSelected;
+
+ this.$element.toggleClass( 'mw-rcfilters-ui-filterItemWidget-selected', this.selected );
+ }
+ };
+
/**
* Set the current mute state for this item
*/
'mw-rcfilters-ui-filterItemWidget-muted',
this.model.isConflicted() ||
this.model.isIncluded() ||
- this.model.isFullyCovered() ||
(
// Item is also muted when any of the items in its group is active
this.model.getGroupModel().isActive() &&