diff -r d2005f747d5a -r a50aea26ec89 src/js/widgets/segmentsWidget.js --- a/src/js/widgets/segmentsWidget.js Tue Nov 22 17:22:15 2011 +0100 +++ b/src/js/widgets/segmentsWidget.js Tue Nov 22 17:22:50 2011 +0100 @@ -16,7 +16,15 @@ var self = this; var annotations = this._serializer._data.annotations; + var view = this._serializer._data.views[0]; + /* in case we have different types of annotations, we want to display only the first type */ + var view_type = ""; + + if(typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { + view_type = view.annotation_types[0]; + } + this.selector.css("overflow", "auto"); // clear the floats - FIXME : to refactor ? this.selector.append(Mustache.to_html(IriSP.overlay_marker_template)); @@ -29,10 +37,16 @@ var i = 0; var totalWidth = this.selector.width(); var onePxPercent = 100 / totalWidth; /* the value of a pixel, in percents */ - + for (i = 0; i < annotations.length; i++) { var annotation = annotations[i]; + /* filter the annotations whose type is not the one we want */ + if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" + && annotation.meta["id-ref"] != view_type) { + continue; + } + var begin = Math.round((+ annotation.begin) / 1000); var end = Math.round((+ annotation.end) / 1000); var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000; @@ -145,4 +159,4 @@ var position = ((time / duration) * 100).toFixed(2); this.positionMarker.css("left", position + "%"); -}; \ No newline at end of file +};