# HG changeset patch # User veltr # Date 1329821286 -3600 # Node ID e42d9f11f6e2530dc3c6648781fc6e43088d3729 # Parent dd7d86fbee700c5cc4bbd9b2c9f53bf60f85903d regexp clean + "countup" + changed podium maxsize diff -r dd7d86fbee70 -r e42d9f11f6e2 client/compteur.html --- 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; } @@ -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); });
-

Total des tweets #LGW

-

+

Total des Tweets

+

0

diff -r dd7d86fbee70 -r e42d9f11f6e2 client/css/controlpanel.css --- 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; } diff -r dd7d86fbee70 -r e42d9f11f6e2 client/css/main.css --- 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; diff -r dd7d86fbee70 -r e42d9f11f6e2 client/js/main.js --- 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( - '
  • ' - + _t.created_at.match(/\d+:\d+:\d+/)[0] - + ' @' - + _t.from_user - + ' ' - + _t.text - + '
  • ' + '
  • ' + + _t.created_at.match(/\d+:\d+:\d+/)[0] + + ' @' + + _t.from_user + + ' ' + + _t.text + + '
    ×
  • ' ); } } diff -r dd7d86fbee70 -r e42d9f11f6e2 client/js/podium.js --- 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 { diff -r dd7d86fbee70 -r e42d9f11f6e2 client/js/tweetsource.js --- 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() {