diff -r be4eb4db3418 -r aa163c5df6e3 integration/v2/js/keyword-mosaic.js --- a/integration/v2/js/keyword-mosaic.js Thu Jun 27 17:31:15 2013 +0200 +++ b/integration/v2/js/keyword-mosaic.js Thu Jun 27 17:38:53 2013 +0200 @@ -6,7 +6,7 @@ }); function updateMasonry() { - $('.masonry-177').data('masonry').layout(); + $('.masonry-177').masonry('layout'); } var keywordsobj = {}; @@ -63,27 +63,30 @@ keywordslist.slice(0,100).forEach(function(kw) { var li = $('
  • '), - outera = $(''), - innera = $(''); - outera.text(kw.keyword + ' '); - outera.append(innera); - li.append(outera); + texta = $(''), + actiona = $(''); + texta.text(kw.keyword + ' '); + li.append(actiona); + li.append(texta); kw.li = li; li.click(function() { - if (kw.enabled) { + var allothersdisabled = keywordslist.reduce(function(mem, k) { + return mem && (k === kw || !k.enabled); + }, true); + if (allothersdisabled) { + keywordslist.forEach(function(k) { + k.enabled = true; + }); + } else { keywordslist.forEach(function(k) { k.enabled = false; }); kw.enabled = true; - } else { - keywordslist.forEach(function(k) { - k.enabled = true; - }); } updateKeywords(); return false; }); - innera.click(function() { + actiona.click(function() { kw.enabled = !kw.enabled; updateKeywords(); return false; @@ -104,6 +107,14 @@ updateMasonry(); }); + //filters + $('.filters a').each(function(){ + var text = $.trim($(this).text()); + if(text.length > 26){ + $(this).text(text.substr(0, 26) + '...') + } + }); + //################## /* $(document).on('click','.display-keyword', function(e){