Part of ACREP-35, and surely the last part?
[mkws-moved-to-github.git] / src / mkws-filter.js
index 63d80bd..23cb54b 100644 (file)
@@ -89,7 +89,7 @@ function filterSet(team) {
       res += field + "=" + value.replace(/[\\|,]/g, '\\$&');
     });
     return res;
-  }
+  };
 
   that.pp2catLimit = function() {
     var res = "";
@@ -99,7 +99,7 @@ function filterSet(team) {
       res += "category~" + id.replace(/[\\,]/g, '\\$&');
     });
     return res;
-  }
+  };
 
   // Returns a hash of key=value pairs representing the filter-set
   // These will become part of the URL-fragment representing the state
@@ -122,7 +122,18 @@ function filterSet(team) {
     }
     
     return hash;
-  }
+  };
+
+  that.deepCopy = function() {
+    var fs = filterSet(m_team);
+    fs._setList($.extend([], m_list));
+    return fs;
+  };
+
+  // Used only by clone()
+  that._setList = function(list) {
+    m_list = list;
+  };
 
   return that;
 }