From a02a90cfc5b5d93c50852c07900a706abdbd1c6d Mon Sep 17 00:00:00 2001 From: riccardo Date: Wed, 9 Feb 2011 19:56:47 +0100 Subject: [PATCH] Added and fixed comunication with server (no more server errors). To be fixed: 1) more markers than those saved (seem to be duplicated copies) are displayed, 2) an error during page initialization (clash with old code player.resize) 3) proper css (markers on a separate hidden div) --- telemeta/htdocs/timeside/src/controller.js | 174 +++++---------------- telemeta/htdocs/timeside/src/markermap.js | 162 +++++++++++++------ telemeta/htdocs/timeside/src/player.js | 2 +- 3 files changed, 157 insertions(+), 181 deletions(-) diff --git a/telemeta/htdocs/timeside/src/controller.js b/telemeta/htdocs/timeside/src/controller.js index ff056256..56f6b4d2 100644 --- a/telemeta/htdocs/timeside/src/controller.js +++ b/telemeta/htdocs/timeside/src/controller.js @@ -14,16 +14,19 @@ TimeSide(function($N) { this.configure(cfg, { player: null, soundProvider: null, - map: null, - markersDiv: document.getElementById("markers_div_id") + map: null }); - if (this.cfg.player && !$N.isInstanceOf(this.cfg.player, 'Player')) { - this.cfg.player = new $N.Player(this.cfg.player); - } - this._setupPlayer(); +// if (this.cfg.player && !$N.isInstanceOf(this.cfg.player, 'Player')) { +// this.cfg.player = new $N.Player(this.cfg.player); +// } + //this._setupPlayer(); + this.loadHTTP(); }, _setupPlayer: function() { + if (this.cfg.player && !$N.isInstanceOf(this.cfg.player, 'Player')) { + this.cfg.player = new $N.Player(this.cfg.player); + } this.attach(this.updateMarkersDiv); this.cfg.player .setSoundProvider(this.cfg.soundProvider) @@ -43,124 +46,26 @@ TimeSide(function($N) { this.cfg.soundProvider.seek(data.offset); }, - formatMarkerOffset: function(markerOffset){ - //marker offset is in float format second.decimalPart - var hours = parseInt(markerOffset/(60*24)); - markerOffset-=hours*(60*24); - var minutes = parseInt(markerOffset/(60)); - markerOffset-=minutes*(60); - var seconds = parseInt(markerOffset); - markerOffset-=seconds; - var msec = Math.round(markerOffset*100); //show only centiseconds - //(use 1000* to show milliseconds) - var format = (hours<10 ? "0"+hours : hours )+":"+ - (minutes<10 ? "0"+minutes : minutes )+":"+ - (seconds<10 ? "0"+seconds : seconds )+"."+ - msec; - return format; - }, + _onMarkerMove: function(e, data) { if (this.cfg.map) { - this.refreshMarkersText(this.cfg.map); + //this.refreshMarkersText(this.cfg.map); this.cfg.map.move(this.cfg.map.byId(data.id), data.offset); - this.updateMarkersDiv(this.cfg.map, data.offset); + //this.updateMarkersDiv(this.cfg.map, data.offset); } }, _onMarkerAdd: function(e, data) { if (this.cfg.map) { - this.refreshMarkersText(this.cfg.map); + //this.refreshMarkersText(this.cfg.map); this.cfg.map.add(data.offset, ''); - this.updateMarkersDiv(this.cfg.map, data.offset); + //this.updateMarkersDiv(this.cfg.map, data.offset); } }, - - refreshMarkersText: function(nonNullMarkersMap){ - var div = this.cfg.markersDiv; - var m = nonNullMarkersMap.markers; - var l = m.length; - if(div){ - var divChildren = div.childNodes; - for(var i=0; i') + .css({ + color:'#fff', + backgroundColor:'#009', + width: '2ex', + textAlign: 'center', + fontFamily: 'monospace' + }) + .html(i+1); + + var timeSpan = $J('') + .css({ + marginLeft:'1ex' + }); + + + var header = $J('
') + .append(label) + .append(timeSpan); + + text = $J('