| author | veltr |
| Fri, 29 Jun 2012 16:22:52 +0200 | |
| branch | new-model |
| changeset 923 | b3ee7d1b472a |
| parent 916 | ec6849bbbdcc |
| child 924 | 64c2eaafe5e2 |
| permissions | -rw-r--r-- |
| 923 | 1 |
/* TODO: Add Social Network Sharing, Finish Current Timecode Sync & Arrow Takeover */ |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
2 |
|
| 880 | 3 |
IriSP.Widgets.CreateAnnotation = function(player, config) { |
4 |
IriSP.Widgets.Widget.call(this, player, config); |
|
5 |
}; |
|
6 |
||
7 |
IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget(); |
|
8 |
||
9 |
IriSP.Widgets.CreateAnnotation.prototype.defaults = { |
|
| 923 | 10 |
show_title_field : false, /* For the moment, titles can't be sent to ldtplatform */ |
11 |
show_creator_field : true, |
|
12 |
start_visible : true, |
|
13 |
always_visible : true, |
|
14 |
sync_on_slice_widget : true, /* If false, syncs on current timecode */ |
|
15 |
takeover_arrow : false, |
|
16 |
minimize_annotation_widget : false, |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
17 |
creator_name : "", |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
18 |
creator_avatar : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", |
| 904 | 19 |
tags : false, |
| 923 | 20 |
pause_on_write : true, |
| 904 | 21 |
max_tags : 8, |
22 |
polemics : [{ |
|
23 |
keyword: "++", |
|
24 |
background_color: "#00a000", |
|
25 |
text_color: "#ffffff" |
|
26 |
},{ |
|
27 |
keyword: "--", |
|
28 |
background_color: "#c00000", |
|
29 |
text_color: "#ffffff" |
|
30 |
},{ |
|
31 |
keyword: "??", |
|
32 |
background_color: "#0000e0", |
|
33 |
text_color: "#ffffff" |
|
34 |
},{ |
|
35 |
keyword: "==", |
|
36 |
background_color: "#f0e000", |
|
37 |
text_color: "#000000" |
|
38 |
}], |
|
39 |
annotation_type: "Contributions", |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
40 |
api_serializer: "ldt_annotate", |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
41 |
api_endpoint_template: "", |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
42 |
api_method: "PUT", |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
43 |
close_widget_timeout: 0 |
| 880 | 44 |
} |
45 |
||
46 |
IriSP.Widgets.CreateAnnotation.prototype.messages = { |
|
| 882 | 47 |
en: { |
48 |
from_time: "from", |
|
49 |
to_time: "to", |
|
| 923 | 50 |
at_time: "at", |
| 882 | 51 |
submit: "Submit", |
| 904 | 52 |
add_keywords_: "Add keywords:", |
53 |
add_polemic_keywords_: "Add polemic keywords:", |
|
| 923 | 54 |
your_name_: "Your name:", |
| 882 | 55 |
no_title: "Annotate this video", |
56 |
type_title: "Annotation title", |
|
57 |
type_description: "Type the full description of your annotation here.", |
|
58 |
wait_while_processing: "Please wait while your request is being processed...", |
|
59 |
error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.", |
|
60 |
empty_annotation: "Your annotation is empty. Please write something before submitting.", |
|
61 |
annotation_saved: "Thank you, your annotation has been saved.", |
|
62 |
share_annotation: "Would you like to share it on social networks ?", |
|
63 |
share_on: "Share on", |
|
64 |
more_tags: "More tags", |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
65 |
cancel: "Cancel", |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
66 |
close_widget: "Cacher la zone de création d'annotations" |
| 880 | 67 |
}, |
| 882 | 68 |
fr: { |
| 904 | 69 |
from_time: "de", |
| 882 | 70 |
to_time: "Ã ", |
| 923 | 71 |
at_time: "Ã ", |
| 882 | 72 |
submit: "Envoyer", |
| 904 | 73 |
add_keywords_: "Ajouter des mots-clés :", |
74 |
add_polemic_keywords_: "Ajouter des mots-clés polémiques :", |
|
| 923 | 75 |
your_name_: "Votre nom :", |
| 882 | 76 |
no_title: "Annoter cette vidéo", |
77 |
type_title: "Titre de l'annotation", |
|
78 |
type_description: "Rédigez le contenu de votre annotation ici.", |
|
79 |
wait_while_processing: "Veuillez patienter pendant le traitement de votre requête...", |
|
80 |
error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée", |
|
81 |
empty_annotation: "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.", |
|
82 |
annotation_saved: "Merci, votre annotation a été enregistrée.", |
|
83 |
share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?", |
|
84 |
share_on: "Partager sur", |
|
85 |
more_tags: "Plus de mots-clés", |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
86 |
cancel: "Cancel", |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
87 |
close_widget: "Hide the annotation creating block" |
| 880 | 88 |
} |
89 |
} |
|
90 |
||
91 |
IriSP.Widgets.CreateAnnotation.prototype.template = |
|
| 881 | 92 |
'<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
93 |
+ '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
|
94 |
+ '<h3>{{#show_title_field}}<input class="Ldt-CreateAnnotation-Title" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
|
| 904 | 95 |
+ '{{^show_title_field}}<span class="Ldt-CreateAnnotation-NoTitle">{{l10n.no_title}} </span>{{/show_title_field}}' |
| 923 | 96 |
+ ' <span class="Ldt-CreateAnnotation-Times">{{#sync_on_slice_widget}}{{l10n.from_time}} {{/sync_on_slice_widget}}{{^sync_on_slice_widget}}{{l10n.at_time}} {{/sync_on_slice_widget}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>' |
97 |
+ '{{#sync_on_slice_widget}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">00:00</span>{{/sync_on_slice_widget}}</span></h3>' |
|
98 |
+ '{{#show_creator_field}}<h3>{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator" value="{{creator_name}}" /></h3>{{/show_creator_field}}' |
|
| 904 | 99 |
+ '<textarea class="Ldt-CreateAnnotation-Description" placeholder="{{l10n.type_description}}"></textarea>' |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
100 |
+ '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>' |
| 904 | 101 |
+ '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />' |
102 |
+ '{{#tags.length}}<div class="Ldt-CreateAnnotation-Tags"><div class="Ldt-CreateAnnotation-TagTitle">{{l10n.add_keywords_}}</div><ul class="Ldt-CreateAnnotation-TagList">' |
|
103 |
+ '{{#tags}}<li class="Ldt-CreateAnnotation-TagLi" tag-id="{{id}}"><span class="Ldt-CreateAnnotation-TagButton">{{title}}</span></li>{{/tags}}</ul></div>{{/tags.length}}' |
|
104 |
+ '{{#polemics.length}}<div class="Ldt-CreateAnnotation-Polemics"><div class="Ldt-CreateAnnotation-PolemicTitle">{{l10n.add_polemic_keywords_}}</div><ul class="Ldt-CreateAnnotation-PolemicList">' |
|
105 |
+ '{{#polemics}}<li class="Ldt-CreateAnnotation-PolemicLi" style="background-color: {{background_color}}; color: {{text_color}}">{{keyword}}</li>{{/polemics}}</ul></div>{{/polemics.length}}' |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
106 |
+ '<div style="clear: both;"></div></form>' |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
107 |
+ '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Wait"><div class="Ldt-CreateAnnotation-InnerBox">{{l10n.wait_while_processing}}</div></div>' |
| 923 | 108 |
+ '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Error">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.error_while_contacting}}</div></div>' |
109 |
+ '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Saved">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.annotation_saved}}</div></div>' |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
110 |
+ '</div></div>'; |
| 880 | 111 |
|
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
112 |
IriSP.Widgets.CreateAnnotation.prototype.draw = function() { |
| 904 | 113 |
if (!this.tags) { |
114 |
this.tags = this.source.getTags() |
|
115 |
.sortBy(function (_tag) { |
|
116 |
return -_tag.getAnnotations().length; |
|
117 |
}) |
|
118 |
.slice(0, this.max_tags) |
|
119 |
.map(function(_tag) { |
|
120 |
return _tag; |
|
121 |
}); |
|
122 |
// We have to use the map function because Mustache doesn't like our tags object |
|
123 |
} |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
124 |
var _this = this; |
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
125 |
this.renderTemplate(); |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
126 |
this.$.find(".Ldt-CreateAnnotation-Close").click(function() { |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
127 |
_this.hide(); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
128 |
return false; |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
129 |
}); |
| 904 | 130 |
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").click(function() { |
131 |
_this.addKeyword(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); |
|
132 |
return false; |
|
133 |
}); |
|
134 |
this.$.find(".Ldt-CreateAnnotation-Description").bind("change keyup input paste", this.functionWrapper("onDescriptionChange")); |
|
135 |
if (this.show_title_field) { |
|
136 |
this.$.find(".Ldt-CreateAnnotation-Title").bind("change keyup input paste", this.functionWrapper("onTitleChange")); |
|
137 |
} |
|
| 923 | 138 |
if (this.show_creator_field) { |
139 |
this.$.find(".Ldt-CreateAnnotation-Creator").bind("change keyup input paste", this.functionWrapper("onCreatorChange")); |
|
140 |
} |
|
| 904 | 141 |
|
| 923 | 142 |
if (this.start_visible) { |
143 |
this.show(); |
|
144 |
} else { |
|
145 |
this.$.hide(); |
|
146 |
this.hide(); |
|
147 |
} |
|
148 |
|
|
| 904 | 149 |
this.bindPopcorn("IriSP.CreateAnnotation.toggle","toggle"); |
150 |
this.bindPopcorn("IriSP.Slice.boundsChanged","onBoundsChanged"); |
|
151 |
this.begin = new IriSP.Model.Time(); |
|
152 |
this.end = this.source.getDuration(); |
|
153 |
this.$.find("form").submit(this.functionWrapper("onSubmit")); |
|
154 |
} |
|
155 |
||
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
156 |
IriSP.Widgets.CreateAnnotation.prototype.showScreen = function(_screenName) { |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
157 |
this.$.find('.Ldt-CreateAnnotation-' + _screenName).show() |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
158 |
.siblings().hide(); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
159 |
} |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
160 |
|
| 904 | 161 |
IriSP.Widgets.CreateAnnotation.prototype.show = function() { |
162 |
this.visible = true; |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
163 |
this.showScreen('Main'); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
164 |
this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666"); |
| 923 | 165 |
if (this.show_title_field) { |
166 |
this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666"); |
|
167 |
} |
|
168 |
if (this.show_creator_field) { |
|
169 |
this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666"); |
|
170 |
} |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
171 |
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected"); |
| 904 | 172 |
this.$.slideDown(); |
| 923 | 173 |
if (this.minimize_annotation_widget) { |
174 |
this.player.popcorn.trigger("IriSP.Annotation.minimize"); |
|
175 |
} |
|
| 904 | 176 |
this.player.popcorn.trigger("IriSP.Slice.show"); |
177 |
} |
|
178 |
||
179 |
IriSP.Widgets.CreateAnnotation.prototype.hide = function() { |
|
| 923 | 180 |
if (!this.always_visible) { |
181 |
this.visible = false; |
|
182 |
this.$.slideUp(); |
|
183 |
if (this.minimize_annotation_widget) { |
|
184 |
this.player.popcorn.trigger("IriSP.Annotation.maximize"); |
|
185 |
} |
|
186 |
this.player.popcorn.trigger("IriSP.Slice.hide"); |
|
187 |
} |
|
| 904 | 188 |
} |
189 |
||
190 |
IriSP.Widgets.CreateAnnotation.prototype.toggle = function() { |
|
| 923 | 191 |
if (!this.always_visible) { |
192 |
if (this.visible) { |
|
193 |
this.hide(); |
|
194 |
} else { |
|
195 |
this.show(); |
|
196 |
} |
|
| 904 | 197 |
} |
198 |
} |
|
199 |
||
200 |
IriSP.Widgets.CreateAnnotation.prototype.onBoundsChanged = function(_values) { |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
201 |
this.begin = new IriSP.Model.Time(_values[0] || 0); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
202 |
this.end = new IriSP.Model.Time(_values[1] || 0); |
| 904 | 203 |
this.$.find(".Ldt-CreateAnnotation-Begin").html(this.begin.toString()); |
204 |
this.$.find(".Ldt-CreateAnnotation-End").html(this.end.toString()); |
|
205 |
} |
|
206 |
||
207 |
IriSP.Widgets.CreateAnnotation.prototype.addKeyword = function(_keyword) { |
|
208 |
var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
|
209 |
_rx = IriSP.Model.regexpFromTextOrArray(_keyword), |
|
210 |
_contents = _field.val(); |
|
211 |
_contents = ( _rx.test(_contents) |
|
212 |
? _contents.replace(_rx,"") |
|
213 |
: _contents + " " + _keyword |
|
214 |
); |
|
215 |
_field.val(_contents.replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,'')); |
|
216 |
this.onDescriptionChange(); |
|
217 |
} |
|
218 |
||
| 923 | 219 |
IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() { |
220 |
if (this.pause_on_write && !this.player.popcorn.media.paused) { |
|
221 |
this.player.popcorn.pause(); |
|
222 |
} |
|
223 |
} |
|
224 |
||
| 904 | 225 |
IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() { |
226 |
var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
|
227 |
_contents = _field.val(); |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
228 |
_field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
| 904 | 229 |
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").each(function() { |
230 |
var _rx = IriSP.Model.regexpFromTextOrArray(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); |
|
231 |
if (_rx.test(_contents)) { |
|
232 |
IriSP.jQuery(this).addClass("selected"); |
|
233 |
} else { |
|
234 |
IriSP.jQuery(this).removeClass("selected"); |
|
235 |
} |
|
236 |
}); |
|
| 923 | 237 |
this.pauseOnWrite(); |
| 904 | 238 |
return !!_contents; |
239 |
} |
|
240 |
||
241 |
IriSP.Widgets.CreateAnnotation.prototype.onTitleChange = function() { |
|
242 |
var _field = this.$.find(".Ldt-CreateAnnotation-Title"), |
|
243 |
_contents = _field.val(); |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
244 |
_field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
| 923 | 245 |
this.pauseOnWrite(); |
246 |
return !!_contents; |
|
247 |
} |
|
248 |
||
249 |
||
250 |
IriSP.Widgets.CreateAnnotation.prototype.onCreatorChange = function() { |
|
251 |
var _field = this.$.find(".Ldt-CreateAnnotation-Creator"), |
|
252 |
_contents = _field.val(); |
|
253 |
_field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
|
254 |
this.pauseOnWrite(); |
|
| 904 | 255 |
return !!_contents; |
256 |
} |
|
257 |
||
258 |
IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() { |
|
| 923 | 259 |
if (!this.onDescriptionChange() || (this.show_title_field && !this.onTitleChange()) || (this.show_creator_field && !this.onCreatorChange())) { |
| 904 | 260 |
return; |
261 |
} |
|
262 |
|
|
263 |
var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager); |
|
264 |
_export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), |
|
265 |
_annotation = new IriSP.Model.Annotation(false, _export), |
|
| 915 | 266 |
_annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type), |
267 |
_annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
268 |
_url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); |
| 904 | 269 |
|
| 915 | 270 |
if (!_annotationTypes.length) { |
271 |
_annotationType.dont_send_id = true; |
|
272 |
} |
|
273 |
|
|
| 904 | 274 |
_annotationType.title = this.annotation_type; |
275 |
_annotation.setBegin(this.begin); |
|
276 |
_annotation.setEnd(this.end); |
|
277 |
_annotation.setMedia(this.source.currentMedia.id); |
|
278 |
_annotation.setAnnotationType(_annotationType.id); |
|
279 |
if (this.show_title_field) { |
|
| 923 | 280 |
_annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val(); |
| 904 | 281 |
} |
282 |
_annotation.created = new Date(); |
|
283 |
_annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); |
|
284 |
_annotation.setTags(this.$.find(".Ldt-CreateAnnotation-TagLi.selected").map(function() { return IriSP.jQuery(this).attr("tag-id")})); |
|
285 |
|
|
| 923 | 286 |
if (this.show_creator_field) { |
287 |
_export.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val(); |
|
288 |
} else { |
|
289 |
_export.creator = this.creator_name; |
|
290 |
} |
|
| 904 | 291 |
_export.created = new Date(); |
292 |
_exportedAnnotations.push(_annotation); |
|
293 |
_export.addList("annotation",_exportedAnnotations); |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
294 |
|
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
295 |
var _this = this; |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
296 |
IriSP.jQuery.ajax({ |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
297 |
url: _url, |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
298 |
type: this.api_method, |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
299 |
contentType: 'application/json', |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
300 |
data: _export.serialize(), |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
301 |
success: function(_data) { |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
302 |
_this.showScreen('Saved'); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
303 |
if (_this.close_widget_timeout) { |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
304 |
window.setTimeout(_this.functionWrapper("hide"),_this.close_widget_timeout); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
305 |
} |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
306 |
_export.getAnnotations().removeElement(_annotation, true); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
307 |
_export.deSerialize(_data); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
308 |
_this.source.merge(_export); |
| 923 | 309 |
if (this.pause_on_write && this.player.popcorn.media.paused) { |
310 |
this.player.popcorn.play(); |
|
311 |
} |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
312 |
_this.player.popcorn.trigger("IriSP.AnnotationsList.refresh"); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
313 |
}, |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
314 |
error: function(_xhr, _error, _thrown) { |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
315 |
IriSP.log("Error when sending annotation", _thrown); |
| 916 | 316 |
_export.getAnnotations().removeElement(_annotation, true); |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
317 |
_this.showScreen('Error'); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
318 |
window.setTimeout(function(){ |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
319 |
_this.showScreen("Main") |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
320 |
}, |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
321 |
(_this.close_widget_timeout || 5000)); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
322 |
} |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
323 |
}); |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
324 |
this.showScreen('Wait'); |
| 904 | 325 |
|
326 |
return false; |
|
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
327 |
} |
| 880 | 328 |