|
98
|
1 |
IriSP.AnnotationsWidget = function(Popcorn, config, Serializer) { |
|
|
2 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
|
3 |
|
|
|
4 |
}; |
|
|
5 |
|
|
|
6 |
|
|
139
|
7 |
IriSP.AnnotationsWidget.prototype = new IriSP.Widget(); |
|
98
|
8 |
|
|
|
9 |
IriSP.AnnotationsWidget.prototype.clear = function() { |
|
162
|
10 |
this.selector.find(".Ldt-SaTitle").text(""); |
|
|
11 |
this.selector.find(".Ldt-SaDescription").text(""); |
|
|
12 |
this.selector.find(".Ldt-SaKeywordText").text(""); |
|
98
|
13 |
}; |
|
|
14 |
|
|
|
15 |
IriSP.AnnotationsWidget.prototype.displayAnnotation = function(annotation) { |
|
|
16 |
var title = annotation.content.title; |
|
|
17 |
var description = annotation.content.description; |
|
|
18 |
var keywords = "" // FIXME; |
|
|
19 |
var begin = +annotation.begin; |
|
|
20 |
var end = +annotation.end; |
|
|
21 |
var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
|
|
22 |
|
|
162
|
23 |
this.selector.find(".Ldt-SaTitle").text(title); |
|
|
24 |
this.selector.find(".Ldt-SaDescription").text(description); |
|
98
|
25 |
var startPourcent = parseInt(Math.round((begin*1+(end*1-begin*1)/2) / (duration*1)) / 100); |
|
162
|
26 |
this.selector.find(".Ldt-Show-Arrow").animate({left:startPourcent+'%'},1000); |
|
98
|
27 |
//IriSP.jQuery("#"+annotationTempo.id).animate({alpha:'100%'},1000); |
|
|
28 |
|
|
|
29 |
}; |
|
|
30 |
|
|
125
|
31 |
IriSP.AnnotationsWidget.prototype.clearWidget = function() { |
|
|
32 |
/* retract the pane between two annotations */ |
|
162
|
33 |
this.selector.find(".Ldt-SaTitle").text(""); |
|
|
34 |
this.selector.find(".Ldt-SaDescription").text(""); |
|
|
35 |
this.selector.find(".Ldt-SaKeywordText").html(""); |
|
|
36 |
this.selector.find(".Ldt-ShowAnnotation").slideUp(); |
|
130
|
37 |
}; |
|
|
38 |
|
|
98
|
39 |
IriSP.AnnotationsWidget.prototype.draw = function() { |
|
|
40 |
var _this = this; |
|
|
41 |
|
|
|
42 |
var annotationMarkup = Mustache.to_html(IriSP.annotationWidget_template, {"share_template" : IriSP.share_template}); |
|
162
|
43 |
this.selector.append(annotationMarkup); |
|
139
|
44 |
|
|
98
|
45 |
var annotations = this._serializer._data.annotations; |
|
146
|
46 |
var i; |
|
|
47 |
|
|
98
|
48 |
for (i in annotations) { |
|
|
49 |
var annotation = annotations[i]; |
|
|
50 |
var begin = Math.round((+ annotation.begin) / 1000); |
|
|
51 |
var end = Math.round((+ annotation.end) / 1000); |
|
|
52 |
|
|
125
|
53 |
var conf = {start: begin, end: end, |
|
|
54 |
onStart: |
|
|
55 |
function(annotation) { return function() { _this.displayAnnotation(annotation); } }(annotation), |
|
|
56 |
onEnd: |
|
|
57 |
function() { _this.clearWidget(); }, |
|
|
58 |
}; |
|
|
59 |
this._Popcorn = this._Popcorn.code(conf); |
|
98
|
60 |
} |
|
|
61 |
}; |