|
100
|
1 |
IriSP.SegmentsWidget = function(Popcorn, config, Serializer) { |
|
|
2 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
|
3 |
}; |
|
|
4 |
|
|
|
5 |
IriSP.SegmentsWidget.prototype = new IriSP.Widget; |
|
|
6 |
|
|
|
7 |
IriSP.SegmentsWidget.prototype.draw = function() { |
|
|
8 |
|
|
|
9 |
var annotations = this._serializer._data.annotations; |
|
|
10 |
|
|
|
11 |
for (i in annotations) { |
|
|
12 |
var annotation = annotations[i]; |
|
|
13 |
console.log(annotation); |
|
|
14 |
var begin = Math.round((+ annotation.begin) / 1000); |
|
|
15 |
var end = Math.round((+ annotation.end) / 1000); |
|
|
16 |
var duration = (annotation.end - annotation.begin); |
|
|
17 |
var id = annotation.id; |
|
|
18 |
var startPourcent = IriSP.timeToPourcent(begin, duration); |
|
|
19 |
var endPourcent = IriSP.timeToPourcent(end, duration) - startPourcent; |
|
|
20 |
var divTitle = annotation.content.title.substr(0,55); |
|
|
21 |
var color = annotation.content.color |
|
|
22 |
|
|
|
23 |
var annotationTemplate = Mustache.to_html(IriSP.annotation_template, |
|
|
24 |
{"divTitle" : divTitle, "id" : id, "startPourcent" : startPourcent, |
|
|
25 |
"endPourcent" : endPourcent, "hexa_color" : IriSP.DEC_HEXA_COLOR(color), |
|
|
26 |
"seekPlace" : Math.round(begin/1000)}); |
|
|
27 |
|
|
|
28 |
var toolTipTemplate = Mustache.to_html(IriSP.tooltip_template, |
|
|
29 |
{"title" : divTitle, "begin" : begin, "end" : end, |
|
|
30 |
"description": annotation.content.description}); |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
IriSP.jQuery("<div>" + annotationTemplate + "</div>").appendTo("#Ldt-Annotations"); |
|
|
34 |
// TOOLTIP BUG ! |
|
|
35 |
|
|
|
36 |
IriSP.jQuery("#" + id).tooltip({ effect: 'slide'}); |
|
|
37 |
|
|
|
38 |
IriSP.jQuery("#" + id).fadeTo(0,0.3); |
|
|
39 |
IriSP.jQuery("#" + id).mouseover(function() { |
|
|
40 |
IriSP.jQuery("#" + id).animate({opacity: 0.6}, 5); |
|
|
41 |
}).mouseout(function(){ |
|
|
42 |
IriSP.jQuery("#" + id).animate({opacity: 0.3}, 5); |
|
|
43 |
}); |
|
|
44 |
} |
|
|
45 |
}; |