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