src/js/widgets/segmentsWidget.js
branchpopcorn-port
changeset 210 7ab4ff32a19d
parent 164 d335ee5533c5
child 212 3a6e4089eef0
equal deleted inserted replaced
209:63501d879bce 210:7ab4ff32a19d
    16 
    16 
    17   var self = this;
    17   var self = this;
    18   var annotations = this._serializer._data.annotations;
    18   var annotations = this._serializer._data.annotations;
    19   //this.selector.attr("class", "Ldt-Segments");
    19   //this.selector.attr("class", "Ldt-Segments");
    20 
    20 
    21   //this.selector.append("<div style='position: absolute; z-index: 100; text-color: blue'>bfdgdfgsdfgsdgsdfgsdg</div>")
    21   //this.selector.append("<div style='position: absolute; z-index: 100; text-color: blue'></div>")
    22 
    22 
    23   var i = 0;
    23   var i = 0;
    24 
    24 
    25   for (i = 0; i < annotations.length; i++) {
    25   for (i = 0; i < annotations.length; i++) {
    26     var annotation = annotations[i];
    26     var annotation = annotations[i];
    59     });
    59     });
    60 
    60 
    61     IriSP.jQuery("#" + id).click(function(_this, annotation) {
    61     IriSP.jQuery("#" + id).click(function(_this, annotation) {
    62                                     return function() { _this.clickHandler(annotation)};
    62                                     return function() { _this.clickHandler(annotation)};
    63                                  }(this, annotation));
    63                                  }(this, annotation));
    64 
       
    65     // also add an handler to move the arrow.
       
    66     // FIXME: make it work - the arrow swings wildly atm.
       
    67     var middle = IriSP.timeToPourcent(begin + (end - begin)/ 2, duration);
       
    68     var arrow_div_width = IriSP.jQuery("#Ldt-Show-Arrow").width();
       
    69 
       
    70     var real_middle = middle - (middle * (1 - this.width/arrow_div_width));
       
    71     var conf = {start: begin, end: end,
       
    72                 onStart:
       
    73                        function(middle) {
       
    74                         return function() {
       
    75                           IriSP.jQuery("#Ldt-Show-Arrow").animate({left: real_middle + '%'}, 1000); }}(middle)
       
    76                 };
       
    77     this._Popcorn = this._Popcorn.code(conf);
       
    78   }
    64   }
    79 };
    65 };
    80 
    66 
    81 /* restores the view after a search */
    67 /* restores the view after a search */
    82 IriSP.SegmentsWidget.prototype.clear = function() {
    68 IriSP.SegmentsWidget.prototype.clear = function() {