| author | veltr |
| Mon, 26 Mar 2012 19:18:04 +0200 | |
| branch | popcorn-port |
| changeset 838 | 03b03865eb9b |
| parent 836 | 526f91f5253e |
| child 840 | ac66e2240e1e |
| permissions | -rw-r--r-- |
| 585 | 1 |
IriSP.AnnotationsListWidget = function(Popcorn, config, Serializer) { |
2 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
|
605
e1a6f73038b4
made the listWidget redraw at every timeupdate event (added a small optimization though,
hamidouk
parents:
603
diff
changeset
|
3 |
this.__counter = 0; |
|
e1a6f73038b4
made the listWidget redraw at every timeupdate event (added a small optimization though,
hamidouk
parents:
603
diff
changeset
|
4 |
this.__oldList = []; |
| 833 | 5 |
|
6 |
this.checkOption('ajax_mode'); |
|
7 |
this.checkOption('project_url'); |
|
8 |
this.checkOption('default_thumbnail'); |
|
9 |
this.checkOption("cinecast_version", false); |
|
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
10 |
this.searchRe = null; |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
11 |
this._ajax_cache = []; |
| 833 | 12 |
var _this = this; |
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
13 |
|
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
14 |
this._Popcorn.listen("IriSP.search", function(searchString) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
15 |
_this.searchHandler(searchString); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
16 |
}); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
17 |
this._Popcorn.listen("IriSP.search.closed", function() { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
18 |
_this.searchHandler(false); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
19 |
}); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
20 |
this._Popcorn.listen("IriSP.search.cleared", function() { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
21 |
_this.searchHandler(false); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
22 |
}); |
| 585 | 23 |
}; |
24 |
||
25 |
||
26 |
IriSP.AnnotationsListWidget.prototype = new IriSP.Widget(); |
|
27 |
||
28 |
IriSP.AnnotationsListWidget.prototype.clear = function() { |
|
29 |
}; |
|
30 |
||
| 588 | 31 |
IriSP.AnnotationsListWidget.prototype.clearWidget = function() { |
| 585 | 32 |
}; |
33 |
||
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
34 |
IriSP.AnnotationsListWidget.prototype.searchHandler = function(searchString) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
35 |
this.searchRe = (searchString && searchString.length) ? IriSP.regexpFromText(searchString) : null; |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
36 |
if (this.ajax_mode) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
37 |
var _this = this, |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
38 |
_annotations = ( |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
39 |
this.searchRe === null |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
40 |
? this._ajax_cache |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
41 |
: IriSP.underscore.filter(this._ajax_cache, function(_a) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
42 |
return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
43 |
}) |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
44 |
); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
45 |
this.do_redraw(_annotations); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
46 |
if (_annotations.length) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
47 |
this._Popcorn.trigger("IriSP.search.matchFound"); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
48 |
} else { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
49 |
this._Popcorn.trigger("IriSP.search.noMatchFound"); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
50 |
} |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
51 |
} else { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
52 |
this.drawList(); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
53 |
} |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
54 |
} |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
55 |
|
| 629 | 56 |
/** effectively redraw the widget - called by drawList */ |
57 |
IriSP.AnnotationsListWidget.prototype.do_redraw = function(list) { |
|
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
58 |
var _html = IriSP.templToHTML( |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
59 |
IriSP.annotationsListWidget_template, { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
60 |
annotations: list |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
61 |
}), |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
62 |
_this = this; |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
63 |
|
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
64 |
this.selector.html(_html); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
65 |
|
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
66 |
if (this.searchRe !== null) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
67 |
this.selector.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description") |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
68 |
.each(function() { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
69 |
var _$ = IriSP.jQuery(this); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
70 |
_$.html(_$.text().replace(_this.searchRe, '<span class="Ldt-AnnotationsList-highlight">$1</span>')) |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
71 |
}) |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
72 |
} |
| 629 | 73 |
}; |
74 |
||
| 833 | 75 |
IriSP.AnnotationsListWidget.prototype.transformAnnotation = function(a) { |
76 |
var _this = this |
|
77 |
return { |
|
78 |
"id" : a.id, |
|
79 |
"title": this.cinecast_version ? IriSP.get_aliased(a.meta, ['creator_name', 'creator']) : a.content.title, |
|
80 |
"desc" : this.cinecast_version ? a.content.data : a.content.description, |
|
81 |
"begin": IriSP.msToTime(a.begin), |
|
82 |
"end" : IriSP.msToTime(a.end), |
|
83 |
"thumbnail" : (typeof a.meta == "object" && typeof a.meta.thumbnail == "string") ? a.meta.thumbnail : this.default_thumbnail, |
|
84 |
"url" : (typeof a.meta == "object" && typeof a.meta.url == "string") ? a.meta.url : null, |
|
85 |
"tags": typeof a.tags == "object" |
|
86 |
? IriSP.underscore(a.tags) |
|
87 |
.chain() |
|
88 |
.map(function(_t) { |
|
89 |
if (typeof _t == "string") { |
|
90 |
return _t.replace(/^.*:/,'#'); |
|
91 |
} else { |
|
92 |
if (typeof _t['id-ref'] != "undefined") { |
|
93 |
var _f = IriSP.underscore.find(_this._serializer._data.tags, function(_tag) { |
|
94 |
return _tag['id-ref'] == _t.id; |
|
95 |
}); |
|
96 |
if (typeof _f != "undefined") { |
|
97 |
return IriSP.get_aliased(_f.meta, ['dc:title', 'title']); |
|
98 |
} |
|
99 |
} |
|
100 |
} |
|
101 |
return null; |
|
102 |
}) |
|
103 |
.filter(function(_t) { |
|
104 |
return _t !== null && _t !== "" |
|
105 |
}) |
|
106 |
.value() |
|
107 |
: [] |
|
108 |
} |
|
109 |
} |
|
110 |
||
| 599 | 111 |
/** draw the annotation list */ |
|
607
0b94ae49efbd
added an option to force the redraw of a list, even if the cached lists are the
hamidouk
parents:
605
diff
changeset
|
112 |
IriSP.AnnotationsListWidget.prototype.drawList = function(force_redraw) { |
| 585 | 113 |
var _this = this; |
| 674 | 114 |
|
| 833 | 115 |
// var view_type = this._serializer.getContributions(); |
| 585 | 116 |
var annotations = this._serializer._data.annotations; |
| 602 | 117 |
var currentTime = this._Popcorn.currentTime(); |
| 585 | 118 |
var list = []; |
| 588 | 119 |
|
| 833 | 120 |
/* if (typeof(view_type) === "undefined") { |
| 585 | 121 |
return; |
| 833 | 122 |
} */ |
| 585 | 123 |
for (i = 0; i < annotations.length; i++) { |
| 833 | 124 |
var obj = this.transformAnnotation(annotations[i]); |
125 |
obj.iterator = i; |
|
126 |
obj.distance = Math.abs((annotations[i].end + annotations[i].begin) / 2000 - currentTime); |
|
| 835 | 127 |
if (!this.cinecast_version || annotations[i].type == "cinecast:UserAnnotation") { |
128 |
list.push(obj); |
|
129 |
} |
|
130 |
|
|
| 585 | 131 |
} |
|
607
0b94ae49efbd
added an option to force the redraw of a list, even if the cached lists are the
hamidouk
parents:
605
diff
changeset
|
132 |
|
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
133 |
if (this.searchRe !== null) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
134 |
list = list.filter(function(_a) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
135 |
return (_this.searchRe.test(_a.desc) || _this.searchRe.test(_a.title)); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
136 |
}); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
137 |
if (list.length) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
138 |
this._Popcorn.trigger("IriSP.search.matchFound"); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
139 |
} else { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
140 |
this._Popcorn.trigger("IriSP.search.noMatchFound"); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
141 |
} |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
142 |
} |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
143 |
|
| 833 | 144 |
list = IriSP.underscore(list) |
145 |
.chain() |
|
146 |
.sortBy(function(_o) { |
|
147 |
return _o.distance; |
|
148 |
}) |
|
149 |
.first(10) |
|
150 |
.sortBy(function(_o) { |
|
151 |
return _o.iterator; |
|
152 |
}) |
|
153 |
.value(); |
|
154 |
|
|
|
605
e1a6f73038b4
made the listWidget redraw at every timeupdate event (added a small optimization though,
hamidouk
parents:
603
diff
changeset
|
155 |
var idList = IriSP.underscore.pluck(list, "id").sort(); |
| 642 | 156 |
|
|
605
e1a6f73038b4
made the listWidget redraw at every timeupdate event (added a small optimization though,
hamidouk
parents:
603
diff
changeset
|
157 |
|
| 833 | 158 |
if (!IriSP.underscore.isEqual(this.__oldList, idList) || typeof(force_redraw) !== "undefined") { |
| 629 | 159 |
this.do_redraw(list); |
| 833 | 160 |
this.__oldList = idList; |
|
607
0b94ae49efbd
added an option to force the redraw of a list, even if the cached lists are the
hamidouk
parents:
605
diff
changeset
|
161 |
} |
| 833 | 162 |
/* save for next call */ |
|
605
e1a6f73038b4
made the listWidget redraw at every timeupdate event (added a small optimization though,
hamidouk
parents:
603
diff
changeset
|
163 |
|
|
e1a6f73038b4
made the listWidget redraw at every timeupdate event (added a small optimization though,
hamidouk
parents:
603
diff
changeset
|
164 |
|
| 599 | 165 |
}; |
166 |
||
| 674 | 167 |
IriSP.AnnotationsListWidget.prototype.ajaxRedraw = function(timecode) { |
| 748 | 168 |
|
| 752 | 169 |
/* the seeked signal sometimes passes an argument - depending on if we're using |
170 |
our popcorn lookalike or the real thing - if it's the case, use it as it's |
|
171 |
more precise than currentTime which sometimes contains the place we where at */ |
|
172 |
if (IriSP.null_or_undefined(timecode) || typeof(timecode) != "number") { |
|
173 |
var tcode = this._Popcorn.currentTime(); |
|
174 |
} else { |
|
175 |
var tcode = timecode; |
|
176 |
} |
|
177 |
|
|
178 |
|
|
| 748 | 179 |
/* the platform gives us a special url - of the type : http://path/{media}/{begin}/{end} |
180 |
we double the braces using regexps and we feed it to mustache to build the correct url |
|
181 |
we have to do that because the platform only knows at run time what view it's displaying. |
|
182 |
*/ |
|
183 |
|
|
| 836 | 184 |
var platf_url = IriSP.widgetsDefaults.AnnotationsListWidget.ajax_url |
| 748 | 185 |
.replace(/\{/g, '{{').replace(/\}/g, '}}'); |
| 698 | 186 |
var media_id = this._serializer.currentMedia()["id"]; |
|
820
7968346b9689
Added compatibility with cinecast format (with get_aliased)
veltr
parents:
784
diff
changeset
|
187 |
var duration = this._serializer.getDuration(); |
| 698 | 188 |
|
| 752 | 189 |
var begin_timecode = (Math.floor(tcode) - 300) * 1000; |
| 698 | 190 |
if (begin_timecode < 0) |
191 |
begin_timecode = 0; |
|
192 |
|
|
| 752 | 193 |
var end_timecode = (Math.floor(tcode) + 300) * 1000; |
| 698 | 194 |
if (end_timecode > duration) |
195 |
end_timecode = duration; |
|
196 |
|
|
| 748 | 197 |
var templ = Mustache.to_html(platf_url, {media: media_id, begin: begin_timecode, |
198 |
end: end_timecode}); |
|
199 |
||
| 698 | 200 |
/* we create on the fly a serializer to get the ajax */ |
201 |
var serializer = new IriSP.JSONSerializer(IriSP.__dataloader, templ); |
|
| 833 | 202 |
serializer.sync(IriSP.wrap(this, function(json) { this.processJson(json, serializer) })); |
| 674 | 203 |
}; |
204 |
||
| 698 | 205 |
/** process the received json - it's a bit hackish */ |
206 |
IriSP.AnnotationsListWidget.prototype.processJson = function(json, serializer) { |
|
207 |
/* FIXME: DRY the whole thing */ |
|
208 |
var annotations = serializer._data.annotations; |
|
209 |
if (IriSP.null_or_undefined(annotations)) |
|
210 |
return; |
|
211 |
|
|
| 784 | 212 |
/* |
213 |
commented in case we wanted to discriminate against some annotation types. |
|
| 698 | 214 |
var view_types = serializer.getIds("Contributions"); |
| 784 | 215 |
*/ |
| 698 | 216 |
var l = []; |
217 |
|
|
|
714
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
218 |
var media = this._serializer.currentMedia()["id"]; |
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
219 |
|
| 698 | 220 |
for (i = 0; i < annotations.length; i++) { |
| 833 | 221 |
var obj = this.transformAnnotation(annotations[i]) |
| 836 | 222 |
if (typeof obj.url == "undefined" || !obj.url) { |
223 |
/* only if the annotation isn't present in the document create an |
|
224 |
external link */ |
|
225 |
if (!this.annotations_ids.indexOf(obj.id) != -1) { |
|
226 |
// braindead url; jacques didn't want to create a new one in the platform, |
|
227 |
// so we append the cutting id to the url. |
|
228 |
obj.url = this.project_url + "/" + media + "/" + |
|
229 |
annotations[i].meta.project + "/" + |
|
230 |
annotations[i].meta["id-ref"] + '#id=' + annotations[i].id; |
|
231 |
|
|
232 |
// obj.url = document.location.href.split("#")[0] + "/" + annotation.meta.project; |
|
233 |
} |
|
234 |
} |
|
| 716 | 235 |
l.push(obj); |
| 698 | 236 |
} |
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
237 |
this._ajax_cache = l; |
| 698 | 238 |
this.do_redraw(l); |
239 |
}; |
|
| 599 | 240 |
IriSP.AnnotationsListWidget.prototype.draw = function() { |
|
714
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
241 |
|
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
242 |
/* build a table of the annotations present in the document for faster |
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
243 |
lookup |
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
244 |
*/ |
| 833 | 245 |
this.annotations_ids = []; |
|
714
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
246 |
|
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
247 |
var annotations = this._serializer._data.annotations; |
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
248 |
var i = 0; |
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
249 |
for(i = 0; i < annotations.length; i++) { |
| 833 | 250 |
this.annotations_ids.push(annotations[i]["id"]); |
|
714
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
251 |
} |
|
9056928c46de
WIP - making links to only annotations which are not present in the opened
hamidouk
parents:
703
diff
changeset
|
252 |
|
| 833 | 253 |
var _this = this; |
| 674 | 254 |
|
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
255 |
if (!this.ajax_mode) { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
256 |
var _throttled = IriSP.underscore.throttle(function() { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
257 |
_this.drawList(); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
258 |
}, 1500); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
259 |
_throttled(); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
260 |
this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", _throttled); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
836
diff
changeset
|
261 |
this._Popcorn.listen("timeupdate", _throttled); |
| 674 | 262 |
} else { |
|
729
7ba63d0315ad
load the widget when the video has finished loading.
hamidouk
parents:
716
diff
changeset
|
263 |
/* update the widget when the video has finished loading and when it's seeked and paused */ |
| 698 | 264 |
this._Popcorn.listen("seeked", IriSP.wrap(this, this.ajaxRedraw)); |
|
729
7ba63d0315ad
load the widget when the video has finished loading.
hamidouk
parents:
716
diff
changeset
|
265 |
this._Popcorn.listen("loadedmetadata", IriSP.wrap(this, this.ajaxRedraw)); |
| 698 | 266 |
this._Popcorn.listen("paused", IriSP.wrap(this, this.ajaxRedraw)); |
|
730
357fc047503b
redraw the widget after that an annotation has been added.
hamidouk
parents:
729
diff
changeset
|
267 |
|
|
357fc047503b
redraw the widget after that an annotation has been added.
hamidouk
parents:
729
diff
changeset
|
268 |
this._Popcorn.listen("IriSP.createAnnotationWidget.addedAnnotation", IriSP.wrap(this, this.ajaxRedraw)); |
| 674 | 269 |
} |
| 698 | 270 |
|
| 585 | 271 |
}; |