| author | ymh <ymh.work@gmail.com> |
| Sun, 12 Nov 2017 22:07:33 +0100 | |
| changeset 1071 | 02c04d2c8fd8 |
| parent 1069 | 2409cb4cebaf |
| child 1072 | ac1eacb3aa33 |
| permissions | -rw-r--r-- |
| 965 | 1 |
/* TODO: Add Social Network Sharing */ |
|
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); |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
5 |
if (_this.editable_storage != '' && window.localStorage[_this.editable_storage]) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
6 |
this.source.onLoad(function () { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
7 |
var _export = _this.player.sourceManager.newLocalSource({serializer: IriSP.serializers['ldt_localstorage']}); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
8 |
_export.deSerialize(window.localStorage[_this.editable_storage]); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
9 |
_this.source.merge(_export); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
10 |
}); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
11 |
}; |
| 880 | 12 |
}; |
13 |
||
14 |
IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget(); |
|
15 |
||
16 |
IriSP.Widgets.CreateAnnotation.prototype.defaults = { |
|
| 975 | 17 |
show_title_field : true, |
| 923 | 18 |
show_creator_field : true, |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
19 |
creator_field_readonly : false, |
| 923 | 20 |
start_visible : true, |
| 924 | 21 |
always_visible : false, |
| 965 | 22 |
show_slice : true, |
23 |
show_arrow : true, |
|
| 966 | 24 |
show_mic_record: false, |
25 |
show_mic_play: false, |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
26 |
show_time: true, |
| 924 | 27 |
minimize_annotation_widget : true, |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
28 |
creator_name : "", |
| 924 | 29 |
creator_avatar : "", |
| 904 | 30 |
tags : false, |
| 924 | 31 |
tag_titles : false, |
| 923 | 32 |
pause_on_write : true, |
| 904 | 33 |
max_tags : 8, |
34 |
polemics : [{ |
|
35 |
keyword: "++", |
|
36 |
background_color: "#00a000", |
|
37 |
text_color: "#ffffff" |
|
38 |
},{ |
|
39 |
keyword: "--", |
|
40 |
background_color: "#c00000", |
|
41 |
text_color: "#ffffff" |
|
42 |
},{ |
|
43 |
keyword: "??", |
|
44 |
background_color: "#0000e0", |
|
45 |
text_color: "#ffffff" |
|
46 |
},{ |
|
47 |
keyword: "==", |
|
48 |
background_color: "#f0e000", |
|
49 |
text_color: "#000000" |
|
50 |
}], |
|
| 965 | 51 |
slice_annotation_type: "chap", |
| 904 | 52 |
annotation_type: "Contributions", |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
53 |
post_at_segment_time: false, |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
54 |
segment_annotation_type: "chap", |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
55 |
api_serializer: "ldt_annotate", |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
56 |
api_endpoint_template: "", |
| 979 | 57 |
api_method: "POST", |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
58 |
// Id that will be used as localStorage key |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
59 |
editable_storage: "", |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
60 |
project_id: "", |
| 925 | 61 |
after_send_timeout: 0, |
62 |
close_after_send: false, |
|
|
1047
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
63 |
tag_prefix: "#", |
|
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
64 |
pause_when_displaying: false, |
| 1050 | 65 |
custom_send_button: false, |
66 |
custom_cancel_button: false, |
|
|
1069
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
67 |
custom_description_placeholder: false, |
|
1066
5ef7182907c5
added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents:
1061
diff
changeset
|
68 |
preview_mode: false, |
| 1013 | 69 |
}; |
| 880 | 70 |
|
71 |
IriSP.Widgets.CreateAnnotation.prototype.messages = { |
|
| 882 | 72 |
en: { |
73 |
from_time: "from", |
|
74 |
to_time: "to", |
|
| 923 | 75 |
at_time: "at", |
| 882 | 76 |
submit: "Submit", |
|
1066
5ef7182907c5
added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents:
1061
diff
changeset
|
77 |
preview_submit: "You cannot submit annotations in preview mode", |
|
1047
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
78 |
cancel: "Cancel", |
| 904 | 79 |
add_keywords_: "Add keywords:", |
|
1021
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
80 |
add_polemic_keywords_: "Add polemic attributes :", |
| 923 | 81 |
your_name_: "Your name:", |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
82 |
annotate_video: "New note", |
| 882 | 83 |
type_title: "Annotation title", |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
84 |
type_description: "Enter a new note...", |
| 982 | 85 |
wait_while_processing: "Please wait while your annotation is being processed...", |
| 882 | 86 |
error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.", |
87 |
annotation_saved: "Thank you, your annotation has been saved.", |
|
88 |
share_annotation: "Would you like to share it on social networks ?", |
|
| 982 | 89 |
close_widget: "Hide the annotation form", |
| 970 | 90 |
"polemic++": "Agree", |
91 |
"polemic--": "Disagree", |
|
92 |
"polemic??": "Question", |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
93 |
"polemic==": "Reference", |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
94 |
"in_tooltip": "Set begin time to current player time", |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
95 |
"out_tooltip": "Set begin time to current player time", |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
96 |
"play_tooltip": "Play the fragment" |
| 880 | 97 |
}, |
| 882 | 98 |
fr: { |
| 904 | 99 |
from_time: "de", |
| 882 | 100 |
to_time: "à", |
| 923 | 101 |
at_time: "à", |
| 882 | 102 |
submit: "Envoyer", |
|
1066
5ef7182907c5
added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents:
1061
diff
changeset
|
103 |
preview_submit: "Vous ne pouvez pas envoyer d'annotation en mode aperçu", |
|
1047
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
104 |
cancel: "Annuler", |
| 1002 | 105 |
add_keywords_: "Ajouter des mots-clés\u00a0:", |
|
1021
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
106 |
add_polemic_keywords_: "Ajouter des attributs polémiques\u00a0:", |
| 1002 | 107 |
your_name_: "Votre nom\u00a0:", |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
108 |
annotate_video: "Entrez une nouvelle note...", |
| 882 | 109 |
type_title: "Titre de l'annotation", |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
110 |
type_description: "Prenez vos notes...", |
| 982 | 111 |
wait_while_processing: "Veuillez patienter pendant le traitement de votre annotation...", |
112 |
error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée.", |
|
| 882 | 113 |
annotation_saved: "Merci, votre annotation a été enregistrée.", |
114 |
share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?", |
|
| 982 | 115 |
close_widget: "Cacher le formulaire de création d'annotations", |
| 970 | 116 |
"polemic++": "Accord", |
117 |
"polemic--": "Désaccord", |
|
118 |
"polemic??": "Question", |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
119 |
"polemic==": "Référence", |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
120 |
"in_tooltip": "Utiliser le temps courant comme début", |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
121 |
"out_tooltip": "Utiliser le temps courant comme fin", |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
122 |
"play_tooltip": "Jouer le fragment" |
| 880 | 123 |
} |
| 1013 | 124 |
}; |
| 880 | 125 |
|
126 |
IriSP.Widgets.CreateAnnotation.prototype.template = |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
127 |
'{{#show_slice}}<div class="Ldt-CreateAnnotation-Slice Ldt-TraceMe"></div>{{/show_slice}}' |
| 965 | 128 |
+ '{{^show_slice}}{{#show_arrow}}<div class="Ldt-CreateAnnotation-Arrow"></div>{{/show_arrow}}{{/show_slice}}' |
129 |
+ '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
|
| 881 | 130 |
+ '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
| 982 | 131 |
+ '<h3><span class="Ldt-CreateAnnotation-h3Left">{{l10n.annotate_video}}{{#show_title_field}}</span></h3>' |
132 |
+ '<h3><span class="Ldt-CreateAnnotation-h3Left"><input class="Ldt-CreateAnnotation-Title empty" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
133 |
+ '{{#show_time}}<span class="Ldt-CreateAnnotation-Times"> {{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>{{/show_time}}' |
| 966 | 134 |
+ '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">{{end}}</span>{{/show_slice}}</span></span>' |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
135 |
+ '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator empty" value="{{creator_name}}" {{#creator_field_readonly}}readonly{{/creator_field_readonly}}/>{{/show_creator_field}}</h3>' |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
136 |
+ '{{#show_controls}}<div class="Ldt-CreateAnnotation-Controls">' |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
137 |
+ '<span title="{{l10n.in_tooltip}}" class="Ldt-CreateAnnotation-Control-In">In</span>' |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
138 |
+ '<span title="{{l10n.out_tooltip}}" class="Ldt-CreateAnnotation-Control-Out">Out</span>' |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
139 |
+ '<span title="{{l10n.play_tooltip}}" class="Ldt-CreateAnnotation-Control-Play">Play</span>' |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
140 |
+ '</div>{{/show_controls}}' |
|
1069
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
141 |
+ '<textarea class="Ldt-CreateAnnotation-Description Ldt-TraceMe empty" placeholder="{{#custom_description_placeholder}}{{custom_description_placeholder}}{{/custom_description_placeholder}}{{^custom_description_placeholder}}{{l10n.type_description}}{{/custom_description_placeholder}}"></textarea>' |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
142 |
+ '{{#show_creator_field}}<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>{{/show_creator_field}}' |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
143 |
+ '<div class="Ldt-CreateAnnotation-SubmitArea Ldt-TraceMe">' |
|
1069
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
144 |
+ '{{#preview_mode}}<input type="button" class="Ldt-CreateAnnotation-PreviewSubmit" title="{{l10n.preview_submit}}" value="{{#custom_send_button}}{{custom_send_button}}{{/custom_send_button}}{{^custom_send_button}}{{l10n.submit}}{{/custom_send_button}}" />{{/preview_mode}}' |
|
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
145 |
+ '{{^preview_mode}}<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{#custom_send_button}}{{custom_send_button}}{{/custom_send_button}}{{^custom_send_button}}{{l10n.submit}}{{/custom_send_button}}" />{{/preview_mode}}' |
|
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
146 |
+ '<input type="button" class="Ldt-CreateAnnotation-Cancel" value="{{#custom_cancel_button}}{{custom_cancel_button}}{{/custom_cancel_button}}{{^custom_cancel_button}}{{l10n.cancel}}{{/custom_cancel_button}}" />' |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
147 |
+ '<div class="Ldt-CreateAnnotation-Begin Ldt-CreateAnnotation-Times">00:00</div>' |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
148 |
+ '</div>' |
| 966 | 149 |
+ '{{#show_mic_record}}<div class="Ldt-CreateAnnotation-RecBlock"><div class="Ldt-CreateAnnotation-RecLabel">Add voice annotation</div>' |
150 |
+ ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="220" height="160">' |
|
151 |
+ ' <param name="movie" value="{{record_swf}}" />' |
|
152 |
+ ' <param name="quality" value="high" />' |
|
153 |
+ ' <param name="bgcolor" value="#ffffff" />' |
|
154 |
+ ' <param name="play" value="true" />' |
|
155 |
+ ' <param name="loop" value="true" />' |
|
156 |
+ ' <param name="wmode" value="transparent" />' |
|
157 |
+ ' <param name="scale" value="showall" />' |
|
158 |
+ ' <param name="menu" value="true" />' |
|
159 |
+ ' <param name="devicefont" value="false" />' |
|
160 |
+ ' <param name="salign" value="" />' |
|
161 |
+ ' <param name="allowScriptAccess" value="always" />' |
|
162 |
+ ' <param name="allowFullScreen" value="true" />' |
|
163 |
+ ' <param name="flashvars" value="playVisible={{show_mic_play}}">' |
|
164 |
+ ' <embed src="{{record_swf}}"" quality="high" bgcolor="#ffffff"' |
|
165 |
+ ' width="220" height="160" name="ExternalInterfaceExample" align="middle"' |
|
166 |
+ ' play="true" loop="false" quality="high" allowScriptAccess="always" ' |
|
167 |
+ ' type="application/x-shockwave-flash" allowFullScreen="true" wmode="transparent" ' |
|
168 |
+ ' flashvars="playVisible={{show_mic_play}}"' |
|
169 |
+ ' pluginspage="http://www.macromedia.com/go/getflashplayer">' |
|
170 |
+ ' </embed>' |
|
171 |
+ ' </object>' |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
172 |
+ '</div>{{/show_mic_record}}' |
| 904 | 173 |
+ '{{#tags.length}}<div class="Ldt-CreateAnnotation-Tags"><div class="Ldt-CreateAnnotation-TagTitle">{{l10n.add_keywords_}}</div><ul class="Ldt-CreateAnnotation-TagList">' |
| 1003 | 174 |
+ '{{#tags}}<li class="Ldt-CreateAnnotation-TagLi" tag-id="{{id}}" data-text="{{tag_prefix}}{{title}}"><span class="Ldt-CreateAnnotation-TagButton">{{title}}</span></li>{{/tags}}</ul></div>{{/tags.length}}' |
| 904 | 175 |
+ '{{#polemics.length}}<div class="Ldt-CreateAnnotation-Polemics"><div class="Ldt-CreateAnnotation-PolemicTitle">{{l10n.add_polemic_keywords_}}</div><ul class="Ldt-CreateAnnotation-PolemicList">' |
| 1003 | 176 |
+ '{{#polemics}}<li class="Ldt-CreateAnnotation-PolemicLi" style="background-color: {{background_color}}; color: {{text_color}}" data-text="{{keyword}}">{{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
|
177 |
+ '<div style="clear: both;"></div></form>' |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
178 |
+ '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Wait"><div class="Ldt-CreateAnnotation-InnerBox">{{l10n.wait_while_processing}}</div></div>' |
| 923 | 179 |
+ '<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>' |
180 |
+ '<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
|
181 |
+ '</div></div>'; |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
182 |
|
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
183 |
IriSP.Widgets.CreateAnnotation.prototype.draw = function() { |
| 924 | 184 |
var _this = this; |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
185 |
|
| 966 | 186 |
this.begin = new IriSP.Model.Time(); |
187 |
this.end = this.source.getDuration(); |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
188 |
|
| 1003 | 189 |
this.tag_prefix = this.tag_prefix || ""; |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
190 |
|
| 924 | 191 |
if (this.tag_titles && !this.tags) { |
|
1021
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
192 |
if(!(this.tag_titles.length==1 && this.tag_titles[0]=="")){ |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
193 |
this.tags = IriSP._(this.tag_titles).map(function(_tag_title) { |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
194 |
var _tag, |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
195 |
_tags = _this.source.getTags().searchByTitle(_tag_title, true); |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
196 |
if (_tags.length) { |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
197 |
_tag = _tags[0]; |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
198 |
} else { |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
199 |
_tag = new IriSP.Model.Tag(false, _this.source); |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
200 |
_this.source.getTags().push(_tag); |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
201 |
_tag.title = _tag_title; |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
202 |
} |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
203 |
return _tag; |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
204 |
}); |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
205 |
} |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
206 |
else{ |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
207 |
// we forced no tags if this.tag_titles = [''] (and not false) |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
208 |
this.tags = true; |
|
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
209 |
} |
| 924 | 210 |
} |
| 904 | 211 |
if (!this.tags) { |
212 |
this.tags = this.source.getTags() |
|
213 |
.sortBy(function (_tag) { |
|
214 |
return -_tag.getAnnotations().length; |
|
215 |
}) |
|
216 |
.slice(0, this.max_tags) |
|
217 |
.map(function(_tag) { |
|
218 |
return _tag; |
|
219 |
}); |
|
| 928 | 220 |
/* We have to use the map function because Mustache doesn't like our tags object */ |
| 904 | 221 |
} |
| 966 | 222 |
this.record_swf = IriSP.getLib("recordMicSwf"); |
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
223 |
this.renderTemplate(); |
| 966 | 224 |
if (this.show_mic_record) { |
225 |
this.recorder = this.$.find("embed")[0]; |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
226 |
|
| 966 | 227 |
window.setAudioUrl = function(_url) { |
228 |
_this.audio_url = _url; |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
229 |
} |
| 966 | 230 |
} |
| 965 | 231 |
if (this.show_slice) { |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
232 |
this.insertSubwidget( |
| 965 | 233 |
this.$.find(".Ldt-CreateAnnotation-Slice"), |
234 |
{ |
|
235 |
type: "Slice", |
|
236 |
show_arrow: this.show_arrow, |
|
237 |
annotation_type: this.slice_annotation_type, |
|
238 |
onBoundsChanged: function(_from, _to) { |
|
|
1069
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
239 |
_this.setBeginEnd(_from, _to); |
| 965 | 240 |
} |
241 |
}, |
|
242 |
"slice" |
|
243 |
); |
|
244 |
} else { |
|
245 |
if (this.show_arrow) { |
|
246 |
this.insertSubwidget(this.$.find(".Ldt-CreateAnnotation-Arrow"), {type: "Arrow"},"arrow"); |
|
247 |
} |
|
248 |
this.onMediaEvent("timeupdate", function(_time) { |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
249 |
// Do not update timecode if description is not empty |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
250 |
if (_this.$.find(".Ldt-CreateAnnotation-Description").val().trim() == "") { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
251 |
_this.setBeginEnd(_time, _time); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
252 |
if (_this.arrow) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
253 |
_this.arrow.moveToTime(_time); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
254 |
} |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
255 |
}; |
| 965 | 256 |
}); |
257 |
} |
|
|
1047
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
258 |
this.$.find(".Ldt-CreateAnnotation-Cancel").click(function() { |
|
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
259 |
_this.player.trigger("CreateAnnotation.hide"); |
|
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
260 |
}); |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
261 |
this.$.find(".Ldt-CreateAnnotation-Close").click(function() { |
| 925 | 262 |
_this.close_after_send |
|
1061
7d22bfd6b73b
CreateAnnotation: now triggering events for hiding and showing widget after submitting to make it easier for other widgets to catch these events
durandn
parents:
1050
diff
changeset
|
263 |
? _this.player.trigger("CreateAnnotation.hide") |
| 925 | 264 |
: _this.showScreen("Main"); |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
265 |
return false; |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
266 |
}); |
| 904 | 267 |
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").click(function() { |
| 1003 | 268 |
_this.addKeyword(IriSP.jQuery(this).attr("data-text")); |
| 904 | 269 |
return false; |
270 |
}); |
|
| 970 | 271 |
this.$.find(".Ldt-CreateAnnotation-PolemicLi").each(function() { |
272 |
var _el = IriSP.jQuery(this), |
|
| 1003 | 273 |
_kw = _el.attr("data-text"), |
| 970 | 274 |
_msg = _this.l10n["polemic" + _kw]; |
275 |
if (_msg) { |
|
276 |
_el.attr("title",_msg); |
|
277 |
} |
|
278 |
}); |
|
| 904 | 279 |
this.$.find(".Ldt-CreateAnnotation-Description").bind("change keyup input paste", this.functionWrapper("onDescriptionChange")); |
280 |
if (this.show_title_field) { |
|
281 |
this.$.find(".Ldt-CreateAnnotation-Title").bind("change keyup input paste", this.functionWrapper("onTitleChange")); |
|
282 |
} |
|
| 923 | 283 |
if (this.show_creator_field) { |
284 |
this.$.find(".Ldt-CreateAnnotation-Creator").bind("change keyup input paste", this.functionWrapper("onCreatorChange")); |
|
285 |
} |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
286 |
this.$.find("[class^='Ldt-CreateAnnotation-Control-']").click(function() { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
287 |
var action = this.className.replace('Ldt-CreateAnnotation-Control-', ''); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
288 |
switch (action) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
289 |
case "In": |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
290 |
// Set In bound to current player time |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
291 |
this.setBegin(_this.media.getCurrentTime()); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
292 |
break; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
293 |
case "Out": |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
294 |
// Set In bound to current player time |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
295 |
this.setEnd(_this.media.getCurrentTime() || _this.media.duration); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
296 |
break; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
297 |
case "Play": |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
298 |
this.media.setCurrentTime(_this.begin); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
299 |
this.media.play(); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
300 |
break; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
301 |
} |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
302 |
return false; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
303 |
}); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
304 |
|
| 923 | 305 |
if (this.start_visible) { |
306 |
this.show(); |
|
307 |
} else { |
|
308 |
this.$.hide(); |
|
309 |
this.hide(); |
|
310 |
} |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
311 |
|
| 957 | 312 |
this.onMdpEvent("CreateAnnotation.toggle","toggle"); |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
313 |
this.onMdpEvent("CreateAnnotation.hide", "hide"); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
314 |
this.onMdpEvent("CreateAnnotation.show", "show"); |
| 904 | 315 |
this.$.find("form").submit(this.functionWrapper("onSubmit")); |
| 1013 | 316 |
}; |
| 904 | 317 |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
318 |
IriSP.Widgets.CreateAnnotation.prototype.setBegin = function (t) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
319 |
this.begin = new IriSP.Model.Time(t || 0); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
320 |
this.$.find(".Ldt-CreateAnnotation-Begin").html(this.begin.toString()); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
321 |
}; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
322 |
|
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
323 |
IriSP.Widgets.CreateAnnotation.prototype.setEnd = function (t) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
324 |
this.end = new IriSP.Model.Time(t || 0); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
325 |
this.$.find(".Ldt-CreateAnnotation-End").html(this.end.toString()); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
326 |
}; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
327 |
|
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
328 |
IriSP.Widgets.CreateAnnotation.prototype.setBeginEnd = function (begin, end) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
329 |
this.setBegin(begin); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
330 |
this.setEnd(end); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
331 |
}; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
332 |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
333 |
IriSP.Widgets.CreateAnnotation.prototype.showScreen = function(_screenName) { |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
334 |
this.$.find('.Ldt-CreateAnnotation-' + _screenName).show() |
|
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
335 |
.siblings().hide(); |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
336 |
}; |
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
337 |
|
| 904 | 338 |
IriSP.Widgets.CreateAnnotation.prototype.show = function() { |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
339 |
if (!this.visible){ |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
340 |
this.visible = true; |
|
1047
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
341 |
if (this.pause_when_displaying){ |
|
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
342 |
this.media.pause(); |
|
c3bf174e0ef8
Added a button to cancel Annotation creation and hide the widget on CreateAnnotation
durandn
parents:
1038
diff
changeset
|
343 |
} |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
344 |
this.showScreen('Main'); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
345 |
this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666").addClass("empty"); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
346 |
if (this.show_title_field) { |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
347 |
this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666").addClass("empty"); |
| 975 | 348 |
} |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
349 |
if (this.show_creator_field) { |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
350 |
this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666"); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
351 |
if (!this.creator_name) { |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
352 |
this.$.find(".Ldt-CreateAnnotation-Creator").addClass("empty"); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
353 |
} |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
354 |
} |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
355 |
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected"); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
356 |
this.$.slideDown(); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
357 |
if (this.minimize_annotation_widget) { |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
358 |
this.player.trigger("Annotation.minimize"); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
359 |
} |
| 923 | 360 |
} |
| 1013 | 361 |
}; |
| 904 | 362 |
|
363 |
IriSP.Widgets.CreateAnnotation.prototype.hide = function() { |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
364 |
if (this.visible){ |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
365 |
if (this.recorder) { |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
366 |
this.recorder.stopRecord(); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
367 |
} |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
368 |
if (!this.always_visible) { |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
369 |
this.visible = false; |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
370 |
this.$.slideUp(); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
371 |
if (this.minimize_annotation_widget) { |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
372 |
this.player.trigger("Annotation.maximize"); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
373 |
} |
| 923 | 374 |
} |
375 |
} |
|
| 1013 | 376 |
}; |
| 904 | 377 |
|
378 |
IriSP.Widgets.CreateAnnotation.prototype.toggle = function() { |
|
| 923 | 379 |
if (!this.always_visible) { |
380 |
if (this.visible) { |
|
381 |
this.hide(); |
|
382 |
} else { |
|
|
1069
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
383 |
var t = this.media.getCurrentTime() || 0; |
|
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
384 |
this.setBeginEnd(t, t); |
|
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
385 |
if (this.slice_widget) { |
|
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
386 |
this.slice_widget.setBounds(this.begin, this.end); |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
387 |
} |
| 923 | 388 |
this.show(); |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
389 |
// Set focus on textarea |
|
1069
2409cb4cebaf
getting various changes from github
ymh <ymh.work@gmail.com>
parents:
1068
diff
changeset
|
390 |
this.$.find(".Ldt-CreateAnnotation-Description").focus(); |
| 923 | 391 |
} |
| 904 | 392 |
} |
| 1013 | 393 |
}; |
| 904 | 394 |
|
395 |
IriSP.Widgets.CreateAnnotation.prototype.addKeyword = function(_keyword) { |
|
396 |
var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
|
397 |
_rx = IriSP.Model.regexpFromTextOrArray(_keyword), |
|
398 |
_contents = _field.val(); |
|
| 925 | 399 |
_contents = ( !!_contents.match(_rx) |
| 904 | 400 |
? _contents.replace(_rx,"") |
401 |
: _contents + " " + _keyword |
|
402 |
); |
|
403 |
_field.val(_contents.replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,'')); |
|
404 |
this.onDescriptionChange(); |
|
| 1013 | 405 |
}; |
| 904 | 406 |
|
| 923 | 407 |
IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() { |
| 957 | 408 |
if (this.pause_on_write && !this.media.getPaused()) { |
409 |
this.media.pause(); |
|
| 923 | 410 |
} |
| 1013 | 411 |
}; |
| 923 | 412 |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
413 |
IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function(e) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
414 |
if (e !== undefined && e.keyCode == 13 && !e.shiftKey) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
415 |
// Return: submit. Use shift-Return to insert a LF |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
416 |
this.onSubmit(); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
417 |
return true; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
418 |
} |
| 904 | 419 |
var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
420 |
_contents = _field.val(); |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
421 |
_field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
| 975 | 422 |
if (!!_contents) { |
423 |
_field.removeClass("empty"); |
|
424 |
} else { |
|
425 |
_field.addClass("empty"); |
|
426 |
} |
|
| 904 | 427 |
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").each(function() { |
| 1003 | 428 |
var _rx = IriSP.Model.regexpFromTextOrArray(IriSP.jQuery(this).attr("data-text")); |
| 925 | 429 |
if (_contents.match(_rx)) { |
| 904 | 430 |
IriSP.jQuery(this).addClass("selected"); |
431 |
} else { |
|
432 |
IriSP.jQuery(this).removeClass("selected"); |
|
433 |
} |
|
434 |
}); |
|
| 923 | 435 |
this.pauseOnWrite(); |
| 904 | 436 |
return !!_contents; |
| 1013 | 437 |
}; |
| 904 | 438 |
|
439 |
IriSP.Widgets.CreateAnnotation.prototype.onTitleChange = function() { |
|
440 |
var _field = this.$.find(".Ldt-CreateAnnotation-Title"), |
|
441 |
_contents = _field.val(); |
|
|
908
f56199193fad
CreateAnnotation widget now posts annotations, Tagcloud can be made segment-dependent
veltr
parents:
904
diff
changeset
|
442 |
_field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
| 975 | 443 |
if (!!_contents) { |
444 |
_field.removeClass("empty"); |
|
445 |
} else { |
|
446 |
_field.addClass("empty"); |
|
447 |
} |
|
| 923 | 448 |
this.pauseOnWrite(); |
449 |
return !!_contents; |
|
| 1013 | 450 |
}; |
| 923 | 451 |
|
452 |
||
453 |
IriSP.Widgets.CreateAnnotation.prototype.onCreatorChange = function() { |
|
454 |
var _field = this.$.find(".Ldt-CreateAnnotation-Creator"), |
|
455 |
_contents = _field.val(); |
|
456 |
_field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
|
| 975 | 457 |
if (!!_contents) { |
458 |
_field.removeClass("empty"); |
|
459 |
} else { |
|
460 |
_field.addClass("empty"); |
|
461 |
} |
|
| 923 | 462 |
this.pauseOnWrite(); |
| 904 | 463 |
return !!_contents; |
| 1013 | 464 |
}; |
| 904 | 465 |
|
466 |
IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() { |
|
| 1067 | 467 |
/* If mandatory fields are empty, we cancel the sending */ |
| 923 | 468 |
if (!this.onDescriptionChange() || (this.show_title_field && !this.onTitleChange()) || (this.show_creator_field && !this.onCreatorChange())) { |
| 970 | 469 |
return false; |
| 904 | 470 |
} |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
471 |
|
| 966 | 472 |
if (this.recorder) { |
473 |
this.recorder.stopRecord(); |
|
474 |
} |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
475 |
|
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
476 |
var _this = this, |
| 1067 | 477 |
_exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create a List to send to the server that will contains the annotation */ |
478 |
_export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */ |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
479 |
_local_export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers['ldt_localstorage']}), /* Source object using a specific serializer for local export */ |
| 1067 | 480 |
_annotation = new IriSP.Model.Annotation(false, _export), /* We create an annotation in the source with a generated ID (param. false) */ |
481 |
_annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* We get the AnnotationType in which the annotation will be added */ |
|
482 |
_annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* If it doesn't already exists, we create it */ |
|
483 |
_url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* We make the url to send the request to, must include project id */ |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
484 |
|
| 1067 | 485 |
/* If we created an AnnotationType on the spot ... */ |
| 915 | 486 |
if (!_annotationTypes.length) { |
| 1067 | 487 |
/* ... We must not send its id to the server ... */ |
| 915 | 488 |
_annotationType.dont_send_id = true; |
| 1067 | 489 |
/* ... And we must include its title. */ |
| 928 | 490 |
_annotationType.title = this.annotation_type; |
| 915 | 491 |
} |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
492 |
|
| 928 | 493 |
/* |
| 1067 | 494 |
* Will fill the generated annotation object's data |
495 |
* WARNING: If we're on a MASHUP, these datas must refer the ORIGINAL MEDIA |
|
| 928 | 496 |
* */ |
| 1067 | 497 |
_annotation.setMedia(this.source.currentMedia.id); /* Annotated media ID */ |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
498 |
|
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
499 |
if (this.post_at_segment_time){ |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
500 |
var _currentTime = this.media.getCurrentTime() |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
501 |
var _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type) |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
502 |
var _currentSegments = _segmentsAnnotations.filter(function(_segment){ |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
503 |
return (_currentTime >= _segment.begin && _currentTime <= _segment.end) |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
504 |
}); |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
505 |
if (_currentSegments.length == 0){ |
| 1067 | 506 |
_annotation.setBegin(this.begin); /* Widget starting timecode */ |
507 |
_annotation.setEnd(this.end); /* Widget end timecode */ |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
508 |
} |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
509 |
else { |
| 1067 | 510 |
_annotation.setBegin(_currentSegments[0].begin); /* Segment starting timecode */ |
511 |
_annotation.setEnd(_currentSegments[0].end); /* Segment end timecode */ |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
512 |
} |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
513 |
} |
|
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
514 |
else { |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
515 |
_annotation.setBeginEnd(this.begin, this.end); /* Widget end/start timecodes */ |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
516 |
} |
| 1067 | 517 |
_annotation.setAnnotationType(_annotationType.id); /* Annotation type ID */ |
| 904 | 518 |
if (this.show_title_field) { |
| 1067 | 519 |
/* Title field, only if it's visible */ |
| 923 | 520 |
_annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val(); |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
521 |
}if (this.project_id != ""){ |
| 1067 | 522 |
/* Project id, only if it's been specifiec in the config */ |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
523 |
_annotation.project_id = this.project_id; |
| 904 | 524 |
} |
| 1067 | 525 |
_annotation.created = new Date(); /* Annotation creation date */ |
526 |
_annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Description field */ |
|
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
527 |
|
| 1003 | 528 |
var tagIds = Array.prototype.map.call( |
529 |
this.$.find(".Ldt-CreateAnnotation-TagLi.selected"), |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
530 |
function(el) { return IriSP.jQuery(el).attr("tag-id"); } |
| 1003 | 531 |
); |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
532 |
|
| 1003 | 533 |
IriSP._(_annotation.description.match(/#[^\s#.,;]+/g)).each(function(_tt) { |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
534 |
var _tag, |
| 1003 | 535 |
_tag_title = _tt.replace(/^#/,''), |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
536 |
_tags = _this.source.getTags().searchByTitle(_tag_title, true); |
|
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
537 |
if (_tags.length) { |
|
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
538 |
_tag = _tags[0]; |
|
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
539 |
} else { |
|
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
540 |
_tag = new IriSP.Model.Tag(false, _this.source); |
| 1003 | 541 |
_this.source.getTags().push(_tag); |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
542 |
_tag.title = _tag_title; |
|
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
986
diff
changeset
|
543 |
} |
| 1003 | 544 |
if (tagIds.indexOf(_tag.id) === -1) { |
545 |
tagIds.push(_tag.id); |
|
546 |
} |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
547 |
}); |
| 1067 | 548 |
_annotation.setTags(IriSP._(tagIds).uniq()); /* Tag ids list */ |
| 966 | 549 |
if (this.audio_url) { |
550 |
_annotation.audio = { |
|
551 |
src: "mic", |
|
552 |
mimetype: "audio/mp3", |
|
553 |
href: this.audio_url |
|
554 |
}; |
|
555 |
} |
|
| 923 | 556 |
if (this.show_creator_field) { |
| 974 | 557 |
_annotation.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val(); |
| 923 | 558 |
} else { |
| 974 | 559 |
_annotation.creator = this.creator_name; |
| 923 | 560 |
} |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
561 |
_exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
562 |
|
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
563 |
if (this.editable_storage != '') { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
564 |
// Append to localStorage annotations |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
565 |
|
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
566 |
// FIXME: handle movie ids |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
567 |
_local_export.addList("annotation", _exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
568 |
_this.source.merge(_local_export); /* On ajoute la nouvelle annotation au recueil original */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
569 |
// Import previously saved local annotations |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
570 |
if (window.localStorage[this.editable_storage]) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
571 |
_local_export.deSerialize(window.localStorage[this.editable_storage]); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
572 |
} |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
573 |
// Save everything back |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
574 |
window.localStorage[_this.editable_storage] = _local_export.serialize(); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
575 |
_this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
576 |
_this.player.trigger("Annotation.create", _annotation); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
577 |
_this.$.find(".Ldt-CreateAnnotation-Description").val(""); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
578 |
} |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
579 |
|
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
580 |
if (_url !== "") { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
581 |
_exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
582 |
_export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
583 |
var _this = this; |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
584 |
/* We send the AJAX request to the server ! */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
585 |
IriSP.jQuery.ajax({ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
586 |
url: _url, |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
587 |
type: this.api_method, |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
588 |
contentType: 'application/json', |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
589 |
data: _export.serialize(), /* Source is serialized */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
590 |
success: function(_data) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
591 |
_this.showScreen('Saved'); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
592 |
if (_this.after_send_timeout) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
593 |
window.setTimeout( |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
594 |
function() { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
595 |
_this.close_after_send |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
596 |
? _this.player.trigger("CreateAnnotation.hide") |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
597 |
: _this.player.trigger("CreateAnnotation.show"); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
598 |
}, |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
599 |
_this.after_send_timeout |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
600 |
); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
601 |
} |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
602 |
_export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
603 |
_export.deSerialize(_data); /* Data deserialization */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
604 |
_this.source.merge(_export); /* We merge the deserialized data with the current source data */ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
605 |
if (_this.pause_on_write && _this.media.getPaused()) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
606 |
_this.media.play(); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
607 |
} |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
608 |
_this.player.trigger("AnnotationsList.refresh"); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
609 |
}, |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
610 |
error: function(_xhr, _error, _thrown) { |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
611 |
IriSP.log("Error when sending annotation", _thrown); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
612 |
_export.getAnnotations().removeElement(_annotation, true); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
613 |
_this.showScreen('Error'); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
614 |
window.setTimeout(function(){ |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
615 |
_this.showScreen("Main") |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
616 |
}, |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
617 |
(_this.after_send_timeout || 5000)); |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
618 |
} |
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
619 |
}); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
620 |
this.showScreen('Wait'); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1067
diff
changeset
|
621 |
}; |
| 904 | 622 |
return false; |
| 1013 | 623 |
}; |
|
1038
e78b889a75e1
CreateAnnotations new feature: hide/show functionality on signal trigger (tweaks), added config options to customize what is displayed more accurately
durandn
parents:
1033
diff
changeset
|
624 |