set onair time, podium improvements draft
authorveltr
Fri, 24 Feb 2012 17:46:20 +0100
changeset 44 02971f8dcaa5
parent 43 d63529bd67ad
child 45 49c818cf7c3a
set onair time, podium improvements
client/compteur.html
client/css/main.css
client/js/main.js
client/js/podium.js
client/js/tweetsource.js
client/main.html
--- a/client/compteur.html	Fri Feb 24 15:36:11 2012 +0100
+++ b/client/compteur.html	Fri Feb 24 17:46:20 2012 +0100
@@ -36,17 +36,11 @@
         <script type="text/javascript" src="js/podium.js"></script>
         <script type="text/javascript" src="js/tweetsource.js"></script>
         <script type="text/javascript">
-            /* Heure de début de l'émission
+            /* Heure de début de l'émission */
             var startHour = new Date("Feb 24 2012 23:30:00 UTC+0100"); 
-             * */
             
-            /* Heure de début du filage */
-            var startHour = new Date("Feb 24 2012 15:00:00 UTC+0100");
-            
-            /* Mots-clés pour déclencher la recherche
-            var searchKeywords = [ '#lgw', '#legrandwebze', 'webze' ]; 
-             * */
-            var searchKeywords = ['#lgwztest'];
+            /* Mots-clés pour déclencher la recherche */
+            var searchKeywords = [ '#lgw', '#legrandwebze', 'webze' ];
             
             var serverUrl = 'http://ftv.iri-research.org/a/';
             
--- a/client/css/main.css	Fri Feb 24 15:36:11 2012 +0100
+++ b/client/css/main.css	Fri Feb 24 17:46:20 2012 +0100
@@ -15,14 +15,14 @@
 #podium-labels {
     position: absolute;
     width: 100%;
-    top: 215px;
+    top: 212px;
 }
 #podium-labels li {
     float: left;
     width: 25%;
     color: #ffffff;
     text-align: center;
-    font-size: 42px;
+    font-size: 55px;
     font-weight: bold;
 }
 #podium-chiffres {
--- a/client/js/main.js	Fri Feb 24 15:36:11 2012 +0100
+++ b/client/js/main.js	Fri Feb 24 17:46:20 2012 +0100
@@ -147,12 +147,13 @@
         return 0;
     })
     setInterval(function() {
-        var _t = Math.floor((new Date() - startHour)/1000),
+        var _d = (new Date() - startHour),
+            _t = Math.abs(Math.floor(_d/1000)),
             _s = _t % 60,
             _m = Math.floor(_t/60) % 60,
             _h = Math.floor(_t/3600);
         $("#btv-cp-temps").html(
-            _h  + ':' + (_m < 10 ? '0' : '') + _m + ':' + (_s < 10 ? '0' : '') + _s
+            (_d < 0 ? '-' : '' ) + _h  + ':' + (_m < 10 ? '0' : '') + _m + ':' + (_s < 10 ? '0' : '') + _s
         )
     }, 500);
     myPodium = new Btv_Podium([0,0,0,0], { minHeight: 50 });
--- a/client/js/podium.js	Fri Feb 24 15:36:11 2012 +0100
+++ b/client/js/podium.js	Fri Feb 24 17:46:20 2012 +0100
@@ -21,21 +21,21 @@
     this.options.width = this.options.width || this._$.width();
     this.options.height = this.options.height || this._$.height();
     this.options.minHeight = this.options.minHeight || 0;
+    this.lastheights = [];
     this.update(data, true);
 }
 
 Btv_Podium.prototype.update = function(data, noAnimate) {
-    var _data = data || [],
-        _oldcount = this._$.children().length;
+    var _data = data || [];
     while (_data.length > this._$.children().length) {
         var _newCol = document.createElement("div");
         this.$(_newCol).css({
             "float": "left",
             "background": this.options.barBgd,
-            "margin-top": this.options.height,
             "width": 0,
             "height": 0,
-            "margin-left": 0
+            "margin-top": this.options.height,
+            "margin-left": 0,
         });
         this._$.append(_newCol);
     }
@@ -49,23 +49,31 @@
             _scale = (this.options.height - this.options.minHeight) / _max,
             _spacing = Math.min(this.options.spacing, Math.floor(.5*this.options.width/_data.length)),
             _width = Math.floor(( this.options.width - (_data.length - 1) * _spacing) / _data.length),
-            _this = this;
+            _this = this,
+            _heights = [];
         this._$.children().each(function(_i, _e) {
             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 = {},
+                _changed = false;
+            _heights.push(_height);
+            if (_data.length != _this.lastheights.length) {
                 _css["width"] = _width;
                 _css["margin-left"] = (_i ? _spacing : 0);
+                _changed = true;
             }
-            if (noAnimate) {
-                _this.$(_e).css(_css); 
-            } else {
-                _this.$(_e).animate(_css);
+            if (_i >= _data.length || _height != _this.lastheights[_i]) {
+                _css["height"] = _height;
+                _css["margin-top"] = _this.options.height - _height
+                _changed = true;
+            }
+            if (_changed) {
+                if (noAnimate) {
+                    _this.$(_e).css(_css); 
+                } else {
+                    _this.$(_e).animate(_css);
+                }
             }
         });
+        this.lastheights = _heights;
     }
 }
\ No newline at end of file
--- a/client/js/tweetsource.js	Fri Feb 24 15:36:11 2012 +0100
+++ b/client/js/tweetsource.js	Fri Feb 24 17:46:20 2012 +0100
@@ -216,7 +216,7 @@
     this.tweetArray = _tweetArray;
     this.majorInterval = 10000; // Time slices for calculating the minor Interval setting
     this.minimumInterval = 1000; // Safe limit to avoid tweets going to the wrong column
-    this.initialBuffer = 120000; // don't start with empty columns, but show the tweets of the last 120 seconds
+    this.initialBuffer = 300000; // don't start with empty columns, but show the tweets of the last five minutes - 5 * 60 * 1000 = 300000
     this.waitIfNoTweets = 2000;
     this.callback = _callback;
     this.lastEndTime = new Date().valueOf() - this.initialBuffer;
--- a/client/main.html	Fri Feb 24 15:36:11 2012 +0100
+++ b/client/main.html	Fri Feb 24 17:46:20 2012 +0100
@@ -18,17 +18,11 @@
         <script type="text/javascript" src="js/tweetsource.js"></script>
         <script type="text/javascript" src="js/main.js"></script>
         <script type="text/javascript">
-            /* Heure de début de l'émission
-            var startHour = new Date("Feb 24 2012 23:30:00 UTC+0100"); 
-             * */
+            /* Heure de début de l'émission */
+            var startHour = new Date("Feb 24 2012 23:30:00 UTC+0100");
             
-            /* Heure de début du filage */
-            var startHour = new Date("Feb 24 2012 15:00:00 UTC+0100");
-            
-            /* Mots-clés pour déclencher la recherche
+            /* Mots-clés pour déclencher la recherche */
             var searchKeywords = [ '#lgw', '#legrandwebze', 'webze' ]; 
-             * */
-            var searchKeywords = ['#lgwztest'];
             
             /* Mots-clés correspondant aux colonnes */
             var columnKeywords = [ '#ilReste', '#ilPart', '#cQui', '#change2ton' ];