Bugfix in Sparkline Widget
authorveltr
Wed, 11 Apr 2012 17:06:11 +0200
changeset 857 fa614dc66b0b
parent 855 1be5beb4b196
child 859 002a16ff171b
Bugfix in Sparkline Widget
src/js/defaults.js
src/js/widgets/sparklineWidget.js
--- a/src/js/defaults.js	Tue Apr 10 14:17:42 2012 +0200
+++ b/src/js/defaults.js	Wed Apr 11 17:06:11 2012 +0200
@@ -93,7 +93,8 @@
     "SparklineWidget" : {
        lineColor : "#7492b4",
        fillColor : "#aeaeb8",
-       lineWidth : 2
+       lineWidth : 2,
+       cinecast_version : false
     },
     "AnnotationsListWidget" : {
         ajax_mode : true, /* use ajax to get information about the annotations.
--- a/src/js/widgets/sparklineWidget.js	Tue Apr 10 14:17:42 2012 +0200
+++ b/src/js/widgets/sparklineWidget.js	Wed Apr 11 17:06:11 2012 +0200
@@ -50,8 +50,13 @@
         //console.log("sparklinewidget : using stats embedded in the json");
         var _results = stat_view.meta.stat.split(",");      
     } else {
-        var _annotations = this._serializer._data.annotations,
-            _sliceDuration = Math.floor( this.duration / this.slices),
+        var _annotations = this._serializer._data.annotations;
+        if (this.cinecast_version) {
+            _annotations = _(_annotations).filter(function(_a) {
+                return _a.type !== "cinecast:MovieExtract";
+            });
+        }
+        var _sliceDuration = Math.floor( this.duration / this.slices),
             _results = _(_.range(this.slices)).map(function(_i) {
                 return _(_annotations).filter(function(_a){
                     return (_a.begin <= (1 + _i) * _sliceDuration) && (_a.end >= _i * _sliceDuration)