161 } else { |
161 } else { |
162 this.$.hide(); |
162 this.$.hide(); |
163 this.hide(); |
163 this.hide(); |
164 } |
164 } |
165 |
165 |
166 this.bindPopcorn("IriSP.CreateAnnotation.toggle","toggle"); |
166 this.onMdpEvent("CreateAnnotation.toggle","toggle"); |
167 this.bindPopcorn("IriSP.Slice.boundsChanged","onBoundsChanged"); |
167 this.onMdpEvent("Slice.boundsChanged","onBoundsChanged"); |
168 this.begin = new IriSP.Model.Time(); |
168 this.begin = new IriSP.Model.Time(); |
169 this.end = this.source.getDuration(); |
169 this.end = this.source.getDuration(); |
170 this.$.find("form").submit(this.functionWrapper("onSubmit")); |
170 this.$.find("form").submit(this.functionWrapper("onSubmit")); |
171 } |
171 } |
172 |
172 |
186 this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666"); |
186 this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666"); |
187 } |
187 } |
188 this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected"); |
188 this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected"); |
189 this.$.slideDown(); |
189 this.$.slideDown(); |
190 if (this.minimize_annotation_widget) { |
190 if (this.minimize_annotation_widget) { |
191 this.player.popcorn.trigger("IriSP.Annotation.minimize"); |
191 this.player.trigger("Annotation.minimize"); |
192 } |
192 } |
193 this.player.popcorn.trigger("IriSP.Slice.show"); |
193 this.player.trigger("Slice.show"); |
194 } |
194 } |
195 |
195 |
196 IriSP.Widgets.CreateAnnotation.prototype.hide = function() { |
196 IriSP.Widgets.CreateAnnotation.prototype.hide = function() { |
197 if (!this.always_visible) { |
197 if (!this.always_visible) { |
198 this.visible = false; |
198 this.visible = false; |
199 this.$.slideUp(); |
199 this.$.slideUp(); |
200 if (this.minimize_annotation_widget) { |
200 if (this.minimize_annotation_widget) { |
201 this.player.popcorn.trigger("IriSP.Annotation.maximize"); |
201 this.player.trigger("Annotation.maximize"); |
202 } |
202 } |
203 this.player.popcorn.trigger("IriSP.Slice.hide"); |
203 this.player.trigger("Slice.hide"); |
204 } |
204 } |
205 } |
205 } |
206 |
206 |
207 IriSP.Widgets.CreateAnnotation.prototype.toggle = function() { |
207 IriSP.Widgets.CreateAnnotation.prototype.toggle = function() { |
208 if (!this.always_visible) { |
208 if (!this.always_visible) { |
232 _field.val(_contents.replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,'')); |
232 _field.val(_contents.replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,'')); |
233 this.onDescriptionChange(); |
233 this.onDescriptionChange(); |
234 } |
234 } |
235 |
235 |
236 IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() { |
236 IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() { |
237 if (this.pause_on_write && !this.player.popcorn.media.paused) { |
237 if (this.pause_on_write && !this.media.getPaused()) { |
238 this.player.popcorn.pause(); |
238 this.media.pause(); |
239 } |
239 } |
240 } |
240 } |
241 |
241 |
242 IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() { |
242 IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() { |
243 var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
243 var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
342 ); |
342 ); |
343 } |
343 } |
344 _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ |
344 _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ |
345 _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */ |
345 _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */ |
346 _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */ |
346 _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */ |
347 if (_this.pause_on_write && _this.player.popcorn.media.paused) { |
347 if (_this.pause_on_write && _this.media.getPaused()) { |
348 _this.player.popcorn.play(); |
348 _this.media.play(); |
349 } |
349 } |
350 _this.player.popcorn.trigger("IriSP.AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ |
350 _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ |
351 }, |
351 }, |
352 error: function(_xhr, _error, _thrown) { |
352 error: function(_xhr, _error, _thrown) { |
353 IriSP.log("Error when sending annotation", _thrown); |
353 IriSP.log("Error when sending annotation", _thrown); |
354 _export.getAnnotations().removeElement(_annotation, true); |
354 _export.getAnnotations().removeElement(_annotation, true); |
355 _this.showScreen('Error'); |
355 _this.showScreen('Error'); |