|
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 { |
|
5
|
12 |
position: absolute; |
|
|
13 |
width: 1480px; |
|
|
14 |
top: 600px; |
|
|
15 |
left: 400px; |
|
3
|
16 |
} |
|
|
17 |
#podium { |
|
|
18 |
width: 100%; |
|
|
19 |
height: 300px; |
|
|
20 |
} |
|
|
21 |
#podium-labels { |
|
5
|
22 |
position: absolute; |
|
3
|
23 |
width: 100%; |
|
5
|
24 |
top: 320px; |
|
3
|
25 |
} |
|
|
26 |
#podium-labels li { |
|
|
27 |
float: left; |
|
5
|
28 |
width: 25%; |
|
3
|
29 |
color: #ffffff; |
|
|
30 |
text-align: center; |
|
5
|
31 |
font-size: 42px; |
|
|
32 |
} |
|
|
33 |
#podium-chiffres { |
|
|
34 |
position: absolute; |
|
|
35 |
width: 100%; |
|
|
36 |
top: 240px; |
|
|
37 |
} |
|
|
38 |
#podium-chiffres li { |
|
|
39 |
float: left; |
|
|
40 |
width: 25%; |
|
|
41 |
color: #000000; |
|
|
42 |
text-align: center; |
|
|
43 |
font-size: 50px; |
|
3
|
44 |
font-weight: bold; |
|
|
45 |
} |
|
5
|
46 |
|
|
|
47 |
|
|
|
48 |
#btv-tweet { |
|
|
49 |
position: absolute; |
|
|
50 |
left: 775px; |
|
|
51 |
top: 250px; |
|
|
52 |
width: 650px; |
|
|
53 |
background: #0031ff; |
|
|
54 |
padding: 40px; |
|
|
55 |
color: #ffffff; |
|
|
56 |
font-size: 42px; |
|
|
57 |
display: none; |
|
|
58 |
} |
|
|
59 |
.btv-tweet-image { |
|
|
60 |
width: 100px; |
|
|
61 |
height: 100px; |
|
|
62 |
margin: 0 30px 30px 0; |
|
|
63 |
float: left; |
|
|
64 |
} |
|
|
65 |
.btv-tweet-screen-name { |
|
|
66 |
font-weight: bold; |
|
|
67 |
} |
|
|
68 |
.btv-tweet-name { |
|
|
69 |
margin: 10px 0; |
|
|
70 |
} |
|
|
71 |
.btv-tweet-text { |
|
|
72 |
clear: both; |
|
|
73 |
} |
|
3
|
74 |
</style> |
|
11
|
75 |
|
|
7
|
76 |
<script type="text/javascript" src="lib/jquery.min.js"></script> |
|
|
77 |
|
|
|
78 |
<script type="text/javascript" src="lib/protoclass.js"></script> |
|
|
79 |
<script type="text/javascript" src="lib/box2d.js"></script> |
|
|
80 |
<script type="text/javascript" src="js/tweetanim.js"></script> |
|
|
81 |
<script type="text/javascript" src="js/tweetvote-anim.js"></script> |
|
|
82 |
|
|
3
|
83 |
<script type="text/javascript" src="js/podium.js"></script> |
|
|
84 |
<script type="text/javascript" src="js/tweetsource.js"></script> |
|
|
85 |
<script type="text/javascript"> |
|
5
|
86 |
var tzero = new Date() - 120000; |
|
|
87 |
|
|
|
88 |
function updateLastTweets() { |
|
|
89 |
var _filtered = myTweetSource.afterDate(tzero), |
|
|
90 |
_txtFilter = $("#btv-cp-champ-filtre").val(), |
|
|
91 |
_reFilter = null; |
|
|
92 |
if (_txtFilter.length > 1) { |
|
|
93 |
_filtered = _filtered.search(_txtFilter); |
|
|
94 |
_reFilter = new RegExp('(' + _txtFilter.replace(/\W/gim,'\\$1') + ')','gim'); |
|
|
95 |
} |
|
|
96 |
$('#btv-cp-liste-tweets-tout').html( |
|
|
97 |
_filtered.reverse().slice(0,20).map(function(_t) { |
|
|
98 |
return '<li onclick="addTweet(\'' |
|
|
99 |
+ _t.id_str |
|
|
100 |
+ '\'); return false;"><a title="Ajouter à la sélection" href="#"><span class="btv-cp-tweet-date">' |
|
|
101 |
+ _t.created_at.match(/\d+:\d+:\d+/)[0] |
|
|
102 |
+ '</span> <span class="btv-cp-tweet-from">' |
|
|
103 |
+ ( _reFilter ? ('@' + _t.from_user).replace(_reFilter, '<span class="btv-cp-highlight">$1</span>') : ('@' + _t.from_user) ) |
|
|
104 |
+ '</span> <span class="btv-cp-tweet-text">' |
|
|
105 |
+ ( _reFilter ? _t.text.replace(_reFilter, '<span class="btv-cp-highlight">$1</span>') : _t.text ) |
|
|
106 |
+ '</span><div class="btv-cp-tweet-button btv-cp-tweet-add"></div></a></li>' |
|
|
107 |
}).join('') |
|
|
108 |
); |
|
|
109 |
} |
|
|
110 |
|
|
3
|
111 |
function addTweet(tweetId) { |
|
|
112 |
var _t = myTweetSource.tweetById(tweetId); |
|
|
113 |
if (_t) { |
|
|
114 |
$("#btv-cp-liste-tweets-selection").prepend( |
|
|
115 |
'<li onclick="showTweet(\'' |
|
|
116 |
+ _t.id_str |
|
|
117 |
+ '\'); return false;"><a title="Afficher sur l\'écran" href="#"><span class="btv-cp-tweet-date">' |
|
|
118 |
+ _t.created_at.match(/\d+:\d+:\d+/)[0] |
|
|
119 |
+ '</span> <span class="btv-cp-tweet-from">@' |
|
|
120 |
+ _t.from_user |
|
|
121 |
+ '</span> <span class="btv-cp-tweet-text">' |
|
|
122 |
+ _t.text |
|
|
123 |
+ '</span><div class="btv-cp-tweet-button btv-cp-tweet-show"></div></a></li>' |
|
|
124 |
); |
|
|
125 |
} |
|
7
|
126 |
console.log(_t); |
|
|
127 |
TweetAnim.queueTweet(_t); |
|
|
128 |
TweetAnim.shiftQueue(); |
|
|
129 |
|
|
3
|
130 |
} |
|
5
|
131 |
|
|
|
132 |
function showTweet(tweetId) { |
|
|
133 |
var _t = myTweetSource.tweetById(tweetId); |
|
|
134 |
if (_t) { |
|
|
135 |
$("#btv-tweet").html('<img class="btv-tweet-image" src="' |
|
|
136 |
+ _t.profile_image_url |
|
|
137 |
+ '" /><p class="btv-tweet-screen-name">' |
|
|
138 |
+ _t.from_user |
|
|
139 |
+ '</p><p class="btv-tweet-name">' |
|
|
140 |
+ _t.from_user_name |
|
|
141 |
+'</p><p class="btv-tweet-text">' |
|
|
142 |
+ _t.text |
|
|
143 |
+'</p>').show(); |
|
|
144 |
$(".btv-cp-hide-tweets").show(); |
|
|
145 |
} |
|
|
146 |
} |
|
|
147 |
|
|
|
148 |
$(function() { |
|
|
149 |
setInterval(function() { |
|
|
150 |
var _t = Math.floor((new Date() - tzero)/1000), |
|
|
151 |
_s = _t % 60, |
|
|
152 |
_m = Math.floor(_t/60) % 60, |
|
|
153 |
_h = Math.floor(_t/3600); |
|
|
154 |
$("#btv-cp-temps").html( |
|
|
155 |
_h + ':' + (_m < 10 ? '0' : '') + _m + ':' + (_s < 10 ? '0' : '') + _s |
|
|
156 |
) |
|
|
157 |
}, 500); |
|
|
158 |
myPodium = new Btv_Podium([0,0,0,0]); |
|
|
159 |
|
|
|
160 |
var _keywords = ['Sarkozy', 'Hollande', 'candidat', 'France']; |
|
|
161 |
|
|
|
162 |
$("#podium-labels").html(_keywords.map(function(_w) { |
|
|
163 |
return '<li>' + _w + '</li>' |
|
|
164 |
}).join("")); |
|
|
165 |
|
|
|
166 |
myTweetSource = new Btv_TweetSource({ |
|
|
167 |
keywords: _keywords |
|
|
168 |
}); |
|
|
169 |
|
|
|
170 |
myTweetSource.setTweetsCallback(function() { |
|
|
171 |
var _filtered = this.afterDate(tzero); |
|
|
172 |
$("#btv-cp-nb-tweets").html(_filtered.count()); |
|
|
173 |
var _counts = []; |
|
|
174 |
for (var _i = 0; _i < _keywords.length; _i++) { |
|
|
175 |
_counts.push(_filtered.search(_keywords[_i]).count()); |
|
|
176 |
} |
|
|
177 |
updateLastTweets(); |
|
|
178 |
myPodium.update(_counts); |
|
|
179 |
$("#podium-chiffres").html(_counts.map(function(_c) { |
|
|
180 |
return '<li>' + _c + '</li>' |
|
|
181 |
}).join("")); |
|
|
182 |
}); |
|
|
183 |
|
|
|
184 |
$("#btv-cp-champ-filtre").keyup(function() { |
|
|
185 |
updateLastTweets(); |
|
|
186 |
}); |
|
|
187 |
$("#btv-cp-clear-filtre").click(function() { |
|
|
188 |
$("#btv-cp-champ-filtre").val(""); |
|
|
189 |
updateLastTweets(); |
|
|
190 |
return false; |
|
|
191 |
}); |
|
|
192 |
$("#btv-tweet, .btv-cp-hide-tweets").click(function() { |
|
|
193 |
$("#btv-tweet, .btv-cp-hide-tweets").hide(); |
|
|
194 |
}) |
|
|
195 |
}); |
|
|
196 |
|
|
3
|
197 |
</script> |
|
|
198 |
</head> |
|
|
199 |
<body> |
|
7
|
200 |
<div id="canvas" width="6000" height="2000" style="background-color:#333333;" ></div> |
|
|
201 |
|
|
5
|
202 |
<div id="btv-global-container"> |
|
|
203 |
<div id="btv-cp-container"> |
|
|
204 |
<div class="btv-cp-line"> |
|
|
205 |
<div class="btv-cp-element"> |
|
|
206 |
<h2>Bubble <b>TV</b></h2> |
|
|
207 |
</div> |
|
|
208 |
<div class="btv-cp-element" id="btv-cp-cont-filtre"> |
|
|
209 |
<h3>Rechercher/Filtrer</h3> |
|
|
210 |
<input id="btv-cp-champ-filtre" /> |
|
|
211 |
<a href="#" id="btv-cp-clear-filtre">x</a> |
|
|
212 |
</div> |
|
|
213 |
<div class="btv-cp-element btv-cp-cont-liste"> |
|
|
214 |
<h3>Derniers tweets</h3> |
|
|
215 |
<ul class="btv-cp-liste-tweets" id="btv-cp-liste-tweets-tout"> |
|
|
216 |
</ul> |
|
|
217 |
</div> |
|
|
218 |
<div class="btv-cp-element btv-cp-cont-liste"> |
|
|
219 |
<h3>Tweets sélectionnés</h3> |
|
|
220 |
<ul class="btv-cp-liste-tweets" id="btv-cp-liste-tweets-selection"> |
|
|
221 |
</ul> |
|
|
222 |
<a class="btv-cp-hide-tweets" href="#" style="display: none;">Cacher le tweet à l'écran</a> |
|
|
223 |
</div> |
|
|
224 |
<div class="btv-cp-element btv-cp-cont-pause" id="btv-cp-cont-pause-amont"> |
|
|
225 |
<h3>Arrivée des tweets</h3> |
|
|
226 |
<a class="btv-cp-play-pause btv-cp-status-pause" href="#"></a> |
|
|
227 |
</div> |
|
|
228 |
<div class="btv-cp-element btv-cp-cont-pause" id="btv-cp-cont-pause-aval"> |
|
|
229 |
<h3>Purge des colonnes</h3> |
|
|
230 |
<a class="btv-cp-play-pause btv-cp-status-pause" href="#"></a> |
|
|
231 |
</div> |
|
|
232 |
<div class="btv-cp-element btv-cp-compteur"> |
|
|
233 |
<h3>Nombre de tweets</h3> |
|
|
234 |
<h4 id="btv-cp-nb-tweets"></h4> |
|
|
235 |
</div> |
|
|
236 |
<div class="btv-cp-element btv-cp-compteur"> |
|
|
237 |
<h3>Temps écoulé</h3> |
|
|
238 |
<h4 id="btv-cp-temps">0:00:00</h4> |
|
|
239 |
</div> |
|
3
|
240 |
</div> |
|
|
241 |
</div> |
|
5
|
242 |
<div id="podium-container"> |
|
|
243 |
<div id="podium"></div> |
|
|
244 |
<ul id="podium-chiffres"> |
|
|
245 |
</ul> |
|
|
246 |
<ul id="podium-labels"> |
|
|
247 |
</ul> |
|
|
248 |
</div> |
|
|
249 |
<div id="btv-tweet"> |
|
|
250 |
</div> |
|
3
|
251 |
</div> |
|
7
|
252 |
|
|
3
|
253 |
</body> |
|
|
254 |
</html> |