35 newest_first : false, |
38 newest_first : false, |
36 always_visible : false, |
39 always_visible : false, |
37 start_visible: true, |
40 start_visible: true, |
38 show_audio : true, |
41 show_audio : true, |
39 show_filters : false, |
42 show_filters : false, |
|
43 keyword_filter: true, |
|
44 date_filter: true, |
|
45 user_filter: true, |
|
46 segment_filter: true, |
|
47 latest_contributions_filter: false, |
|
48 current_day_filter: true, |
40 show_header : false, |
49 show_header : false, |
41 custom_header : false, |
50 custom_header : false, |
|
51 annotations_count_header : true, |
42 show_creation_date : false, |
52 show_creation_date : false, |
43 show_timecode : true, |
53 show_timecode : true, |
44 /* |
54 /* |
45 * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget. |
55 * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget. |
46 */ |
56 */ |
|
57 allow_annotations_deletion: false, |
|
58 /* |
|
59 * URL to call when deleting annotation. Expects a mustache template with {{annotation_id}}, ex /api/anotations/{{annotation_id}}/ |
|
60 */ |
|
61 api_delete_endpoint : "", |
|
62 api_delete_method: "DELETE", |
|
63 api_users_endpoint: "", |
|
64 api_users_method: "GET", |
|
65 make_name_string_function: function(params){ |
|
66 return params.username ? params.username : "Anonymous"; |
|
67 }, |
47 filter_by_segments: false, |
68 filter_by_segments: false, |
|
69 segment_filter: true, |
48 segments_annotation_type: "chap", |
70 segments_annotation_type: "chap", |
49 /* |
71 /* |
50 * Set to a username if you only want to display annotations from a given user |
72 * Set to a username if you only want to display annotations from a given user |
51 */ |
73 */ |
52 show_only_annotation_from_user: false, |
74 show_only_annotation_from_user: false, |
53 /* |
75 /* |
54 * Show a text field that filter annotations by username |
76 * Show a text field that filter annotations by username |
55 */ |
77 */ |
56 filter_by_user: false, |
|
57 tags : true, |
78 tags : true, |
58 polemics : [{ |
79 polemics : [{ |
59 keyword: "++", |
80 keyword: "++", |
60 background_color: "#c9ecc6" |
81 background_color: "#c9ecc6" |
61 },{ |
82 },{ |
68 keyword: "==", |
89 keyword: "==", |
69 background_color: "#f9f4c6" |
90 background_color: "#f9f4c6" |
70 }] |
91 }] |
71 }; |
92 }; |
72 |
93 |
|
94 IriSP.Widgets.AnnotationsList.prototype.importUsers = function(){ |
|
95 if (!this.source.users_data){ |
|
96 this.usernames = Array(); |
|
97 var _this = this, |
|
98 _list = this.getWidgetAnnotations(), |
|
99 usernames_list_string = ""; |
|
100 |
|
101 _list.forEach(function(_annotation){ |
|
102 if(_this.usernames.indexOf(_annotation.creator) == -1){ |
|
103 _this.usernames.push(_annotation.creator); |
|
104 } |
|
105 }); |
|
106 this.usernames.forEach(function(_username){ |
|
107 usernames_list_string+=_username+"," |
|
108 }) |
|
109 usernames_list_string = usernames_list_string.substring(0, usernames_list_string.length - 1); |
|
110 _url = Mustache.to_html(this.api_users_endpoint, {usernames_list_string: encodeURIComponent(usernames_list_string), usernames_list_length: this.usernames.length}); |
|
111 return IriSP.jQuery.ajax({ |
|
112 async: false, |
|
113 url: _url, |
|
114 type: "GET", |
|
115 success: function(_data) { |
|
116 console.log(_data) |
|
117 _this.source.users_data = _data.objects |
|
118 }, |
|
119 error: function(_xhr, _error, _thrown) { |
|
120 console.log(_xhr) |
|
121 console.log(_error) |
|
122 console.log(_thrown) |
|
123 } |
|
124 }) |
|
125 } |
|
126 } |
|
127 |
73 IriSP.Widgets.AnnotationsList.prototype.messages = { |
128 IriSP.Widgets.AnnotationsList.prototype.messages = { |
74 en: { |
129 en: { |
75 voice_annotation: "Voice Annotation", |
130 voice_annotation: "Voice Annotation", |
76 now_playing: "Now playing...", |
131 now_playing: "Now playing...", |
77 everyone: "Everyone", |
132 everyone: "Everyone", |
78 header: "Annotations for this content" |
133 header: "Annotations for this content", |
|
134 segment_filter: "All cuttings", |
|
135 latest_contributions: "Latest contributions", |
|
136 close_widget: "Close", |
|
137 confirm: "Confirm", |
|
138 cancel: "Cancel", |
|
139 annotation_deletion_delete: "You will delete this annotation : ", |
|
140 annotation_deletion_sending: "Your deletion request is being sent ... ", |
|
141 annotation_deletion_success: "The annotation has been deleted.", |
|
142 annotation_deletion_error: "There was an error contacting the server. The annotation has not been deleted." |
79 }, |
143 }, |
80 fr: { |
144 fr: { |
81 voice_annotation: "Annotation Vocale", |
145 voice_annotation: "Annotation Vocale", |
82 now_playing: "Lecture en cours...", |
146 now_playing: "Lecture en cours...", |
83 everyone: "Tous", |
147 everyone: "Tous", |
84 header: "Annotations sur ce contenu" |
148 header: "Annotations sur ce contenu", |
|
149 segment_filter: "Tous les segments", |
|
150 latest_contributions: "Dernières contributions", |
|
151 close_widget: "Fermer", |
|
152 confirm: "Confirmer", |
|
153 cancel: "Annuler", |
|
154 annotation_deletion_delete: "Vous allez supprimer cette annotation: ", |
|
155 annotation_deletion_sending: "Votre demande de suppression est en cours d'envoi ... ", |
|
156 annotation_deletion_success: "L'annotation a été supprimée.", |
|
157 annotation_deletion_error: "Une erreur s'est produite en contactant le serveur. L'annotation n'a pas été supprimée." |
85 } |
158 } |
86 }; |
159 }; |
87 |
160 |
88 IriSP.Widgets.AnnotationsList.prototype.template = |
161 IriSP.Widgets.AnnotationsList.prototype.template = |
89 '{{#show_header}}<p class="Ldt-AnnotationsList-header">' |
162 '{{#show_header}}<p class="Ldt-AnnotationsList-header">' |
90 + '{{#custom_header}}{{custom_header}}{{/custom_header}}' |
163 + '{{#custom_header}}{{custom_header}}{{/custom_header}}' |
91 + '{{^custom_header}}{{l10n.header}}{{/custom_header}}' |
164 + '{{^custom_header}}{{l10n.header}}{{/custom_header}}' |
92 + '</p>{{/show_header}}' |
165 + '</p>{{/show_header}}' |
93 + '<div class="Ldt-AnnotationsListWidget">' |
166 + '<div class="Ldt-AnnotationsListWidget">' |
94 + '{{#show_filters}}' |
167 + '<div class="Ldt-AnnotationsList-ScreenMain">' |
95 + '<div class="Ldt-AnnotationsList-Filters">' |
168 + '{{#show_filters}}' |
96 + '<input class="Ldt-AnnotationsList-filter-text" id="Ldt-AnnotationsList-keywordsFilter" type="text" value=""></input>' |
169 + '<div class="Ldt-AnnotationsList-Filters">' |
97 + '<select class="Ldt-AnnotationsList-filter-dropdown" id="Ldt-AnnotationsList-userFilter"><option selected value="">{{l10n.everyone}}</option></select>' |
170 + '{{#keyword_filter}}<input class="Ldt-AnnotationsList-filter-text" id="Ldt-AnnotationsList-keywordsFilter" type="text" value=""></input>{{/keyword_filter}}' |
98 + '<label class="Ldt-AnnotationsList-filter-date">Date: <input id="Ldt-AnnotationsList-dateFilter" type="text"></input></label>' |
171 + '{{#user_filter}}<select class="Ldt-AnnotationsList-filter-dropdown" id="Ldt-AnnotationsList-userFilter"><option selected value="">{{l10n.everyone}}</option></select>{{/user_filter}}' |
99 + '<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-ignoreSegmentsFilter">Toutes annotations</label>' |
172 + '{{#date_filter}}<label class="Ldt-AnnotationsList-filter-date">Date: <input id="Ldt-AnnotationsList-dateFilter" type="text"></input></label>{{/date_filter}}' |
100 + '</div>' |
173 + '{{#segment_filter}}<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-ignoreSegmentsFilter">{{l10n.segment_filter}}</label>{{/segment_filter}}' |
101 + '{{/show_filters}}' |
174 + '{{#latest_contributions_filter}}<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-latestContributionsFilter">{{l10n.latest_contributions}}</label>{{/latest_contributions_filter}}' |
102 + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}' |
175 + '</div>' |
103 + '<ul class="Ldt-AnnotationsList-ul">' |
176 + '{{/show_filters}}' |
104 + '</ul>' |
177 + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}' |
|
178 + '<ul class="Ldt-AnnotationsList-ul">' |
|
179 + '</ul>' |
|
180 + '</div>' |
|
181 + '{{#allow_annotations_deletion}}' |
|
182 + '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenDelete">' |
|
183 + '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
184 + '<ul class="Ldt-AnnotationsList-ul-ToDelete"></ul>' |
|
185 + '{{l10n.annotation_deletion_delete}} <a class="Ldt-AnnotationsList-ConfirmDelete">{{l10n.confirm}}</a> <a class="Ldt-AnnotationsList-CancelDelete">{{l10n.cancel}}</a>' |
|
186 + '</div>' |
|
187 + '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenSending">' |
|
188 + '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
189 + '{{l10n.annotation_deletion_sending}}' |
|
190 + '</div>' |
|
191 + '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenSuccess">' |
|
192 + '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
193 + '{{l10n.annotation_deletion_success}}' |
|
194 + '</div>' |
|
195 + '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenError">' |
|
196 + '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
197 + '{{l10n.annotation_deletion_error}}' |
|
198 + '</div>' |
|
199 + '{{/allow_annotations_deletion}}' |
105 + '</div>'; |
200 + '</div>'; |
106 |
201 |
107 IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = |
202 IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = |
108 '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">' |
203 '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">' |
109 + '<div class="Ldt-AnnotationsList-ThumbContainer">' |
204 + '<div id="{{id}}" class="Ldt-AnnotationsList-ThumbContainer Ldt-AnnotationsList-Annotation-Screen Ldt-AnnotationsList-Annotation-ScreenMain">' |
110 + '<a href="{{url}}" draggable="true">' |
205 + '<a href="{{url}}" draggable="true">' |
111 + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />' |
206 + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />' |
112 + '</a>' |
207 + '</a>' |
113 + '</div>' |
208 + '</div>' |
|
209 + '{{#allow_annotations_deletion}}' |
|
210 + '<div id={{id}} class="Ldt-AnnotationsList-DeleteButton">✖</div>' |
|
211 + '{{/allow_annotations_deletion}}' |
114 + '{{#show_timecode}}<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>{{/show_timecode}}' |
212 + '{{#show_timecode}}<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>{{/show_timecode}}' |
115 + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">' |
213 + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">' |
116 + '<a href="{{url}}">{{{htitle}}}</a>' |
214 + '<a {{#url}} href="{{url}}" {{/url}}>{{{htitle}}}</a>' |
117 + '</h3>' |
215 + '</h3>' |
118 + '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>' |
216 + '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>' |
119 + '{{#created}}' |
217 + '{{#created}}' |
120 + '<div class="Ldt-AnnotationsList-CreationDate">{{{created}}}</div>' |
218 + '<div class="Ldt-AnnotationsList-CreationDate">{{{created}}}</div>' |
121 + '{{/created}}' |
219 + '{{/created}}' |
238 return _annotation.begin; |
345 return _annotation.begin; |
239 }); |
346 }); |
240 } |
347 } |
241 |
348 |
242 if (this.show_filters){ |
349 if (this.show_filters){ |
243 _username = this.userselect_$[0].options[this.userselect_$[0].selectedIndex].value; |
350 if (this.user_filter){ |
244 if (_username != "false") |
351 _username = this.userselect_$[0].options[this.userselect_$[0].selectedIndex].value; |
245 { |
352 if (_username != "false") |
246 _list = _list.filter(function(_annotation){ |
353 { |
247 return _annotation.creator == _username |
354 _list = _list.filter(function(_annotation){ |
248 }) |
355 return _annotation.creator == _username |
249 } |
356 }) |
|
357 } |
|
358 } |
|
359 if (this.keyword_filter){ |
250 _keyword = this.keywordinput_$[0].value; |
360 _keyword = this.keywordinput_$[0].value; |
251 if (_keyword != ""){ |
361 if (_keyword != ""){ |
252 _list = _list.filter(function(_annotation){ |
362 _list = _list.filter(function(_annotation){ |
253 return _annotation.description.toLowerCase().match(_keyword.toLowerCase()); |
363 return _annotation.description.toLowerCase().match(_keyword.toLowerCase()); |
254 }); |
364 }); |
255 } |
365 } |
256 |
366 } |
257 |
367 if (this.date_filter){ |
258 if(this.datefilterinput_$[0].value != ""){ |
368 if(this.datefilterinput_$[0].value != ""){ |
259 _date = this.datefilterinput_$.datepicker("getDate"); |
369 _date = this.datefilterinput_$.datepicker("getDate"); |
260 _list = _list.filter(function(_annotation){ |
370 _list = _list.filter(function(_annotation){ |
261 return ((_annotation.created.getDate() == _date.getDate())&&(_annotation.created.getMonth() == _date.getMonth())&&(_annotation.created.getFullYear() == _date.getFullYear())) |
371 return ((_annotation.created.getDate() == _date.getDate())&&(_annotation.created.getMonth() == _date.getMonth())&&(_annotation.created.getFullYear() == _date.getFullYear())); |
|
372 }); |
|
373 } |
|
374 } |
|
375 if (this.latest_contributions_filter && this.latestcontributionscheckbox_$[0].checked){ |
|
376 _list = _list.sortBy(function(_annotation) { |
|
377 return -_annotation.created.valueOf(); |
|
378 }); |
|
379 this.usernames.forEach(function(_user){ |
|
380 |
|
381 latest_ann = _list.filter(function(_annotation){ |
|
382 return _annotation.creator == _user; |
|
383 })[0]; |
|
384 _list = _list.filter(function(_annotation){ |
|
385 return _annotation.id == (latest_ann ? latest_ann.id : false) || _annotation.creator != _user; |
|
386 }); |
262 }); |
387 }); |
263 } |
388 } |
264 |
389 |
265 } |
390 } |
266 |
391 |
438 } |
576 } |
439 } |
577 } |
440 |
578 |
441 return _list.length; |
579 return _list.length; |
442 }; |
580 }; |
|
581 |
|
582 IriSP.Widgets.AnnotationsList.prototype.onDeleteClick = function(event){ |
|
583 |
|
584 ann_id = event.target.id; |
|
585 console.log(ann_id) |
|
586 delete_preview_$ = this.$.find(".Ldt-AnnotationsList-ul-ToDelete"); |
|
587 delete_preview_$.html(""); |
|
588 _list = this.getWidgetAnnotations() |
|
589 _list = _list.filter(function(_annotation){ |
|
590 return _annotation.id == ann_id |
|
591 }) |
|
592 var _annotation = _list[0], |
|
593 _title = "", |
|
594 _this = this; |
|
595 console.log(_annotation) |
|
596 if (_annotation.creator) { |
|
597 var _users = _this.source.users_data.filter(function(_user_data){ |
|
598 return _user_data.username == _annotation.creator |
|
599 }), |
|
600 _user = {}; |
|
601 if (_users.length == 0){ |
|
602 _user.username = _annotation.creator |
|
603 } |
|
604 else{ |
|
605 _user = _users[0] |
|
606 } |
|
607 _title = _this.make_name_string_function(_user); |
|
608 } |
|
609 if (_annotation.title) { |
|
610 var tempTitle = _annotation.title; |
|
611 if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){ |
|
612 _title = ""; |
|
613 } |
|
614 _title = _title + ( (_title=="") ? "" : ": ") + _annotation.title; |
|
615 } |
|
616 var _created = false; |
|
617 if (this.show_creation_date) { |
|
618 _created = _annotation.created.toLocaleDateString()+", "+_annotation.created.toLocaleTimeString(); |
|
619 } |
|
620 var _data = { |
|
621 id : _annotation.id, |
|
622 media_id : _annotation.getMedia().id, |
|
623 htitle : IriSP.textFieldHtml(_title), |
|
624 hdescription : IriSP.textFieldHtml(_annotation.description), |
|
625 begin : _annotation.begin.toString(), |
|
626 end : _annotation.end.toString(), |
|
627 created : _created, |
|
628 show_timecode : this.show_timecode, |
|
629 tags : false, |
|
630 l10n: this.l10n, |
|
631 allow_annotations_deletion: false |
|
632 } |
|
633 _html = Mustache.to_html(this.annotationTemplate, _data) |
|
634 delete_preview_$.html(_html) |
|
635 |
|
636 this.$.find(".Ldt-AnnotationsList-ConfirmDelete").click(function(){ |
|
637 _this.sendDelete(ann_id); |
|
638 }); |
|
639 |
|
640 this.showScreen("Delete"); |
|
641 } |
|
642 |
|
643 IriSP.Widgets.AnnotationsList.prototype.refreshHeader = function() { |
|
644 var annotation_count_string = " (" + this.annotations_count +" annotations)"; |
|
645 this.$.find('.Ldt-AnnotationsList-header').html(""); |
|
646 this.$.find('.Ldt-AnnotationsList-header').html( |
|
647 this.custom_header && typeof this.custom_header == "string"? this.custom_header + annotation_count_string : this.l10n.header + annotation_count_string |
|
648 ); |
|
649 } |
443 |
650 |
444 IriSP.Widgets.AnnotationsList.prototype.hide = function() { |
651 IriSP.Widgets.AnnotationsList.prototype.hide = function() { |
445 var _this = this; |
652 var _this = this; |
446 if (this.visible){ |
653 if (this.visible){ |
447 this.visible = false; |
654 this.visible = false; |
448 this.widget_$.slideUp(function(){ |
655 this.widget_$.slideUp(function(){ |
449 _this.$.find('.Ldt-AnnotationsList-header').hide(); |
656 _this.$.find('.Ldt-AnnotationsList-header').hide(); |
450 }); |
657 }); |
|
658 this.showScreen("Main") |
451 } |
659 } |
452 } |
660 } |
453 |
661 |
454 IriSP.Widgets.AnnotationsList.prototype.show = function() { |
662 IriSP.Widgets.AnnotationsList.prototype.show = function() { |
455 if(!this.visible){ |
663 if(!this.visible){ |
456 this.visible = true; |
664 this.visible = true; |
457 this.$.find('.Ldt-AnnotationsList-header').show(); |
665 this.$.find('.Ldt-AnnotationsList-header').show(); |
458 this.widget_$.slideDown(); |
666 this.widget_$.slideDown(); |
|
667 this.showScreen("Main") |
459 } |
668 } |
460 } |
669 } |
461 |
670 |
462 |
671 |
463 IriSP.Widgets.AnnotationsList.prototype.toggle = function() { |
672 IriSP.Widgets.AnnotationsList.prototype.toggle = function() { |
468 this.show(); |
677 this.show(); |
469 } |
678 } |
470 } |
679 } |
471 }; |
680 }; |
472 |
681 |
|
682 IriSP.Widgets.AnnotationsList.prototype.revertToMainScreen = function(){ |
|
683 if (this.$.find(".Ldt-AnnotationsList-ScreenMain").is(":hidden")){ |
|
684 this.showScreen("Main"); |
|
685 } |
|
686 } |
|
687 |
|
688 IriSP.Widgets.AnnotationsList.prototype.sendDelete = function(id){ |
|
689 console.log("deleting "+id) |
|
690 var _this = this, |
|
691 _url = Mustache.to_html(this.api_delete_endpoint, {annotation_id: id}) |
|
692 |
|
693 IriSP.jQuery.ajax({ |
|
694 url: _url, |
|
695 type: this.api_delete_method, |
|
696 contentType: 'application/json', |
|
697 success: function(_data) { |
|
698 _this.showScreen('Success'); |
|
699 window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 2000)); |
|
700 _this.currentSource.getAnnotations().removeId(id); |
|
701 _this.player.trigger("AnnotationsList.refresh"); |
|
702 }, |
|
703 error: function(_xhr, _error, _thrown) { |
|
704 IriSP.log("Error when sending annotation", _thrown); |
|
705 _this.showScreen('Error'); |
|
706 window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 2000)); |
|
707 } |
|
708 }); |
|
709 this.showScreen('Sending'); |
|
710 } |
|
711 |
473 IriSP.Widgets.AnnotationsList.prototype.draw = function() { |
712 IriSP.Widgets.AnnotationsList.prototype.draw = function() { |
474 |
|
475 this.jwplayers = {}; |
713 this.jwplayers = {}; |
476 this.mashupMode = (this.media.elementType === "mashup"); |
714 this.mashupMode = (this.media.elementType === "mashup"); |
477 |
715 |
478 this.renderTemplate(); |
716 this.renderTemplate(); |
479 |
717 |
480 var _this = this; |
718 var _this = this; |
481 |
719 |
482 this.list_$ = this.$.find(".Ldt-AnnotationsList-ul"); |
720 this.list_$ = this.$.find(".Ldt-AnnotationsList-ul"); |
483 this.widget_$ = this.$.find(".Ldt-AnnotationsListWidget"); |
721 this.widget_$ = this.$.find(".Ldt-AnnotationsListWidget"); |
484 this.userselect_$ = this.$.find("#Ldt-AnnotationsList-userFilter"); |
722 |
485 this.userselect_$.change(function(){ |
723 if (this.show_filters){ |
486 _this.player.trigger("AnnotationsList.refresh"); |
724 if (this.user_filter){ |
487 }); |
725 this.userselect_$ = this.$.find("#Ldt-AnnotationsList-userFilter"); |
488 this.keywordinput_$ = this.$.find("#Ldt-AnnotationsList-keywordsFilter"); |
726 this.userselect_$.change(function(){ |
489 this.keywordinput_$.keyup(function(){ |
727 _this.player.trigger("AnnotationsList.refresh"); |
490 _this.player.trigger("AnnotationsList.refresh"); |
728 }); |
491 }); |
729 this.userselect_$.html("<option selected value='false'>"+this.l10n.everyone+"</option>"); |
492 this.ignoresegmentcheckbox_$ = this.$.find("#Ldt-AnnotationsList-ignoreSegmentsFilter"); |
730 this.usernames.forEach(function(_user){ |
493 this.ignoresegmentcheckbox_$.click(function(){ |
731 _this.userselect_$.append("<option value='"+_user+"'>"+_user+"</option>"); |
494 _this.player.trigger("AnnotationsList.refresh"); |
732 }); |
495 }); |
733 } |
496 this.datefilterinput_$ = this.$.find("#Ldt-AnnotationsList-dateFilter"); |
734 if (this.keyword_filter){ |
497 this.datefilterinput_$.datepicker({ dateFormat: 'dd/mm/yy' }); |
735 this.keywordinput_$ = this.$.find("#Ldt-AnnotationsList-keywordsFilter"); |
498 this.datefilterinput_$.change(function(){ |
736 this.keywordinput_$.keyup(function(){ |
499 _this.player.trigger("AnnotationsList.refresh") |
737 _this.player.trigger("AnnotationsList.refresh"); |
500 }) |
738 }); |
|
739 |
|
740 } |
|
741 if (this.segment_filter){ |
|
742 this.ignoresegmentcheckbox_$ = this.$.find("#Ldt-AnnotationsList-ignoreSegmentsFilter"); |
|
743 this.ignoresegmentcheckbox_$.click(function(){ |
|
744 _this.player.trigger("AnnotationsList.refresh"); |
|
745 }); |
|
746 } |
|
747 if(this.date_filter){ |
|
748 this.datefilterinput_$ = this.$.find("#Ldt-AnnotationsList-dateFilter"); |
|
749 this.datefilterinput_$.datepicker({ dateFormat: 'dd/mm/yy' }); |
|
750 this.datefilterinput_$.change(function(){ |
|
751 _this.player.trigger("AnnotationsList.refresh") |
|
752 }) |
|
753 if (this.current_day_filter){ |
|
754 currentDate = new Date(); |
|
755 this.datefilterinput_$.datepicker("setDate",currentDate); |
|
756 } |
|
757 } |
|
758 if(this.latest_contributions_filter){ |
|
759 this.latestcontributionscheckbox_$ = this.$.find("#Ldt-AnnotationsList-latestContributionsFilter"); |
|
760 this.latestcontributionscheckbox_$.click(function(){ |
|
761 _this.player.trigger("AnnotationsList.refresh"); |
|
762 }); |
|
763 } |
|
764 } |
501 |
765 |
502 this.source.getAnnotations().on("search", function(_text) { |
766 this.source.getAnnotations().on("search", function(_text) { |
503 _this.searchString = _text; |
767 _this.searchString = _text; |
504 if (_this.source !== _this.currentSource) { |
768 if (_this.source !== _this.currentSource) { |
505 _this.currentSource.getAnnotations().search(_text); |
769 _this.currentSource.getAnnotations().search(_text); |