--- 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 = $('<li class="box-shadow-2">'),
- outera = $('<a class="display-keyword" href="#">'),
- innera = $('<a class="icon-action" href="#">');
- outera.text(kw.keyword + ' ');
- outera.append(innera);
- li.append(outera);
+ texta = $('<a class="display-keyword" href="#">'),
+ actiona = $('<a class="icon-action" href="#">');
+ 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){