cluster_search_ui/commit

Now correctly replacing thumbnail event listeners.

authorChris Dijkshoorn
Sat Mar 28 13:25:38 2015 +0000
committerChris Dijkshoorn
Sat Mar 28 13:25:38 2015 +0000
commitd7078f21635468da5cf17c97c24520435b47a56f
treedee078f5f0a22b647baedcc266844f1d545975e0
parentba8d49e1da819efe5158b907b87d3277d7f0e48d
Diff style: patch stat
diff --git a/web/js/thumbnail.js b/web/js/thumbnail.js
index 14bd2e2..07fc0d4 100644
--- a/web/js/thumbnail.js
+++ b/web/js/thumbnail.js
@@ -56,11 +56,10 @@ function changeThumbnails(pageNumber, activePage, numberOfPages, clusterId) {
 	
 	console.log("start: " + start + " stop: " + stop + " page number: " + pageNumber + " current page: " + activePage + " cluster id: " + clusterId + " displayed: " + displayOptions.numberDisplayedItems + " remove: " + remove);
 	var thumbIndex = 0;
-	for (var i=start;i<stop;i++) { 
-		console.log("title: " + items[i].title + " i : " + i + " thumbIndex: " + thumbIndex);
-		// Replace id and set link
+	for (i=start; i<stop; i++) {
+		// Replace id element and add new listener
 		id = getId(items[i].uri)
-		$("#cluster" + clusterId + " .col-md-" + bootstrapWidth + " a").eq(thumbIndex).attr("id", id);
+		$("#cluster" + clusterId).eq(thumbIndex).attr("id", id);
 		addClickEvent(id, items[i].link, clusterId, i);
 		
 		// Replace image
@@ -101,6 +100,7 @@ function getId(uri) {
 }
 
 function addClickEvent(id, link, clusterId, index) {
+	//Add thumbnail click event
 	$("#cluster" + clusterId  + " #" + id).click(function() {
 		localStorage.setItem("itemIndex", index);
 		localStorage.setItem("clusterId", clusterId);