Merge "Revised styling of sister-search sidebar."
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / dm / mw.rcfilters.dm.FiltersViewModel.js
index aa261d3..9054fe4 100644 (file)
                                items.push( filterItem );
                        }
 
-                       if ( data.type === 'string_options' && data.default ) {
+                       if ( data.type === 'string_options' ) {
                                // Store the default parameter group state
                                // For this group, the parameter is group name and value is the names
                                // of selected items
                                model.defaultParams[ group ] = model.sanitizeStringOptionGroup(
                                        group,
-                                       data.default.split( model.groups[ group ].getSeparator() )
+                                       data.default ?
+                                               data.default.split( model.groups[ group ].getSeparator() ) :
+                                               []
                                ).join( model.groups[ group ].getSeparator() );
                        }
                } );
                return this.defaultParams;
        };
 
-       /**
-        * Set all filter states to default values
-        */
-       mw.rcfilters.dm.FiltersViewModel.prototype.setFiltersToDefaults = function () {
-               var defaultFilterStates = this.getFiltersFromParameters( this.getDefaultParams() );
-
-               this.toggleFiltersSelected( defaultFilterStates );
-       };
-
        /**
         * Analyze the groups and their filters and output an object representing
         * the state of the parameters they represent.
                } );
        };
 
+       /**
+        * Get items that allow highlights even if they're not currently highlighted
+        *
+        * @return {mw.rcfilters.dm.FilterItem[]} Items supporting highlights
+        */
+       mw.rcfilters.dm.FiltersViewModel.prototype.getItemsSupportingHighlights = function () {
+               return this.getItems().filter( function ( filterItem ) {
+                       return filterItem.isHighlightSupported();
+               } );
+       };
+
        /**
         * Toggle the highlight feature on and off.
         * Propagate the change to filter items.