1 // Factory function for sets of filters.
2 function filterSet(team) {
8 that.list = function() {
12 that.add = function(filter) {
16 that.removeMatching = function(matchFn) {
18 for (var i in m_list) {
19 var filter = m_list[i];
20 if (matchFn(filter)) {
21 m_team.log("removeMatching() removing filter " + $.toJSON(filter));
23 m_team.log("removeMatching() keeping filter " + $.toJSON(filter));
30 that.targetFiltered = function(id) {
31 for (var i = 0; i < m_list.length; i++) {
32 if (m_list[i].id === id ||
33 m_list[i].id === 'pz:id=' + id) {
40 that.pp2filter = function() {
43 for (var i in m_list) {
44 var filter = m_list[i];
47 if (filter.id.match(/^[a-z:]+[=~]/)) {
48 m_team.log("filter '" + filter.id + "' already begins with SETTING OP");
50 filter.id = 'pz:id=' + filter.id;
59 that.pp2limit = function(initial) {
60 var res = initial || "";
62 for (var i in m_list) {
63 var filter = m_list[i];
66 res += filter.field + "=" + filter.value.replace(/[\\|,]/g, '\\$&');
78 // Factory function for filters. These can be of several types.
79 function filter(id, name, field, value) {
83 res = { id: id, name: name };
85 res = { field: field, value: value };