--- a/client/compteur.html Mon Feb 20 17:44:20 2012 +0100
+++ b/client/compteur.html Tue Feb 21 11:48:06 2012 +0100
@@ -19,7 +19,7 @@
font-size: 24px;
}
h2 {
- font-size: 48px; font-weight: bold; margin: 20px 0;
+ font-size: 68px; font-weight: bold; margin: 2px 0;
}
</style>
@@ -41,6 +41,8 @@
* */
var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou'];
+ var totalTweets = 0;
+
$(function() {
myTweetSource = new Btv_TweetSource({
@@ -48,16 +50,26 @@
});
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>Total des Tweets</h1>
+ <h2 id="nbtweets">0</h2>
</div>
</body>
--- a/client/css/controlpanel.css Mon Feb 20 17:44:20 2012 +0100
+++ b/client/css/controlpanel.css Tue Feb 21 11:48:06 2012 +0100
@@ -54,6 +54,11 @@
.btv-cp-tweet-from {
font-weight: bold;
}
+
+.btv-cp-tweet-remove {
+ font-size: 16px; font-weight: bold; color: #a00000;
+}
+
.btv-cp-liste-tweets li:hover {
background: #00f; color: #fff;
}
--- a/client/css/main.css Mon Feb 20 17:44:20 2012 +0100
+++ b/client/css/main.css Tue Feb 21 11:48:06 2012 +0100
@@ -1,17 +1,17 @@
#podium-container {
position: absolute;
width: 1480px;
- top: 600px;
+ top: 700px;
left: 400px;
}
#podium {
width: 100%;
- height: 300px;
+ height: 200px;
}
#podium-labels {
position: absolute;
width: 100%;
- top: 320px;
+ top: 215px;
}
#podium-labels li {
float: left;
@@ -23,7 +23,7 @@
#podium-chiffres {
position: absolute;
width: 100%;
- top: 240px;
+ top: 145px;
}
#podium-chiffres li {
float: left;
--- a/client/js/main.js Mon Feb 20 17:44:20 2012 +0100
+++ b/client/js/main.js Tue Feb 21 11:48:06 2012 +0100
@@ -29,15 +29,15 @@
var _t = myTweetSource.tweetById(tweetId);
if (_t) {
$("#btv-cp-liste-tweets-selection").prepend(
- '<li onclick="showTweetOnScreen(\''
- + _t.id_str
- + '\'); return false;"><a title="Afficher sur l\'écran" href="#"><span class="btv-cp-tweet-date">'
- + _t.created_at.match(/\d+:\d+:\d+/)[0]
- + '</span> <span class="btv-cp-tweet-from">@'
- + _t.from_user
- + '</span> <span class="btv-cp-tweet-text">'
- + _t.text
- + '</span><div class="btv-cp-tweet-button btv-cp-tweet-show"></div></a></li>'
+ '<li><a title="Afficher sur l\'écran" href="#" onclick="showTweetOnScreen(\''
+ + _t.id_str
+ + '\'); return false;"><span class="btv-cp-tweet-date">'
+ + _t.created_at.match(/\d+:\d+:\d+/)[0]
+ + '</span> <span class="btv-cp-tweet-from">@'
+ + _t.from_user
+ + '</span> <span class="btv-cp-tweet-text">'
+ + _t.text
+ + '</span><div class="btv-cp-tweet-button btv-cp-tweet-show"></div></a><a class="btv-cp-tweet-remove" href="#" onclick="$(this).parent().detach(); return false;">×</a></li>'
);
}
}
--- a/client/js/podium.js Mon Feb 20 17:44:20 2012 +0100
+++ b/client/js/podium.js Tue Feb 21 11:48:06 2012 +0100
@@ -25,8 +25,8 @@
}
Btv_Podium.prototype.update = function(data, noAnimate) {
- var _data = data || [];
- var i = 0;
+ var _data = data || [],
+ _oldcount = this._$.children().length;
while (_data.length > this._$.children().length) {
var _newCol = document.createElement("div");
this.$(_newCol).css({
@@ -38,10 +38,6 @@
"margin-left": 0
});
this._$.append(_newCol);
- i++;
- if (i > 10) {
- break;
- }
}
while (_data.length < this._$.children().length) {
this._$.children().last().detach();
@@ -55,13 +51,16 @@
_width = Math.floor(( this.options.width - (_data.length - 1) * _spacing) / _data.length),
_this = this;
this._$.children().each(function(_i, _e) {
- var _height = _scale * _data[_i] + _this.options.minHeight,
- _css = {
- "margin-top": _this.options.height - _height,
- "height": _height,
- "width": _width,
- "margin-left": (_i ? _spacing : 0)
- }
+ var _height = Math.floor(_scale * _data[_i] + _this.options.minHeight),
+ _css = {};
+ if (_height != _this.$(_e).height()) {
+ _css["margin-top"] = _this.options.height - _height,
+ _css["height"] = _height
+ }
+ if (_data.length != _oldcount) {
+ _css["width"] = _width;
+ _css["margin-left"] = (_i ? _spacing : 0);
+ }
if (noAnimate) {
_this.$(_e).css(_css);
} else {
--- a/client/js/tweetsource.js Mon Feb 20 17:44:20 2012 +0100
+++ b/client/js/tweetsource.js Tue Feb 21 11:48:06 2012 +0100
@@ -5,7 +5,7 @@
* */
function regexpFromText(_text) {
- return new RegExp(_text.replace(/\W/gim,'\\$1'),'gim');
+ return new RegExp('(' + _text.replace(/\W/gim,'\\$1') + ')','gim');
}
Btv_TweetArray = function() {