|
3
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8" /> |
|
|
5 |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
|
|
6 |
<title>controlpanel</title> |
|
|
7 |
<meta name="description" content="" /> |
|
|
8 |
<link rel="stylesheet" href="css/base-metric.css" /> |
|
|
9 |
<link rel="stylesheet" href="css/controlpanel.css" /> |
|
|
10 |
<style type="text/css"> |
|
|
11 |
#podium-container { |
|
|
12 |
width: 800px; |
|
|
13 |
margin: 200px auto 0; |
|
|
14 |
} |
|
|
15 |
#podium { |
|
|
16 |
width: 100%; |
|
|
17 |
height: 300px; |
|
|
18 |
cursor: pointer; |
|
|
19 |
} |
|
|
20 |
#podium-labels { |
|
|
21 |
float: left; |
|
|
22 |
width: 100%; |
|
|
23 |
clear: both; |
|
|
24 |
margin-top: 20px; |
|
|
25 |
} |
|
|
26 |
#podium-labels li { |
|
|
27 |
float: left; |
|
|
28 |
width: 200px; |
|
|
29 |
color: #ffffff; |
|
|
30 |
text-align: center; |
|
|
31 |
font-size: 28px; |
|
|
32 |
font-weight: bold; |
|
|
33 |
} |
|
|
34 |
</style> |
|
|
35 |
<script type="text/javascript" src="lib/jquery.min.js"></script> |
|
|
36 |
<script type="text/javascript" src="js/podium.js"></script> |
|
|
37 |
<script type="text/javascript" src="js/tweetsource.js"></script> |
|
|
38 |
<script type="text/javascript"> |
|
|
39 |
var tzero = new Date(); |
|
|
40 |
$(function() { |
|
|
41 |
setInterval(function() { |
|
|
42 |
var _t = Math.floor((new Date() - tzero)/1000), |
|
|
43 |
_s = _t % 60, |
|
|
44 |
_m = Math.floor(_t/60) % 60, |
|
|
45 |
_h = Math.floor(_t/3600); |
|
|
46 |
$("#btv-cp-temps").html( |
|
|
47 |
_h + ':' + (_m < 10 ? '0' : '') + _m + ':' + (_s < 10 ? '0' : '') + _s |
|
|
48 |
) |
|
|
49 |
}, 500); |
|
|
50 |
var _keywords = ['Sarkozy', 'Hollande', 'candidat', 'politique'] |
|
|
51 |
myTweetSource = new Btv_TweetSource({ |
|
|
52 |
keywords: _keywords |
|
|
53 |
}); |
|
|
54 |
myPodium = new Btv_Podium([0,0,0,0]); |
|
|
55 |
myTweetSource.setTweetsCallback(function() { |
|
|
56 |
$("#btv-cp-nb-tweets").html(this.count()); |
|
|
57 |
var _counts = []; |
|
|
58 |
for (var _i = 0; _i < _keywords.length; _i++) { |
|
|
59 |
_counts.push(this.search(_keywords[_i]).count()); |
|
|
60 |
} |
|
|
61 |
myPodium.update(_counts); |
|
|
62 |
$('#btv-cp-liste-tweets-tout').html( |
|
|
63 |
this.reverse().slice(0,20).map(function(_t) { |
|
|
64 |
return '<li onclick="addTweet(\'' |
|
|
65 |
+ _t.id_str |
|
|
66 |
+ '\'); return false;"><a title="Ajouter à la sélection" href="#"><span class="btv-cp-tweet-date">' |
|
|
67 |
+ _t.created_at.match(/\d+:\d+:\d+/)[0] |
|
|
68 |
+ '</span> <span class="btv-cp-tweet-from">@' |
|
|
69 |
+ _t.from_user |
|
|
70 |
+ '</span> <span class="btv-cp-tweet-text">' |
|
|
71 |
+ _t.text |
|
|
72 |
+ '</span><div class="btv-cp-tweet-button btv-cp-tweet-add"></div></a></li>' |
|
|
73 |
}).join('') |
|
|
74 |
) |
|
|
75 |
}); |
|
|
76 |
}); |
|
|
77 |
function addTweet(tweetId) { |
|
|
78 |
var _t = myTweetSource.tweetById(tweetId); |
|
|
79 |
if (_t) { |
|
|
80 |
$("#btv-cp-liste-tweets-selection").prepend( |
|
|
81 |
'<li onclick="showTweet(\'' |
|
|
82 |
+ _t.id_str |
|
|
83 |
+ '\'); return false;"><a title="Afficher sur l\'écran" href="#"><span class="btv-cp-tweet-date">' |
|
|
84 |
+ _t.created_at.match(/\d+:\d+:\d+/)[0] |
|
|
85 |
+ '</span> <span class="btv-cp-tweet-from">@' |
|
|
86 |
+ _t.from_user |
|
|
87 |
+ '</span> <span class="btv-cp-tweet-text">' |
|
|
88 |
+ _t.text |
|
|
89 |
+ '</span><div class="btv-cp-tweet-button btv-cp-tweet-show"></div></a></li>' |
|
|
90 |
); |
|
|
91 |
} |
|
|
92 |
} |
|
|
93 |
</script> |
|
|
94 |
</head> |
|
|
95 |
<body> |
|
|
96 |
<div id="btv-cp-container"> |
|
|
97 |
<div class="btv-cp-line"> |
|
|
98 |
<div class="btv-cp-element"> |
|
|
99 |
<h2>Bubble <b>TV</b></h2> |
|
|
100 |
</div> |
|
|
101 |
<div class="btv-cp-element" id="btv-cp-cont-filtre"> |
|
|
102 |
<h3>Rechercher/Filtrer</h3> |
|
|
103 |
<input id="btv-cp-champ-filtre" /> |
|
|
104 |
<a href="#" id="btv-cp-clear-filtre">x</a> |
|
|
105 |
</div> |
|
|
106 |
<div class="btv-cp-element"> |
|
|
107 |
<h3>Derniers tweets</h3> |
|
|
108 |
<ul class="btv-cp-liste-tweets" id="btv-cp-liste-tweets-tout"> |
|
|
109 |
</ul> |
|
|
110 |
</div> |
|
|
111 |
<div class="btv-cp-element"> |
|
|
112 |
<h3>Tweets sélectionnés</h3> |
|
|
113 |
<ul class="btv-cp-liste-tweets" id="btv-cp-liste-tweets-selection"> |
|
|
114 |
</ul> |
|
|
115 |
</div> |
|
|
116 |
<div class="btv-cp-element btv-cp-cont-pause" id="btv-cp-cont-pause-amont"> |
|
|
117 |
<h3>Arrivée des tweets</h3> |
|
|
118 |
<a class="btv-cp-play-pause btv-cp-status-pause" href="#"></a> |
|
|
119 |
</div> |
|
|
120 |
<div class="btv-cp-element btv-cp-cont-pause" id="btv-cp-cont-pause-aval"> |
|
|
121 |
<h3>Purge des colonnes</h3> |
|
|
122 |
<a class="btv-cp-play-pause btv-cp-status-pause" href="#"></a> |
|
|
123 |
</div> |
|
|
124 |
<div class="btv-cp-element btv-cp-compteur"> |
|
|
125 |
<h3>Nombre de tweets</h3> |
|
|
126 |
<h4 id="btv-cp-nb-tweets"></h4> |
|
|
127 |
</div> |
|
|
128 |
<div class="btv-cp-element btv-cp-compteur"> |
|
|
129 |
<h3>Temps écoulé</h3> |
|
|
130 |
<h4 id="btv-cp-temps">0:00:00</h4> |
|
|
131 |
</div> |
|
|
132 |
</div> |
|
|
133 |
</div> |
|
|
134 |
<div id="podium-container"> |
|
|
135 |
<div id="podium"></div> |
|
|
136 |
<ul id="podium-labels"> |
|
|
137 |
<li>Sarkozy</li> |
|
|
138 |
<li>Hollande</li> |
|
|
139 |
<li>candidat</li> |
|
|
140 |
<li>politique</li> |
|
|
141 |
</ul> |
|
|
142 |
</div> |
|
|
143 |
</body> |
|
|
144 |
</html> |