+ /**
+ * Get a minimal representation of the state for comparison
+ *
+ * @param {Object} state Given state
+ * @return {Object} Minimal state
+ */
+ mw.rcfilters.dm.SavedQueriesModel.prototype.getDifferenceFromBase = function ( state ) {
+ var result = { filters: {}, highlights: {}, invert: state.invert },
+ baseState = this.baseState;
+
+ // XOR results
+ $.each( state.filters, function ( name, value ) {
+ if ( baseState.filters !== undefined && baseState.filters[ name ] !== value ) {
+ result.filters[ name ] = value;
+ }
+ } );
+
+ $.each( state.highlights, function ( name, value ) {
+ if ( baseState.highlights !== undefined && baseState.highlights[ name ] !== value && name !== 'highlight' ) {
+ result.highlights[ name ] = value;
+ }
+ } );
+
+ return result;
+ };