client/compteur.html
changeset 31 7b76d97e3051
parent 22 978c4a0e0095
child 32 1e47b1f9f42d
--- a/client/compteur.html	Tue Feb 21 22:46:45 2012 +0100
+++ b/client/compteur.html	Tue Feb 21 22:47:19 2012 +0100
@@ -7,20 +7,25 @@
         <meta name="description" content="" />
         <link rel="stylesheet" href="css/base-metric.css" />
         <style type="text/css">
-            #container {
-                width: 300px;
-                height: 300px;
-                margin: 200px auto;
-                padding: 100px;
-                background: #0031ff;
-                color: #fff;
+        #container {
+            width: 312px;
+            height: 312px;
+            margin: 200px auto;
+            padding: 35px;
+            background: #0031ff;
+            color: #fff;
+        }
+        h1 {
+            font-size: 35px;
+        }
+		h2 {
+            font-size: 35px;
+			margin-top:120px;
+			line-height:35px;
             }
-            h1 {
-                font-size: 24px;
-            }
-            h2 {
-                font-size: 48px; font-weight: bold; margin: 20px 0;
-            }
+        h3 {
+            font-size: 122px; font-weight: bold; margin-left: 0px; line-height:120px;
+        }
         </style>
 
         <script type="text/javascript" src="lib/jquery.min.js"></script>
@@ -41,6 +46,8 @@
              * */
             var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou'];
             
+            var totalTweets = 0;
+            
             $(function() {
                 
                 myTweetSource = new Btv_TweetSource({
@@ -48,16 +55,27 @@
                 });
                 
                 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>#LGW</h1>
+            <h2>Total des tweets</h2>
+            <h3 id="nbtweets">0</h3>
         </div>
 
     </body>