client/compteur.html
changeset 31 7b76d97e3051
parent 22 978c4a0e0095
child 32 1e47b1f9f42d
equal deleted inserted replaced
30:80040858c006 31:7b76d97e3051
     5         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
     5         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
     6         <title>Bubble-TV</title>
     6         <title>Bubble-TV</title>
     7         <meta name="description" content="" />
     7         <meta name="description" content="" />
     8         <link rel="stylesheet" href="css/base-metric.css" />
     8         <link rel="stylesheet" href="css/base-metric.css" />
     9         <style type="text/css">
     9         <style type="text/css">
    10             #container {
    10         #container {
    11                 width: 300px;
    11             width: 312px;
    12                 height: 300px;
    12             height: 312px;
    13                 margin: 200px auto;
    13             margin: 200px auto;
    14                 padding: 100px;
    14             padding: 35px;
    15                 background: #0031ff;
    15             background: #0031ff;
    16                 color: #fff;
    16             color: #fff;
       
    17         }
       
    18         h1 {
       
    19             font-size: 35px;
       
    20         }
       
    21 		h2 {
       
    22             font-size: 35px;
       
    23 			margin-top:120px;
       
    24 			line-height:35px;
    17             }
    25             }
    18             h1 {
    26         h3 {
    19                 font-size: 24px;
    27             font-size: 122px; font-weight: bold; margin-left: 0px; line-height:120px;
    20             }
    28         }
    21             h2 {
       
    22                 font-size: 48px; font-weight: bold; margin: 20px 0;
       
    23             }
       
    24         </style>
    29         </style>
    25 
    30 
    26         <script type="text/javascript" src="lib/jquery.min.js"></script>
    31         <script type="text/javascript" src="lib/jquery.min.js"></script>
    27         <script type="text/javascript" src="lib/protoclass.js"></script>              
    32         <script type="text/javascript" src="lib/protoclass.js"></script>              
    28         <script type="text/javascript" src="lib/box2d.js"></script>
    33         <script type="text/javascript" src="lib/box2d.js"></script>
    39             /* Mots-clés pour déclencher la recherche
    44             /* Mots-clés pour déclencher la recherche
    40             var searchKeywords = [ '#lgw', '#legrandwebze', 'webze' ]; 
    45             var searchKeywords = [ '#lgw', '#legrandwebze', 'webze' ]; 
    41              * */
    46              * */
    42             var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou'];
    47             var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou'];
    43             
    48             
       
    49             var totalTweets = 0;
       
    50             
    44             $(function() {
    51             $(function() {
    45                 
    52                 
    46                 myTweetSource = new Btv_TweetSource({
    53                 myTweetSource = new Btv_TweetSource({
    47                     keywords: searchKeywords
    54                     keywords: searchKeywords
    48                 });
    55                 });
    49                 
    56                 
    50                 myTweetSource.setOnNewTweets(function() {
    57                 myTweetSource.setOnNewTweets(function() {
    51                     var _filtered = this.afterDate(startHour);
    58                     totalTweets = this.afterDate(startHour).count();
    52                     $("#nbtweets").html(_filtered.count());
       
    53                 });
    59                 });
       
    60                 
       
    61                 setInterval(function() {
       
    62                     var _aff = parseInt($("#nbtweets").html());
       
    63                     if (_aff < totalTweets) {
       
    64                         if (_aff) {
       
    65                             $("#nbtweets").html(1+_aff);
       
    66                         } else {
       
    67                             $("#nbtweets").html(totalTweets);
       
    68                         }
       
    69                     }
       
    70                 }, 200);
    54             });
    71             });
    55         </script>
    72         </script>
    56     </head>
    73     </head>
    57     <body>
    74     <body>
    58         <div id="container">
    75         <div id="container">
    59             <h1>Total des tweets #LGW</h1>
    76             <h1>#LGW</h1>
    60             <h2 id="nbtweets"></h2>
    77             <h2>Total des tweets</h2>
       
    78             <h3 id="nbtweets">0</h3>
    61         </div>
    79         </div>
    62 
    80 
    63     </body>
    81     </body>
    64 </html>
    82 </html>