41 IriSP.AnnotationsWidget.prototype.draw = function() { |
41 IriSP.AnnotationsWidget.prototype.draw = function() { |
42 var _this = this; |
42 var _this = this; |
43 |
43 |
44 var annotationMarkup = IriSP.templToHTML(IriSP.annotationWidget_template); |
44 var annotationMarkup = IriSP.templToHTML(IriSP.annotationWidget_template); |
45 this.selector.append(annotationMarkup); |
45 this.selector.append(annotationMarkup); |
|
46 var view; |
46 |
47 |
|
48 if (typeof(this._serializer._data.views) !== "undefined" && this._serializer._data.views !== null) |
|
49 view = this._serializer._data.views[0]; |
|
50 |
|
51 var view_type = ""; |
|
52 |
|
53 if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
|
54 view_type = view.annotation_types[0]; |
|
55 } |
|
56 |
47 var annotations = this._serializer._data.annotations; |
57 var annotations = this._serializer._data.annotations; |
48 var i; |
58 var i; |
49 |
59 |
50 for (i in annotations) { |
60 for (i in annotations) { |
51 var annotation = annotations[i]; |
61 var annotation = annotations[i]; |
52 var begin = Math.round((+ annotation.begin) / 1000); |
62 var begin = Math.round((+ annotation.begin) / 1000); |
53 var end = Math.round((+ annotation.end) / 1000); |
63 var end = Math.round((+ annotation.end) / 1000); |
54 |
64 |
|
65 if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" |
|
66 && annotation.meta["id-ref"] != view_type) { |
|
67 continue; |
|
68 } |
|
69 |
|
70 |
55 var conf = {start: begin, end: end, |
71 var conf = {start: begin, end: end, |
56 onStart: |
72 onStart: |
57 function(annotation) { |
73 function(annotation) { |
58 return function() { |
74 return function() { |
59 /* we need it because we have to restore |
75 _this.displayAnnotation(annotation); |
60 the display after displaying the contents |
|
61 of a tweet. |
|
62 */ |
|
63 _this._currentAnnotation = annotation; |
|
64 _this.displayAnnotation(annotation); |
|
65 |
76 |
66 } }(annotation), |
77 } }(annotation), |
67 onEnd: |
78 onEnd: |
68 function() { _this.clearWidget.call(_this); }, |
79 function() { _this.clearWidget.call(_this); }, |
69 }; |
80 }; |