107 $("#btv-cp-container").dequeue().animate({ |
107 $("#btv-cp-container").dequeue().animate({ |
108 "left": "-315px" |
108 "left": "-315px" |
109 }); |
109 }); |
110 } |
110 } |
111 |
111 |
|
112 function updatePodiumAndLabels(_counts) { |
|
113 myPodium.update(_counts); |
|
114 $("#podium-chiffres").html(_counts.map(function(_c) { |
|
115 return '<li>' + _c + '</li>' |
|
116 }).join("")); |
|
117 } |
|
118 |
|
119 function getPodium() { |
|
120 $.getJSON(serverUrl |
|
121 + 'podium/' |
|
122 + Math.floor(startHour/1000) |
|
123 + '/' |
|
124 + columnKeywords.map(function(_c) { |
|
125 return encodeURIComponent(_c); |
|
126 }).join(',') |
|
127 + '?callback=?', |
|
128 function(_data) { |
|
129 var _counts = columnKeywords.map(function(_c) { |
|
130 return _data.podium[_c] || 0; |
|
131 }); |
|
132 $("#btv-cp-nb-tweets").html(_data.total); |
|
133 updatePodiumAndLabels(_counts); |
|
134 }); |
|
135 } |
|
136 |
112 $(function() { |
137 $(function() { |
113 columnCounts = columnKeywords.map(function() { |
138 columnCounts = columnKeywords.map(function() { |
114 return 0; |
139 return 0; |
115 }) |
140 }) |
116 setInterval(function() { |
141 setInterval(function() { |
122 _h + ':' + (_m < 10 ? '0' : '') + _m + ':' + (_s < 10 ? '0' : '') + _s |
147 _h + ':' + (_m < 10 ? '0' : '') + _m + ':' + (_s < 10 ? '0' : '') + _s |
123 ) |
148 ) |
124 }, 500); |
149 }, 500); |
125 myPodium = new Btv_Podium([0,0,0,0], { minHeight: 50 }); |
150 myPodium = new Btv_Podium([0,0,0,0], { minHeight: 50 }); |
126 |
151 |
|
152 if (typeof serverUrl != "undefined") { |
|
153 setInterval(getPodium, 2000); |
|
154 } |
127 |
155 |
128 $("#podium-labels").html(columnKeywords.map(function(_w) { |
156 $("#podium-labels").html(columnKeywords.map(function(_w) { |
129 return '<li>' + _w + '</li>' |
157 return '<li>' + _w + '</li>' |
130 }).join("")); |
158 }).join("")); |
131 |
159 |
132 myTweetSource = new Btv_TweetSource({ |
160 myTweetSource = new Btv_TweetSource({ |
133 keywords: searchKeywords |
161 keywords: searchKeywords |
134 }); |
162 }); |
135 |
|
136 myTweetSource.setOnNewTweets(function() { |
163 myTweetSource.setOnNewTweets(function() { |
137 var _filtered = this.afterDate(startHour); |
|
138 $("#btv-cp-nb-tweets").html(_filtered.count()); |
|
139 var _counts = []; |
|
140 for (var _i = 0; _i < columnKeywords.length; _i++) { |
|
141 _counts.push(_filtered.search(columnKeywords[_i]).count()); |
|
142 } |
|
143 updateLastTweetList(); |
164 updateLastTweetList(); |
144 myPodium.update(_counts); |
165 if (typeof serverUrl == "undefined") { |
145 $("#podium-chiffres").html(_counts.map(function(_c) { |
166 var _filtered = this.afterDate(startHour); |
146 return '<li>' + _c + '</li>' |
167 $("#btv-cp-nb-tweets").html(_filtered.count()); |
147 }).join("")); |
168 var _counts = []; |
|
169 for (var _i = 0; _i < columnKeywords.length; _i++) { |
|
170 _counts.push(_filtered.search(columnKeywords[_i]).count()); |
|
171 } |
|
172 updatePodiumAndLabels(_counts); |
|
173 } |
148 }); |
174 }); |
149 myQueueManager = new Btv_TweetQueueManager(myTweetSource, function(_t) { |
175 myQueueManager = new Btv_TweetQueueManager(myTweetSource, function(_t) { |
150 var _cat = -1; |
176 var _cat = -1; |
151 for (var i = 0; i < columnKeywords.length; i++) { |
177 for (var i = 0; i < columnKeywords.length; i++) { |
152 if (_t.text.search(regexpFromText(columnKeywords[i])) != -1) { |
178 if (_t.text.search(regexpFromText(columnKeywords[i])) != -1) { |