integration/v2/js/keyword-mosaic.js
changeset 183 f752e362bf62
parent 182 dde608cfd823
child 188 aa163c5df6e3
equal deleted inserted replaced
182:dde608cfd823 183:f752e362bf62
    68         texta.text(kw.keyword + ' ');
    68         texta.text(kw.keyword + ' ');
    69         li.append(actiona);
    69         li.append(actiona);
    70         li.append(texta);
    70         li.append(texta);
    71         kw.li = li;
    71         kw.li = li;
    72         li.click(function() {
    72         li.click(function() {
    73             if (kw.enabled) {
    73             var allothersdisabled = keywordslist.reduce(function(mem, k) {
       
    74                 return mem && (k === kw || !k.enabled);
       
    75             }, true);
       
    76             if (allothersdisabled) {
       
    77                 keywordslist.forEach(function(k) {
       
    78                     k.enabled = true;
       
    79                 });
       
    80             } else {
    74                 keywordslist.forEach(function(k) {
    81                 keywordslist.forEach(function(k) {
    75                     k.enabled = false;
    82                     k.enabled = false;
    76                 });
    83                 });
    77                 kw.enabled = true;
    84                 kw.enabled = true;
    78             } else {
       
    79                 keywordslist.forEach(function(k) {
       
    80                     k.enabled = true;
       
    81                 });
       
    82             }
    85             }
    83             updateKeywords();
    86             updateKeywords();
    84             return false;
    87             return false;
    85         });
    88         });
    86         actiona.click(function() {
    89         actiona.click(function() {