src/js/widgets/sparklineWidget.js
branchpopcorn-port
changeset 835 a8af9da7c622
parent 834 573c7ca752e0
child 840 ac66e2240e1e
equal deleted inserted replaced
834:573c7ca752e0 835:a8af9da7c622
    17   }
    17   }
    18   this.selector.css("height", this.height + "px");
    18   this.selector.css("height", this.height + "px");
    19   if (this._config.background) {
    19   if (this._config.background) {
    20       this.selector.css("background", this._config.background);
    20       this.selector.css("background", this._config.background);
    21   }
    21   }
       
    22   this.checkOption('cinecast_version');
       
    23   console.log('Cinecast', this.cinecast_version);
    22 };
    24 };
    23 
    25 
    24 
    26 
    25 IriSP.SparklineWidget.prototype = new IriSP.Widget();
    27 IriSP.SparklineWidget.prototype = new IriSP.Widget();
    26 
    28 
    30 
    32 
    31 /** draw the sparkline using jquery sparkline */
    33 /** draw the sparkline using jquery sparkline */
    32 IriSP.SparklineWidget.prototype.draw = function() {
    34 IriSP.SparklineWidget.prototype.draw = function() {
    33     this.duration = this._serializer.getDuration();
    35     this.duration = this._serializer.getDuration();
    34     this.paper = new Raphael(this.selector[0], this.width, this.height);
    36     this.paper = new Raphael(this.selector[0], this.width, this.height);
       
    37     var _this = this;
    35   
    38   
    36   var views = this._serializer._data.views;
    39   var views = this._serializer._data.views;
    37   var stat_view;
    40   var stat_view;
    38   if (!IriSP.null_or_undefined(views)) {
    41   if (!IriSP.null_or_undefined(views)) {
    39     for (var i = 0; i < views.length; i++) {
    42     for (var i = 0; i < views.length; i++) {
    54     } else {
    57     } else {
    55         var _annotations = this._serializer._data.annotations,
    58         var _annotations = this._serializer._data.annotations,
    56             _sliceDuration = Math.floor( this.duration / this.slices),
    59             _sliceDuration = Math.floor( this.duration / this.slices),
    57             _results = _(_.range(this.slices)).map(function(_i) {
    60             _results = _(_.range(this.slices)).map(function(_i) {
    58                 return _(_annotations).filter(function(_a){
    61                 return _(_annotations).filter(function(_a){
    59                     return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration)
    62                     return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration) && (!_this.cinecast_version || _a.type == "cinecast:UserAnnotation")
    60                 }).length;
    63                 }).length;
    61             });
    64             });
    62     }
    65     }
    63     var _max = Math.max(1, _(_results).max()),
    66     var _max = Math.max(1, _(_results).max()),
    64         _h = this.height,
    67         _h = this.height,