Add boolean target_filtered() function.
[mkws-moved-to-github.git] / tools / htdocs / mkws.js
index 2abcfca..7b6041e 100644 (file)
@@ -329,11 +329,13 @@ function team($, teamName) {
        for (var i = 0; i < data.length && i < max; i++) {
            acc.push('<div class="term">');
             acc.push('<a href="#" ');
-           var action;
+           var action = '';
            if (!pzIndex) {
                // Special case: target selection
                acc.push('target_id='+data[i].id+' ');
-               action = 'mkws.limitTarget(\'' + m_teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
+               if (!target_filtered(data[i].id)) {
+                   action = 'mkws.limitTarget(\'' + m_teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
+               }
            } else {
                action = 'mkws.limitQuery(\'' + m_teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
            }
@@ -345,6 +347,18 @@ function team($, teamName) {
     }
 
 
+    function target_filtered(id) {
+       debug("target_filtered(" + id + ")");
+       for (var i = 0; i < m_filters.length; i++) {
+           if (m_filters[i].id === id ||
+               m_filters[i].id === 'pz:id=' + id) {
+               return true;
+           }
+       }
+       return false;
+    }
+
+
     function my_onrecord(data, args, teamName) {
        debug("record: teamName=" + teamName + ", m_teamName=" + m_teamName);
        // FIXME: record is async!!