js/startscreen.js
changeset 21 007254e97333
parent 19 685c406c7d8c
child 23 933b388521f6
--- a/js/startscreen.js	Wed Apr 17 17:10:43 2013 +0200
+++ b/js/startscreen.js	Mon Apr 22 18:42:40 2013 +0200
@@ -1,7 +1,24 @@
-var topicPoubelle = 13;
-
 function showData() {
+    
+    var nmmso = data.segments.length;
 	
+    data.topics.forEach(function(topic) {
+        topic.score = 0;
+        topic.weights = [];
+        for (var i = 0; i < nmmso; i++) {
+            topic.weights.push(0);
+        }
+    });
+    
+    data.segments.forEach(function(mmso, i) {
+        mmso.topics.forEach(function(t) {
+            data.topics[t.topic].weights[i] = t.weight;
+            data.topics[t.topic].score += t.weight;
+        });
+    });
+    
+    var topicPoubelle = removeBiggestTopic ? _(data.topics.slice()).sortBy(function(t) { return -t.score; })[0].index : -1;
+    
 	data.topiclabels.forEach(function(v) {
 		var words = _(v.words).map(function(v, k) {
 			return {
@@ -33,23 +50,6 @@
     
     $(".duration").text(secsToString(data.duration));
   
-    var nmmso = data.segments.length;
-    
-    data.topics.forEach(function(topic) {
-        topic.score = 0;
-        topic.weights = [];
-        for (var i = 0; i < nmmso; i++) {
-            topic.weights.push(0);
-        }
-    });
-    
-    data.segments.forEach(function(mmso, i) {
-        mmso.topics.forEach(function(t) {
-            data.topics[t.topic].weights[i] = t.weight;
-            data.topics[t.topic].score += t.weight;
-        });
-        mmso.tweet_rate = mmso.tweet_count / mmso.duration; 
-    });
     
     var sortedTopics = data.topics.filter(function(t) {
         return t.index !== topicPoubelle;
@@ -160,6 +160,9 @@
         source: allwords,
         change: function() {
         	window.setTimeout(wordFilter,0);
+        },
+        select: function() {
+        	window.setTimeout(wordFilter,0);
         }
     }).on("keyup change paste", wordFilter);
 // */
@@ -345,7 +348,7 @@
     }
     
     function solrUrl(table, params) {
-        return "http://159.217.144.101:8050/sia-solr/" + table + "/select?" + $.param(params) + "&wt=json&json.wrf=?";
+        return solrUrlBase + table + "/select?" + $.param(params) + "&wt=json&json.wrf=?";
     }
     
     function loadFromTopicsBean(method, propname, args, callback) {
@@ -389,10 +392,6 @@
                 topics.sort(function(a,b) {
                     return b.weight - a.weight;
                 });
-/*                topics = topics.filter(function(t) {
-                    return t.topic !== topicPoubelle
-                }).slice(0,1);
-                topics[0].weight = 1; */
                 return {
                     id: mmso.MMSO_id,
                     start: start,