--- a/client/js/tweetanim.js Mon Feb 20 14:36:59 2012 +0100
+++ b/client/js/tweetanim.js Tue Feb 21 11:10:12 2012 +0100
@@ -3,7 +3,7 @@
var countTweets = 0;
var isPlayingTweets = false; // auto start
var SPEED_TWEETS = 10;
-var MAX_VOTES = 25;
+var MAX_VOTES = 5;
var DUMP_TWEETS = 10;
var toDel = [];
@@ -12,6 +12,12 @@
var ts = [];
+var candidats = Array(4);
+
+for(var h= 0; h < 4; h++) {
+ toDel[h] = [];
+}
+
var b = 0;
var defaultTweet = {
@@ -51,7 +57,7 @@
},
queueTweet: function(t) {
- console.log("Queued " + t.text);
+
tweetQueue.push({t: t, anim: true});
$('#nbr-mesure-new').html(tweetQueue.length);
/*
@@ -141,12 +147,11 @@
if(doSshift)
TweetAnim.shiftQueue();
-/*
- toDel.push(t);
- current_past_tweet = toDel.length;
- ts[t.candidats[0]]++;
- checkSilos();
- */
+
+ toDel[t.cat].push(t);
+ checkSilos();
+
+
}
}
@@ -172,16 +177,23 @@
function checkSilos() {
- for(var j=0; j<ts.length; j++) {
- if(ts[j]>MAX_VOTES) {
- j=ts.length+1;
- emptySilos();
+ for(var j=0; j<4; j++) {
+ if(toDel[j].length>MAX_VOTES) {
+
+ var ids = toDel[j].shift();
+ world.DestroyBody(b2bod[ids.id_str]);
+ console.log(b2bod[ids.id_str]);
+
+ $('#'+ids.id_str).delay(10).hide("slow").queue(function() {
+ $(this).remove();
+ });
}
}
}
-
+/*
function emptySilos() {
+ console.log("emptySilos");
var toDel2 = [];
var m =0;
@@ -205,5 +217,5 @@
toDel = toDel2;
current_past_tweet=toDel.length;
}
-
+*/
TweetAnim.init();