equal
deleted
inserted
replaced
14 |
14 |
15 IriSP.SegmentsWidget.prototype.draw = function() { |
15 IriSP.SegmentsWidget.prototype.draw = function() { |
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 var view = this._serializer._data.views[0]; |
19 |
20 |
|
21 /* in case we have different types of annotations, we want to display only the first type */ |
|
22 var view_type = ""; |
|
23 |
|
24 if(typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
|
25 view_type = view.annotation_types[0]; |
|
26 } |
|
27 |
20 this.selector.css("overflow", "auto"); // clear the floats - FIXME : to refactor ? |
28 this.selector.css("overflow", "auto"); // clear the floats - FIXME : to refactor ? |
21 this.selector.append(Mustache.to_html(IriSP.overlay_marker_template)); |
29 this.selector.append(Mustache.to_html(IriSP.overlay_marker_template)); |
22 |
30 |
23 this.positionMarker = this.selector.children(":first"); |
31 this.positionMarker = this.selector.children(":first"); |
24 |
32 |
27 this.selector.after("<div class='cleaner'></div>"); // we need to do this because the segments are floated |
35 this.selector.after("<div class='cleaner'></div>"); // we need to do this because the segments are floated |
28 |
36 |
29 var i = 0; |
37 var i = 0; |
30 var totalWidth = this.selector.width(); |
38 var totalWidth = this.selector.width(); |
31 var onePxPercent = 100 / totalWidth; /* the value of a pixel, in percents */ |
39 var onePxPercent = 100 / totalWidth; /* the value of a pixel, in percents */ |
32 |
40 |
33 for (i = 0; i < annotations.length; i++) { |
41 for (i = 0; i < annotations.length; i++) { |
34 var annotation = annotations[i]; |
42 var annotation = annotations[i]; |
|
43 |
|
44 /* filter the annotations whose type is not the one we want */ |
|
45 if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" |
|
46 && annotation.meta["id-ref"] != view_type) { |
|
47 continue; |
|
48 } |
35 |
49 |
36 var begin = Math.round((+ annotation.begin) / 1000); |
50 var begin = Math.round((+ annotation.begin) / 1000); |
37 var end = Math.round((+ annotation.end) / 1000); |
51 var end = Math.round((+ annotation.end) / 1000); |
38 var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000; |
52 var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000; |
39 var id = annotation.id; |
53 var id = annotation.id; |