RCFilters: Allows specifying default highlights from the server
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / dm / mw.rcfilters.dm.FiltersViewModel.js
index 5013c08..772ed92 100644 (file)
 
                this.currentView = 'default';
 
+               if ( this.getHighlightedItems().length > 0 ) {
+                       this.toggleHighlight( true );
+               }
+
                // Finish initialization
                this.emit( 'initialize' );
        };
                return result;
        };
 
+       /**
+        * Get an object representing the complete empty state of highlights
+        *
+        * @return {Object} Object containing all the highlight parameters set to their negative value
+        */
+       mw.rcfilters.dm.FiltersViewModel.prototype.getEmptyHighlightParameters = function () {
+               var result = {};
+
+               this.getItems().forEach( function ( filterItem ) {
+                       result[ filterItem.getName() + '_color' ] = null;
+               } );
+               result.highlight = '0';
+
+               return result;
+       };
+
        /**
         * Extract the highlight values from given object. Since highlights are
         * the same for filter and parameters, it doesn't matter which one is