| author | cavaliet |
| Thu, 02 Jan 2014 16:40:25 +0100 | |
| branch | new-model |
| changeset 1019 | 3ab36f402b0c |
| parent 927 | 977a39c4ee80 |
| child 1020 | 198c2b79f5e1 |
| permissions | -rw-r--r-- |
| 924 | 1 |
// TODO: Migrate Timeupdate functions to Extract |
| 876 | 2 |
|
3 |
IriSP.Widgets.Annotation = function(player, config) { |
|
4 |
IriSP.Widgets.Widget.call(this, player, config); |
|
5 |
this.lastAnnotation = false; |
|
| 923 | 6 |
this.minimized = this.start_minimized || false; |
7 |
this.bounds = [ 0, 0 ]; |
|
| 876 | 8 |
}; |
9 |
||
10 |
IriSP.Widgets.Annotation.prototype = new IriSP.Widgets.Widget(); |
|
11 |
||
12 |
IriSP.Widgets.Annotation.prototype.messages = { |
|
| 923 | 13 |
fr: { |
| 876 | 14 |
watching: "Je regarde ", |
15 |
on_site: " sur ", |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
16 |
tags_: "Mots-clés\u00a0:", |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
17 |
description_: "Description\u00a0:", |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
18 |
creator_: "Créé par\u00a0:", |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
19 |
excerpt_from: "Extrait de\u00a0:", |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
20 |
untitled: "Segment sans titre" |
| 876 | 21 |
}, |
| 923 | 22 |
en: { |
| 876 | 23 |
watching: "I'm watching ", |
24 |
on_site: " on ", |
|
| 923 | 25 |
tags_: "Keywords:", |
26 |
description_: "Description:", |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
27 |
creator_: "Created by\u00a0:", |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
28 |
excerpt_from: "Excerpt from:", |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
29 |
untitled: "Untitled segment" |
| 876 | 30 |
} |
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
31 |
}; |
| 876 | 32 |
|
33 |
IriSP.Widgets.Annotation.prototype.template = |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
34 |
'{{#show_arrow}}<div class="Ldt-Annotation-Arrow"></div>{{/show_arrow}}' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
35 |
+ '<div class="Ldt-Annotation-Widget {{^show_arrow}}Ldt-Annotation-ShowTop{{/show_arrow}}">' |
| 923 | 36 |
+ '<div class="Ldt-Annotation-Inner Ldt-Annotation-Empty{{#start_minimized}} Ldt-Annotation-Minimized{{/start_minimized}}">' |
37 |
+ '<div class="Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-MaxMinButton"></div>' |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
38 |
+ '{{#show_social}}<div class="Ldt-Annotation-Social Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty"></div>{{/show_social}}' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
39 |
+ '<h3 class="Ldt-Annotation-HiddenWhenEmpty">{{#show_annotation_type}}<span class="Ldt-Annotation-Type"></span> » {{/show_annotation_type}}<a class="Ldt-Annotation-Title" href="#"></a> <span class="Ldt-Annotation-Time Ldt-Annotation-HiddenWhenMinimized">' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
40 |
+ '(<span class="Ldt-Annotation-Begin"></span> - <span class="Ldt-Annotation-End"></span>)</span></h3>' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
41 |
+ '<h3 class="Ldt-Annotation-MashupOrigin Ldt-Annotation-HiddenWhenEmpty">{{l10n.excerpt_from}} <span class="Ldt-Annotation-MashupMedia"></span> <span class="Ldt-Annotation-Time Ldt-Annotation-HiddenWhenMinimized">' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
42 |
+ '(<span class="Ldt-Annotation-MashupBegin"></span> - <span class="Ldt-Annotation-MashupEnd"></span>)</span></h3>' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
43 |
+ '<div class="Ldt-Annotation-Cleared Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Creator-Block"><div class="Ldt-Annotation-Label">{{l10n.creator_}}</div>' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
44 |
+ '{{#show_creator}}<p class="Ldt-Annotation-Labelled Ldt-Annotation-Creator"></p></div>' |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
45 |
+ '<div class="Ldt-Annotation-Cleared Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Description-Block"><div class="Ldt-Annotation-Label">{{l10n.description_}}</div>{{/show_creator}}' |
| 923 | 46 |
+ '<p class="Ldt-Annotation-Labelled Ldt-Annotation-Description"></p></div>' |
47 |
+ '<div class="Ldt-Annotation-Tags-Block Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Cleared">' |
|
48 |
+ '<div class="Ldt-Annotation-Label">{{l10n.tags_}}</div><ul class="Ldt-Annotation-Labelled Ldt-Annotation-Tags"></ul>' |
|
| 924 | 49 |
+ '</div></div></div></div>'; |
| 876 | 50 |
|
51 |
IriSP.Widgets.Annotation.prototype.defaults = { |
|
52 |
annotation_type : "chap", |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
53 |
start_minimized: false, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
54 |
show_arrow : true, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
55 |
show_creator: true, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
56 |
arrow_position: .5, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
57 |
site_name : "Lignes de Temps", |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
58 |
search_on_tag_click: true, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
59 |
show_social: true, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
60 |
show_annotation_type: false |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
61 |
}; |
| 876 | 62 |
|
63 |
IriSP.Widgets.Annotation.prototype.draw = function() { |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
64 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
65 |
var _this = this, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
66 |
currentAnnotation; |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
67 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
68 |
function timeupdate(_time) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
69 |
var _list = _this.getWidgetAnnotationsAtTime(); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
70 |
if (!_list.length) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
71 |
_this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
72 |
if (_this.arrow) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
73 |
_this.arrow.moveToTime(_time); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
74 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
75 |
_this.bounds = [ _time, _time ]; |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
76 |
_this.sendBounds(); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
77 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
78 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
79 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
80 |
function highlightTitleAndDescription() { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
81 |
if (!currentAnnotation) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
82 |
return; |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
83 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
84 |
var title = currentAnnotation.title, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
85 |
description = currentAnnotation.description.replace(/(^\s+|\s+$)/g,''), |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
86 |
rx = (currentAnnotation.found ? (_this.source.getAnnotations().regexp || false) : false); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
87 |
_this.$.find(".Ldt-Annotation-Title").html(IriSP.textFieldHtml(title,rx) || "(" + _this.l10n.untitled + ")"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
88 |
if (description) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
89 |
_this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
90 |
_this.$.find(".Ldt-Annotation-Description").html(IriSP.textFieldHtml(description,rx)); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
91 |
} else { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
92 |
_this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
93 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
94 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
95 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
96 |
function drawAnnotation(_annotation) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
97 |
currentAnnotation = _annotation; |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
98 |
var _url = (typeof _annotation.url !== "undefined" |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
99 |
? _annotation.url |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
100 |
: (document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id)), |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
101 |
_text = _this.l10n.watching + _annotation.title + (_this.site_name ? _this.l10n.on_site + _this.site_name : ''), |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
102 |
_tags = _annotation.getTags(), |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
103 |
_tagblock = _this.$.find(".Ldt-Annotation-Tags"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
104 |
_tagblock.empty(); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
105 |
if (_tags.length) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
106 |
_this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
107 |
_tags.forEach(function(_tag) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
108 |
var _trimmedTitle = _tag.title.replace(/(^\s+|\s+$)/g,''); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
109 |
if (_trimmedTitle) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
110 |
var _el = IriSP.jQuery('<li class="Ldt-Annotation-TagLabel"></li>').append(IriSP.jQuery('<span>').text(_trimmedTitle)); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
111 |
_el.click(function() { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
112 |
if (_this.search_on_tag_click) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
113 |
_this.source.getAnnotations().search(_trimmedTitle); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
114 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
115 |
_tag.trigger("click"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
116 |
}); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
117 |
_tagblock.append(_el); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
118 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
119 |
}); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
120 |
} else { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
121 |
_this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
122 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
123 |
highlightTitleAndDescription(); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
124 |
if (_this.show_creator) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
125 |
_this.$.find(".Ldt-Annotation-Creator").text(_annotation.creator); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
126 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
127 |
if (_this.show_annotation_type) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
128 |
_this.$.find(".Ldt-Annotation-Type").text(_annotation.getAnnotationType().title); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
129 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
130 |
_this.$.find(".Ldt-Annotation-Begin").text(_annotation.begin.toString()); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
131 |
_this.$.find(".Ldt-Annotation-End").text(_annotation.end.toString()); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
132 |
if (_annotation.elementType === "mashedAnnotation") { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
133 |
_this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
134 |
_this.$.find(".Ldt-Annotation-MashupMedia").text(_annotation.getMedia().title); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
135 |
_this.$.find(".Ldt-Annotation-MashupBegin").text(_annotation.annotation.begin.toString()); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
136 |
_this.$.find(".Ldt-Annotation-MashupEnd").text(_annotation.annotation.end.toString()); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
137 |
} else { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
138 |
_this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
139 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
140 |
if (typeof _this.socialWidget !== "undefined") { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
141 |
_this.socialWidget.updateUrls(_url, _text); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
142 |
} else { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
143 |
setTimeout(function() { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
144 |
if (typeof _this.socialWidget !== "undefined") { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
145 |
_this.socialWidget.updateUrls(_url, _text); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
146 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
147 |
},800); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
148 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
149 |
_this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
150 |
_this.bounds = [ _annotation.begin, _annotation.end ]; |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
151 |
if (_this.arrow) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
152 |
_this.arrow.moveToTime((1 - _this.arrow_position) * _annotation.begin + _this.arrow_position * _annotation.end); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
153 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
154 |
_this.sendBounds(); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
155 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
156 |
|
| 876 | 157 |
this.renderTemplate(); |
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
158 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
159 |
this.$.find(".Ldt-Annotation-Title").click(function() { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
160 |
if (currentAnnotation) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
161 |
_this.media.setCurrentTime(currentAnnotation.begin); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
162 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
163 |
return false; |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
164 |
}); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
165 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
166 |
if (this.show_social) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
167 |
this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
168 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
169 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
170 |
if (this.show_arrow) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
171 |
this.insertSubwidget(this.$.find(".Ldt-Annotation-Arrow"), { type: "Arrow", width: this.width }, "arrow"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
172 |
} |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
173 |
this.onMediaEvent("timeupdate",timeupdate); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
174 |
this.onMdpEvent("Annotation.hide","hide"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
175 |
this.onMdpEvent("Annotation.show","show"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
176 |
this.onMdpEvent("Annotation.minimize","minimize"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
177 |
this.onMdpEvent("Annotation.maximize","maximize"); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
178 |
this.onMdpEvent("Annotation.getBounds","sendBounds"); |
| 923 | 179 |
this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize")); |
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
180 |
this.getWidgetAnnotations().forEach(function(_a) { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
181 |
_a.on("enter", function() { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
182 |
drawAnnotation(_a); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
183 |
}); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
184 |
}); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
185 |
this.source.getAnnotations().on("found", highlightTitleAndDescription); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
186 |
this.source.getAnnotations().on("not-found", highlightTitleAndDescription); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
187 |
this.source.getAnnotations().on("search-cleared", highlightTitleAndDescription); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
188 |
IriSP.attachDndData(this.$.find("h3"), function() { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
189 |
return { |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
190 |
title: currentAnnotation.title, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
191 |
description: currentAnnotation.description, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
192 |
image: currentAnnotation.thumbnail, |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
193 |
uri: (typeof currentAnnotation.url !== "undefined" |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
194 |
? currentAnnotation.url |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
195 |
: (document.location.href.replace(/#.*$/,'') + '#id=' + currentAnnotation.id)) |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
196 |
}; |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
197 |
}); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
198 |
}; |
| 923 | 199 |
|
200 |
IriSP.Widgets.Annotation.prototype.sendBounds = function() { |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
201 |
this.player.trigger("Annotation.boundsChanged",this.bounds); |
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
202 |
}; |
| 876 | 203 |
|
204 |
IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) { |
|
205 |
this.lastAnnotation = _annotation.id; |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
206 |
|
|
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
207 |
}; |
| 880 | 208 |
|
209 |
IriSP.Widgets.Annotation.prototype.hide = function() { |
|
210 |
this.$.slideUp(); |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
211 |
}; |
| 880 | 212 |
|
213 |
IriSP.Widgets.Annotation.prototype.show = function() { |
|
214 |
this.$.slideDown(); |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
215 |
}; |
| 880 | 216 |
|
| 923 | 217 |
IriSP.Widgets.Annotation.prototype.toggleSize = function() { |
218 |
if (this.minimized) { |
|
219 |
this.maximize(); |
|
220 |
} else { |
|
221 |
this.minimize(); |
|
222 |
} |
|
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
223 |
}; |
| 923 | 224 |
|
| 880 | 225 |
IriSP.Widgets.Annotation.prototype.minimize = function() { |
| 923 | 226 |
this.minimized = true; |
| 880 | 227 |
this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-Minimized"); |
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
228 |
}; |
| 880 | 229 |
|
230 |
IriSP.Widgets.Annotation.prototype.maximize = function() { |
|
| 923 | 231 |
this.minimized = false; |
| 880 | 232 |
this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-Minimized"); |
|
1019
3ab36f402b0c
update widgets after enhance in annotation platform.
cavaliet
parents:
927
diff
changeset
|
233 |
}; |