3 * View model for the filters selection and display
5 * @mixins OO.EventEmitter
6 * @mixins OO.EmitterList
10 mw
.rcfilters
.dm
.FiltersViewModel
= function MwRcfiltersDmFiltersViewModel() {
12 OO
.EventEmitter
.call( this );
13 OO
.EmitterList
.call( this );
16 this.defaultParams
= {};
17 this.defaultFiltersEmpty
= null;
18 this.highlightEnabled
= false;
19 this.parameterMap
= {};
22 this.aggregate( { update
: 'filterItemUpdate' } );
23 this.connect( this, { filterItemUpdate
: [ 'emit', 'itemUpdate' ] } );
27 OO
.initClass( mw
.rcfilters
.dm
.FiltersViewModel
);
28 OO
.mixinClass( mw
.rcfilters
.dm
.FiltersViewModel
, OO
.EventEmitter
);
29 OO
.mixinClass( mw
.rcfilters
.dm
.FiltersViewModel
, OO
.EmitterList
);
36 * Filter list is initialized
41 * @param {mw.rcfilters.dm.FilterItem} item Filter item updated
43 * Filter item has changed
47 * @event highlightChange
48 * @param {boolean} Highlight feature is enabled
50 * Highlight feature has been toggled enabled or disabled
56 * Re-assess the states of filter items based on the interactions between them
58 * @param {mw.rcfilters.dm.FilterItem} [item] Changed item. If not given, the
59 * method will go over the state of all items
61 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.reassessFilterInteractions = function ( item
) {
64 iterationItems
= item
!== undefined ? [ item
] : this.getItems();
66 iterationItems
.forEach( function ( checkedItem
) {
67 var allCheckedItems
= checkedItem
.getSubset().concat( [ checkedItem
.getName() ] ),
68 groupModel
= checkedItem
.getGroupModel();
70 // Check for subsets (included filters) plus the item itself:
71 allCheckedItems
.forEach( function ( filterItemName
) {
72 var itemInSubset
= model
.getItemByName( filterItemName
);
74 itemInSubset
.toggleIncluded(
75 // If any of itemInSubset's supersets are selected, this item
77 itemInSubset
.getSuperset().some( function ( supersetName
) {
78 return ( model
.getItemByName( supersetName
).isSelected() );
83 // Update coverage for the changed group
84 if ( groupModel
.isFullCoverage() ) {
85 allSelected
= groupModel
.areAllSelected();
86 groupModel
.getItems().forEach( function ( filterItem
) {
87 filterItem
.toggleFullyCovered( allSelected
);
92 // Check for conflicts
93 // In this case, we must go over all items, since
94 // conflicts are bidirectional and depend not only on
95 // individual items, but also on the selected states of
96 // the groups they're in.
97 this.getItems().forEach( function ( filterItem
) {
98 var inConflict
= false,
99 filterItemGroup
= filterItem
.getGroupModel();
101 // For each item, see if that item is still conflicting
102 $.each( model
.groups
, function ( groupName
, groupModel
) {
103 if ( filterItem
.getGroupName() === groupName
) {
104 // Check inside the group
105 inConflict
= groupModel
.areAnySelectedInConflictWith( filterItem
);
107 // According to the spec, if two items conflict from two different
108 // groups, the conflict only lasts if the groups **only have selected
109 // items that are conflicting**. If a group has selected items that
110 // are conflicting and non-conflicting, the scope of the result has
111 // expanded enough to completely remove the conflict.
113 // For example, see two groups with conflicts:
116 // name: 'experienced',
117 // conflicts: [ 'unregistered' ]
122 // name: 'registered',
125 // name: 'unregistered',
128 // If we select 'experienced', then 'unregistered' is in conflict (and vice versa),
129 // because, inherently, 'experienced' filter only includes registered users, and so
130 // both filters are in conflict with one another.
131 // However, the minute we select 'registered', the scope of our results
132 // has expanded to no longer have a conflict with 'experienced' filter, and
133 // so the conflict is removed.
135 // In our case, we need to check if the entire group conflicts with
136 // the entire item's group, so we follow the above spec
138 // The foreign group is in conflict with this item
139 groupModel
.areAllSelectedInConflictWith( filterItem
) &&
140 // Every selected member of the item's own group is also
141 // in conflict with the other group
142 filterItemGroup
.getSelectedItems().every( function ( otherGroupItem
) {
143 return groupModel
.areAllSelectedInConflictWith( otherGroupItem
);
148 // If we're in conflict, this will return 'false' which
149 // will break the loop. Otherwise, we're not in conflict
150 // and the loop continues
154 // Toggle the item state
155 filterItem
.toggleConflicted( inConflict
);
160 * Get whether the model has any conflict in its items
162 * @return {boolean} There is a conflict
164 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.hasConflict = function () {
165 return this.getItems().some( function ( filterItem
) {
166 return filterItem
.isSelected() && filterItem
.isConflicted();
171 * Get the first item with a current conflict
173 * @return {mw.rcfilters.dm.FilterItem} Conflicted item
175 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getFirstConflictedItem = function () {
178 $.each( this.getItems(), function ( index
, filterItem
) {
179 if ( filterItem
.isSelected() && filterItem
.isConflicted() ) {
180 conflictedItem
= filterItem
;
185 return conflictedItem
;
189 * Set filters and preserve a group relationship based on
190 * the definition given by an object
192 * @param {Array} filters Filter group definition
194 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.initializeFilters = function ( filters
) {
195 var i
, filterItem
, selectedFilterNames
, filterConflictResult
, groupConflictResult
, subsetNames
,
199 groupConflictMap
= {},
200 filterConflictMap
= {},
201 addArrayElementsUnique = function ( arr
, elements
) {
202 elements
= Array
.isArray( elements
) ? elements
: [ elements
];
204 elements
.forEach( function ( element
) {
205 if ( arr
.indexOf( element
) === -1 ) {
212 expandConflictDefinitions = function ( obj
) {
215 $.each( obj
, function ( key
, conflicts
) {
217 adjustedConflicts
= {};
219 conflicts
.forEach( function ( conflict
) {
222 if ( conflict
.filter
) {
223 filterName
= model
.groups
[ conflict
.group
].getNamePrefix() + conflict
.filter
;
224 filter
= model
.getItemByName( filterName
);
227 adjustedConflicts
[ filterName
] = $.extend(
236 // This conflict is for an entire group. Split it up to
237 // represent each filter
239 // Get the relevant group items
240 model
.groups
[ conflict
.group
].getItems().forEach( function ( groupItem
) {
241 // Rebuild the conflict
242 adjustedConflicts
[ groupItem
.getName() ] = $.extend(
246 filter
: groupItem
.getName(),
254 result
[ key
] = adjustedConflicts
;
264 filters
.forEach( function ( data
) {
265 var group
= data
.name
;
267 if ( !model
.groups
[ group
] ) {
268 model
.groups
[ group
] = new mw
.rcfilters
.dm
.FilterGroup( group
, {
270 title
: mw
.msg( data
.title
),
271 separator
: data
.separator
,
272 fullCoverage
: !!data
.fullCoverage
,
274 body
: data
.whatsThisBody
,
275 header
: data
.whatsThisHeader
,
276 linkText
: data
.whatsThisLinkText
,
277 url
: data
.whatsThisUrl
282 if ( data
.conflicts
) {
283 groupConflictMap
[ group
] = data
.conflicts
;
286 selectedFilterNames
= [];
287 for ( i
= 0; i
< data
.filters
.length
; i
++ ) {
288 data
.filters
[ i
].subset
= data
.filters
[ i
].subset
|| [];
289 data
.filters
[ i
].subset
= data
.filters
[ i
].subset
.map( function ( el
) {
293 filterItem
= new mw
.rcfilters
.dm
.FilterItem( data
.filters
[ i
].name
, model
.groups
[ group
], {
295 label
: mw
.msg( data
.filters
[ i
].label
),
296 description
: mw
.msg( data
.filters
[ i
].description
),
297 cssClass
: data
.filters
[ i
].cssClass
300 if ( data
.filters
[ i
].subset
) {
302 data
.filters
[ i
].subset
.forEach( function ( subsetFilterName
) { // eslint-disable-line no-loop-func
303 var subsetName
= model
.groups
[ group
].getNamePrefix() + subsetFilterName
;
304 // For convenience, we should store each filter's "supersets" -- these are
305 // the filters that have that item in their subset list. This will just
306 // make it easier to go through whether the item has any other items
307 // that affect it (and are selected) at any given time
308 supersetMap
[ subsetName
] = supersetMap
[ subsetName
] || [];
309 addArrayElementsUnique(
310 supersetMap
[ subsetName
],
314 // Translate subset param name to add the group name, so we
315 // get consistent naming. We know that subsets are only within
317 subsetNames
.push( subsetName
);
320 // Set translated subset
321 filterItem
.setSubset( subsetNames
);
325 if ( data
.filters
[ i
].conflicts
) {
326 filterConflictMap
[ filterItem
.getName() ] = data
.filters
[ i
].conflicts
;
329 if ( data
.type
=== 'send_unselected_if_any' ) {
330 // Store the default parameter state
331 // For this group type, parameter values are direct
332 model
.defaultParams
[ data
.filters
[ i
].name
] = Number( !!data
.filters
[ i
].default );
334 data
.type
=== 'string_options' &&
335 data
.filters
[ i
].default
337 selectedFilterNames
.push( data
.filters
[ i
].name
);
340 model
.groups
[ group
].addItems( filterItem
);
341 items
.push( filterItem
);
344 if ( data
.type
=== 'string_options' ) {
345 // Store the default parameter group state
346 // For this group, the parameter is group name and value is the names
348 model
.defaultParams
[ group
] = model
.sanitizeStringOptionGroup( group
, selectedFilterNames
).join( model
.groups
[ group
].getSeparator() );
352 // Add items to the model
353 this.addItems( items
);
356 groupConflictResult
= expandConflictDefinitions( groupConflictMap
);
357 filterConflictResult
= expandConflictDefinitions( filterConflictMap
);
359 // Set conflicts for groups
360 $.each( groupConflictResult
, function ( group
, conflicts
) {
361 model
.groups
[ group
].setConflicts( conflicts
);
364 items
.forEach( function ( filterItem
) {
365 // Apply the superset map
366 filterItem
.setSuperset( supersetMap
[ filterItem
.getName() ] );
368 // set conflicts for item
369 if ( filterConflictResult
[ filterItem
.getName() ] ) {
370 filterItem
.setConflicts( filterConflictResult
[ filterItem
.getName() ] );
374 // Create a map between known parameters and their models
375 $.each( this.groups
, function ( group
, groupModel
) {
376 if ( groupModel
.getType() === 'send_unselected_if_any' ) {
377 // Individual filters
378 groupModel
.getItems().forEach( function ( filterItem
) {
379 model
.parameterMap
[ filterItem
.getParamName() ] = filterItem
;
381 } else if ( groupModel
.getType() === 'string_options' ) {
383 model
.parameterMap
[ groupModel
.getName() ] = groupModel
;
387 this.emit( 'initialize' );
391 * Get the names of all available filters
393 * @return {string[]} An array of filter names
395 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getFilterNames = function () {
396 return this.getItems().map( function ( item
) { return item
.getName(); } );
400 * Get the object that defines groups by their name.
402 * @return {Object} Filter groups
404 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getFilterGroups = function () {
409 * Get the value of a specific parameter
411 * @param {string} name Parameter name
412 * @return {number|string} Parameter value
414 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getParamValue = function ( name
) {
415 return this.parameters
[ name
];
419 * Get the current selected state of the filters
421 * @return {Object} Filters selected state
423 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getSelectedState = function () {
425 items
= this.getItems(),
428 for ( i
= 0; i
< items
.length
; i
++ ) {
429 result
[ items
[ i
].getName() ] = items
[ i
].isSelected();
436 * Get the current full state of the filters
438 * @return {Object} Filters full state
440 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getFullState = function () {
442 items
= this.getItems(),
445 for ( i
= 0; i
< items
.length
; i
++ ) {
446 result
[ items
[ i
].getName() ] = {
447 selected
: items
[ i
].isSelected(),
448 conflicted
: items
[ i
].isConflicted(),
449 included
: items
[ i
].isIncluded()
457 * Get the default parameters object
459 * @return {Object} Default parameter values
461 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getDefaultParams = function () {
462 return this.defaultParams
;
466 * Set all filter states to default values
468 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.setFiltersToDefaults = function () {
469 var defaultFilterStates
= this.getFiltersFromParameters( this.getDefaultParams() );
471 this.toggleFiltersSelected( defaultFilterStates
);
475 * Analyze the groups and their filters and output an object representing
476 * the state of the parameters they represent.
478 * @param {Object} [filterGroups] An object defining the filter groups to
479 * translate to parameters. Its structure must follow that of this.groups
480 * see #getFilterGroups
481 * @return {Object} Parameter state object
483 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getParametersFromFilters = function ( filterGroups
) {
485 groupItems
= filterGroups
|| this.getFilterGroups();
487 $.each( groupItems
, function ( group
, model
) {
488 $.extend( result
, model
.getParamRepresentation() );
495 * Get the highlight parameters based on current filter configuration
497 * @return {object} Object where keys are "<filter name>_color" and values
498 * are the selected highlight colors.
500 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getHighlightParameters = function () {
501 var result
= { highlight
: Number( this.isHighlightEnabled() ) };
503 this.getItems().forEach( function ( filterItem
) {
504 result
[ filterItem
.getName() + '_color' ] = filterItem
.getHighlightColor();
510 * Sanitize value group of a string_option groups type
511 * Remove duplicates and make sure to only use valid
515 * @param {string} groupName Group name
516 * @param {string[]} valueArray Array of values
517 * @return {string[]} Array of valid values
519 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.sanitizeStringOptionGroup = function( groupName
, valueArray
) {
521 validNames
= this.getGroupFilters( groupName
).map( function ( filterItem
) {
522 return filterItem
.getParamName();
525 if ( valueArray
.indexOf( 'all' ) > -1 ) {
526 // If anywhere in the values there's 'all', we
527 // treat it as if only 'all' was selected.
528 // Example: param=valid1,valid2,all
533 // Get rid of any dupe and invalid parameter, only output
535 // Example: param=valid1,valid2,invalid1,valid1
536 // Result: param=valid1,valid2
537 valueArray
.forEach( function ( value
) {
539 validNames
.indexOf( value
) > -1 &&
540 result
.indexOf( value
) === -1
542 result
.push( value
);
550 * Check whether the current filter state is set to all false.
552 * @return {boolean} Current filters are all empty
554 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.areCurrentFiltersEmpty = function () {
555 // Check if there are either any selected items or any items
556 // that have highlight enabled
557 return !this.getItems().some( function ( filterItem
) {
558 return filterItem
.isSelected() || filterItem
.isHighlighted();
563 * Check whether the default values of the filters are all false.
565 * @return {boolean} Default filters are all false
567 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.areDefaultFiltersEmpty = function () {
570 if ( this.defaultFiltersEmpty
!== null ) {
571 // We only need to do this test once,
572 // because defaults are set once per session
573 defaultFilters
= this.getFiltersFromParameters();
574 this.defaultFiltersEmpty
= Object
.keys( defaultFilters
).every( function ( filterName
) {
575 return !defaultFilters
[ filterName
];
579 return this.defaultFiltersEmpty
;
583 * This is the opposite of the #getParametersFromFilters method; this goes over
584 * the given parameters and translates into a selected/unselected value in the filters.
586 * @param {Object} params Parameters query object
587 * @return {Object} Filter state object
589 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getFiltersFromParameters = function ( params
) {
593 base
= this.getDefaultParams(),
596 params
= $.extend( {}, base
, params
);
598 // Go over the given parameters
599 $.each( params
, function ( paramName
, paramValue
) {
600 var itemOrGroup
= model
.parameterMap
[ paramName
];
602 if ( itemOrGroup
instanceof mw
.rcfilters
.dm
.FilterItem
) {
603 // Mark the group if it has any items that are selected
604 groupMap
[ itemOrGroup
.getGroupName() ] = groupMap
[ itemOrGroup
.getGroupName() ] || {};
605 groupMap
[ itemOrGroup
.getGroupName() ].hasSelected
= (
606 groupMap
[ itemOrGroup
.getGroupName() ].hasSelected
||
607 !!Number( paramValue
)
611 groupMap
[ itemOrGroup
.getGroupName() ].filters
= groupMap
[ itemOrGroup
.getGroupName() ].filters
|| [];
612 groupMap
[ itemOrGroup
.getGroupName() ].filters
.push( itemOrGroup
);
613 } else if ( itemOrGroup
instanceof mw
.rcfilters
.dm
.FilterGroup
) {
614 groupMap
[ itemOrGroup
.getName() ] = groupMap
[ itemOrGroup
.getName() ] || {};
615 // This parameter represents a group (values are the filters)
616 // this is equivalent to checking if the group is 'string_options'
617 groupMap
[ itemOrGroup
.getName() ].filters
= itemOrGroup
.getItems();
621 // Now that we know the groups' selection states, we need to go over
622 // the filters in the groups and mark their selected states appropriately
623 $.each( groupMap
, function ( group
, data
) {
624 var paramValues
, filterItem
,
625 allItemsInGroup
= data
.filters
;
627 if ( model
.groups
[ group
].getType() === 'send_unselected_if_any' ) {
628 for ( i
= 0; i
< allItemsInGroup
.length
; i
++ ) {
629 filterItem
= allItemsInGroup
[ i
];
631 result
[ filterItem
.getName() ] = groupMap
[ filterItem
.getGroupName() ].hasSelected
?
632 // Flip the definition between the parameter
633 // state and the filter state
634 // This is what the 'toggleSelected' value of the filter is
635 !Number( params
[ filterItem
.getParamName() ] ) :
636 // Otherwise, there are no selected items in the
637 // group, which means the state is false
640 } else if ( model
.groups
[ group
].getType() === 'string_options' ) {
641 paramValues
= model
.sanitizeStringOptionGroup(
643 params
[ group
].split(
644 model
.groups
[ group
].getSeparator()
648 for ( i
= 0; i
< allItemsInGroup
.length
; i
++ ) {
649 filterItem
= allItemsInGroup
[ i
];
651 result
[ filterItem
.getName() ] = (
652 // If it is the word 'all'
653 paramValues
.length
=== 1 && paramValues
[ 0 ] === 'all' ||
654 // All values are written
655 paramValues
.length
=== model
.groups
[ group
].getItemCount()
657 // All true (either because all values are written or the term 'all' is written)
658 // is the same as all filters set to false
660 // Otherwise, the filter is selected only if it appears in the parameter values
661 paramValues
.indexOf( filterItem
.getParamName() ) > -1;
670 * Get the item that matches the given name
672 * @param {string} name Filter name
673 * @return {mw.rcfilters.dm.FilterItem} Filter item
675 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getItemByName = function ( name
) {
676 return this.getItems().filter( function ( item
) {
677 return name
=== item
.getName();
682 * Set all filters to false or empty/all
683 * This is equivalent to display all.
685 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.emptyAllFilters = function () {
686 this.getItems().forEach( function ( filterItem
) {
687 this.toggleFilterSelected( filterItem
.getName(), false );
692 * Toggle selected state of one item
694 * @param {string} name Name of the filter item
695 * @param {boolean} [isSelected] Filter selected state
697 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.toggleFilterSelected = function ( name
, isSelected
) {
698 var item
= this.getItemByName( name
);
701 item
.toggleSelected( isSelected
);
706 * Toggle selected state of items by their names
708 * @param {Object} filterDef Filter definitions
710 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.toggleFiltersSelected = function ( filterDef
) {
711 Object
.keys( filterDef
).forEach( function ( name
) {
712 this.toggleFilterSelected( name
, filterDef
[ name
] );
717 * Get a group model from its name
719 * @param {string} groupName Group name
720 * @return {mw.rcfilters.dm.FilterGroup} Group model
722 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getGroup = function ( groupName
) {
723 return this.groups
[ groupName
];
727 * Get all filters within a specified group by its name
729 * @param {string} groupName Group name
730 * @return {mw.rcfilters.dm.FilterItem[]} Filters belonging to this group
732 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getGroupFilters = function ( groupName
) {
733 return ( this.getGroup( groupName
) && this.getGroup( groupName
).getItems() ) || [];
737 * Find items whose labels match the given string
739 * @param {string} query Search string
740 * @return {Object} An object of items to show
741 * arranged by their group names
743 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.findMatches = function ( query
) {
747 items
= this.getItems();
749 // Normalize so we can search strings regardless of case
750 query
= query
.toLowerCase();
752 // item label starting with the query string
753 for ( i
= 0; i
< items
.length
; i
++ ) {
754 if ( items
[ i
].getLabel().toLowerCase().indexOf( query
) === 0 ) {
755 result
[ items
[ i
].getGroupName() ] = result
[ items
[ i
].getGroupName() ] || [];
756 result
[ items
[ i
].getGroupName() ].push( items
[ i
] );
760 if ( $.isEmptyObject( result
) ) {
761 // item containing the query string in their label, description, or group title
762 for ( i
= 0; i
< items
.length
; i
++ ) {
763 groupTitle
= items
[ i
].getGroupModel().getTitle();
765 items
[ i
].getLabel().toLowerCase().indexOf( query
) > -1 ||
766 items
[ i
].getDescription().toLowerCase().indexOf( query
) > -1 ||
767 groupTitle
.toLowerCase().indexOf( query
) > -1
769 result
[ items
[ i
].getGroupName() ] = result
[ items
[ i
].getGroupName() ] || [];
770 result
[ items
[ i
].getGroupName() ].push( items
[ i
] );
779 * Get items that are highlighted
781 * @return {mw.rcfilters.dm.FilterItem[]} Highlighted items
783 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.getHighlightedItems = function () {
784 return this.getItems().filter( function ( filterItem
) {
785 return filterItem
.isHighlightSupported() &&
786 filterItem
.getHighlightColor();
791 * Toggle the highlight feature on and off.
792 * Propagate the change to filter items.
794 * @param {boolean} enable Highlight should be enabled
795 * @fires highlightChange
797 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.toggleHighlight = function ( enable
) {
798 enable
= enable
=== undefined ? !this.highlightEnabled
: enable
;
800 if ( this.highlightEnabled
!== enable
) {
801 this.highlightEnabled
= enable
;
803 this.getItems().forEach( function ( filterItem
) {
804 filterItem
.toggleHighlight( this.highlightEnabled
);
807 this.emit( 'highlightChange', this.highlightEnabled
);
812 * Check if the highlight feature is enabled
815 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.isHighlightEnabled = function () {
816 return !!this.highlightEnabled
;
820 * Set highlight color for a specific filter item
822 * @param {string} filterName Name of the filter item
823 * @param {string} color Selected color
825 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.setHighlightColor = function ( filterName
, color
) {
826 this.getItemByName( filterName
).setHighlightColor( color
);
830 * Clear highlight for a specific filter item
832 * @param {string} filterName Name of the filter item
834 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.clearHighlightColor = function ( filterName
) {
835 this.getItemByName( filterName
).clearHighlightColor();
839 * Clear highlight for all filter items
841 mw
.rcfilters
.dm
.FiltersViewModel
.prototype.clearAllHighlightColors = function () {
842 this.getItems().forEach( function ( filterItem
) {
843 filterItem
.clearHighlightColor();
846 }( mediaWiki
, jQuery
) );