client/compteur.html
changeset 13 e42d9f11f6e2
parent 10 dd7d86fbee70
child 16 3dcb5d69d3ab
equal deleted inserted replaced
10:dd7d86fbee70 13:e42d9f11f6e2
    17             }
    17             }
    18             h1 {
    18             h1 {
    19                 font-size: 24px;
    19                 font-size: 24px;
    20             }
    20             }
    21             h2 {
    21             h2 {
    22                 font-size: 48px; font-weight: bold; margin: 20px 0;
    22                 font-size: 68px; font-weight: bold; margin: 2px 0;
    23             }
    23             }
    24         </style>
    24         </style>
    25 
    25 
    26         <script type="text/javascript" src="lib/jquery.min.js"></script>
    26         <script type="text/javascript" src="lib/jquery.min.js"></script>
    27         <script type="text/javascript" src="lib/protoclass.js"></script>              
    27         <script type="text/javascript" src="lib/protoclass.js"></script>              
    39             /* Mots-clés pour déclencher la recherche
    39             /* Mots-clés pour déclencher la recherche
    40             var searchKeywords = [ '#lgw', '#legrandwebze', 'webze' ]; 
    40             var searchKeywords = [ '#lgw', '#legrandwebze', 'webze' ]; 
    41              * */
    41              * */
    42             var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou'];
    42             var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou'];
    43             
    43             
       
    44             var totalTweets = 0;
       
    45             
    44             $(function() {
    46             $(function() {
    45                 
    47                 
    46                 myTweetSource = new Btv_TweetSource({
    48                 myTweetSource = new Btv_TweetSource({
    47                     keywords: searchKeywords
    49                     keywords: searchKeywords
    48                 });
    50                 });
    49                 
    51                 
    50                 myTweetSource.setOnNewTweets(function() {
    52                 myTweetSource.setOnNewTweets(function() {
    51                     var _filtered = this.afterDate(startHour);
    53                     totalTweets = this.afterDate(startHour).count();
    52                     $("#nbtweets").html(_filtered.count());
       
    53                 });
    54                 });
       
    55                 
       
    56                 setInterval(function() {
       
    57                     var _aff = parseInt($("#nbtweets").html());
       
    58                     if (_aff < totalTweets) {
       
    59                         if (_aff) {
       
    60                             $("#nbtweets").html(1+_aff);
       
    61                         } else {
       
    62                             $("#nbtweets").html(totalTweets);
       
    63                         }
       
    64                     }
       
    65                 }, 200);
    54             });
    66             });
    55         </script>
    67         </script>
    56     </head>
    68     </head>
    57     <body>
    69     <body>
    58         <div id="container">
    70         <div id="container">
    59             <h1>Total des tweets #LGW</h1>
    71             <h1>Total des Tweets</h1>
    60             <h2 id="nbtweets"></h2>
    72             <h2 id="nbtweets">0</h2>
    61         </div>
    73         </div>
    62 
    74 
    63     </body>
    75     </body>
    64 </html>
    76 </html>