src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 842 4ae2247a59f4
parent 836 526f91f5253e
equal deleted inserted replaced
841:8da49ff273e0 842:4ae2247a59f4
     7   // event handlers
     7   // event handlers
     8   this._Popcorn.listen("IriSP.search", function(searchString) { self.searchHandler.call(self, searchString); });
     8   this._Popcorn.listen("IriSP.search", function(searchString) { self.searchHandler.call(self, searchString); });
     9   this._Popcorn.listen("IriSP.search.closed", function() { self.searchFieldClosedHandler.call(self); });
     9   this._Popcorn.listen("IriSP.search.closed", function() { self.searchFieldClosedHandler.call(self); });
    10   this._Popcorn.listen("IriSP.search.cleared", function() { self.searchFieldClearedHandler.call(self); });
    10   this._Popcorn.listen("IriSP.search.cleared", function() { self.searchFieldClearedHandler.call(self); });
    11   
    11   
    12   this.checkOption("cinecast_version");
       
    13   this.defaultColors = ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"]
    12   this.defaultColors = ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"]
    14 };
    13 };
    15 
    14 
    16 IriSP.SegmentsWidget.prototype = new IriSP.Widget();
    15 IriSP.SegmentsWidget.prototype = new IriSP.Widget();
    17 
    16 
    24   this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));
    23   this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));
    25   
    24   
    26   this.positionMarker = this.selector.find(".Ldt-SegmentPositionMarker");
    25   this.positionMarker = this.selector.find(".Ldt-SegmentPositionMarker");
    27   
    26   
    28   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
    27   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
    29   var duration = this._serializer.getDuration();
    28   var duration = this.getDuration();
    30   
    29   
    31   if (this.cinecast_version) {
    30   if (this.cinecast_version) {
    32       var segments_annotations = IriSP.underscore.filter(
    31       var segments_annotations = IriSP.underscore.filter(
    33           this._serializer._data.annotations,
    32           this._serializer._data.annotations,
    34           function(_a) {
    33           function(_a) {
   191 IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() {
   190 IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() {
   192   this.clear();
   191   this.clear();
   193 };
   192 };
   194 
   193 
   195 IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
   194 IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
   196   var duration = this._serializer.getDuration() / 1000;
   195   var duration = this.getDuration() / 1000;
   197   var time = this._Popcorn.currentTime();
   196   var time = this._Popcorn.currentTime();
   198   //var position 	= ((time / duration) * 100).toFixed(2);
   197   //var position 	= ((time / duration) * 100).toFixed(2);
   199   var position 	= ((time / duration) * 100).toFixed(2);
   198   var position 	= ((time / duration) * 100).toFixed(2);
   200 
   199 
   201   this.positionMarker.css("left", position + "%");  
   200   this.positionMarker.css("left", position + "%");