client/compteur.html
changeset 13 e42d9f11f6e2
parent 10 dd7d86fbee70
child 16 3dcb5d69d3ab
--- a/client/compteur.html	Mon Feb 20 17:44:20 2012 +0100
+++ b/client/compteur.html	Tue Feb 21 11:48:06 2012 +0100
@@ -19,7 +19,7 @@
                 font-size: 24px;
             }
             h2 {
-                font-size: 48px; font-weight: bold; margin: 20px 0;
+                font-size: 68px; font-weight: bold; margin: 2px 0;
             }
         </style>
 
@@ -41,6 +41,8 @@
              * */
             var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou'];
             
+            var totalTweets = 0;
+            
             $(function() {
                 
                 myTweetSource = new Btv_TweetSource({
@@ -48,16 +50,26 @@
                 });
                 
                 myTweetSource.setOnNewTweets(function() {
-                    var _filtered = this.afterDate(startHour);
-                    $("#nbtweets").html(_filtered.count());
+                    totalTweets = this.afterDate(startHour).count();
                 });
+                
+                setInterval(function() {
+                    var _aff = parseInt($("#nbtweets").html());
+                    if (_aff < totalTweets) {
+                        if (_aff) {
+                            $("#nbtweets").html(1+_aff);
+                        } else {
+                            $("#nbtweets").html(totalTweets);
+                        }
+                    }
+                }, 200);
             });
         </script>
     </head>
     <body>
         <div id="container">
-            <h1>Total des tweets #LGW</h1>
-            <h2 id="nbtweets"></h2>
+            <h1>Total des Tweets</h1>
+            <h2 id="nbtweets">0</h2>
         </div>
 
     </body>