|
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() { |
|
|
10 |
IriSP.jQuery("#Ldt-SaTitle").text(""); |
|
|
11 |
IriSP.jQuery("#Ldt-SaDescription").text(""); |
|
|
12 |
IriSP.jQuery("#Ldt-SaKeywordText").text(""); |
|
|
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 |
|
|
|
23 |
IriSP.jQuery("#Ldt-SaTitle").text(title); |
|
|
24 |
IriSP.jQuery("#Ldt-SaDescription").text(description); |
|
|
25 |
IriSP.jQuery("#Ldt-SaKeywordText").text("Mots clefs : "+ keywords); |
|
|
26 |
var startPourcent = parseInt(Math.round((begin*1+(end*1-begin*1)/2) / (duration*1)) / 100); |
|
|
27 |
IriSP.jQuery("#Ldt-Show-Arrow").animate({left:startPourcent+'%'},1000); |
|
|
28 |
//IriSP.jQuery("#"+annotationTempo.id).animate({alpha:'100%'},1000); |
|
|
29 |
|
|
|
30 |
}; |
|
|
31 |
|
|
125
|
32 |
IriSP.AnnotationsWidget.prototype.clearWidget = function() { |
|
|
33 |
/* retract the pane between two annotations */ |
|
|
34 |
IriSP.jQuery("#Ldt-SaTitle").text(""); |
|
|
35 |
IriSP.jQuery("#Ldt-SaDescription").text(""); |
|
|
36 |
IriSP.jQuery("#Ldt-SaKeywordText").html(""); |
|
|
37 |
IriSP.jQuery('#Ldt-ShowAnnotation').slideUp(); |
|
130
|
38 |
}; |
|
|
39 |
|
|
98
|
40 |
IriSP.AnnotationsWidget.prototype.draw = function() { |
|
|
41 |
var _this = this; |
|
|
42 |
|
|
|
43 |
var annotationMarkup = Mustache.to_html(IriSP.annotationWidget_template, {"share_template" : IriSP.share_template}); |
|
|
44 |
IriSP.jQuery("#Ldt-Ligne").append(annotationMarkup); |
|
139
|
45 |
|
|
98
|
46 |
var annotations = this._serializer._data.annotations; |
|
|
47 |
for (i in annotations) { |
|
|
48 |
var annotation = annotations[i]; |
|
|
49 |
var begin = Math.round((+ annotation.begin) / 1000); |
|
|
50 |
var end = Math.round((+ annotation.end) / 1000); |
|
|
51 |
|
|
125
|
52 |
var conf = {start: begin, end: end, |
|
|
53 |
onStart: |
|
|
54 |
function(annotation) { return function() { _this.displayAnnotation(annotation); } }(annotation), |
|
|
55 |
onEnd: |
|
|
56 |
function() { _this.clearWidget(); }, |
|
|
57 |
}; |
|
|
58 |
this._Popcorn = this._Popcorn.code(conf); |
|
98
|
59 |
} |
|
|
60 |
}; |