| author | durandn |
| Fri, 18 Sep 2015 14:32:28 +0200 | |
| changeset 1048 | 13211bca0256 |
| parent 1046 | eb77616c245f |
| child 1069 | 2409cb4cebaf |
| permissions | -rw-r--r-- |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
1 |
/* |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
2 |
* Widget that ties AnnotationList and CreateAnnotation together |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
3 |
* using buttons to hide/show AnnotationList and CreateAnnotation widgets. |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
4 |
* |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
5 |
*/ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
6 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
7 |
IriSP.Widgets.AnnotationsController = function(player, config){ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
8 |
IriSP.Widgets.Widget.call(this, player, config); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
9 |
}; |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
10 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
11 |
IriSP.Widgets.AnnotationsController.prototype = new IriSP.Widgets.Widget(); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
12 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
13 |
IriSP.Widgets.AnnotationsController.prototype.defaults = { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
14 |
// If true, displaying AnnotationList will hide CreateAnnotation and vice versa. |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
15 |
display_or_write: false, |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
16 |
starts_hidden: false, |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
17 |
hide_without_segment: false, |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
18 |
segments_annotation_type: "chap", |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
19 |
}; |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
20 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
21 |
IriSP.Widgets.AnnotationsController.prototype.template = |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
22 |
"<div class='Ldt-AnnotationsController'>" |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
23 |
+ "<div class='Ldt-AnnotationsController-ButtonsContainer'>" |
|
1048
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
24 |
+ " <div class='Ldt-AnnotationsController-Button Ldt-AnnotationsController-ShowCreateAnnotationButton'>{{l10n.write}}</div>" |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
25 |
+ " <div class='Ldt-AnnotationsController-Button Ldt-AnnotationsController-ShowAnnotationsListButton'>{{l10n.display}}</div>" |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
26 |
+ "</div>" |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
27 |
+ "</div>" |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
28 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
29 |
IriSP.Widgets.AnnotationsController.prototype.messages = { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
30 |
en : { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
31 |
write : "Write", |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
32 |
display : "Display", |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
33 |
}, |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
34 |
fr : { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
35 |
write : "Ecrire", |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
36 |
display : "Voir" |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
37 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
38 |
}; |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
39 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
40 |
IriSP.Widgets.AnnotationsController.prototype.draw = function() { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
41 |
this.renderTemplate(); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
42 |
var _this = this; |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
43 |
this.element_$ = this.$.find(".Ldt-AnnotationsController") |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
44 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
45 |
this.displayButton_$ = this.$.find(".Ldt-AnnotationsController-ShowAnnotationsListButton"); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
46 |
this.writeButton_$ = this.$.find(".Ldt-AnnotationsController-ShowCreateAnnotationButton"); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
47 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
48 |
this.writeButton_$.click(function(){ |
|
1048
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
49 |
if (!_this.writeButton_$.hasClass("selected")){ |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
50 |
_this.player.trigger("CreateAnnotation.show") |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
51 |
} |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
52 |
else { |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
53 |
_this.player.trigger("CreateAnnotation.hide") |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
54 |
} |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
55 |
if (_this.display_or_write){ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
56 |
_this.player.trigger("AnnotationsList.hide"); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
57 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
58 |
}); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
59 |
this.displayButton_$.click(function(){ |
|
1048
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
60 |
if (!_this.displayButton_$.hasClass("selected")){ |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
61 |
_this.player.trigger("AnnotationsList.show") |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
62 |
} |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
63 |
else { |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
64 |
_this.player.trigger("AnnotationsList.hide") |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
65 |
} |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
66 |
if (_this.display_or_write){ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
67 |
_this.player.trigger("CreateAnnotation.hide"); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
68 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
69 |
}) |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
70 |
|
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
71 |
if(this.hide_without_segment){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
72 |
this.onMediaEvent("timeupdate", function(){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
73 |
_this.refresh(); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
74 |
}) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
75 |
this.onMediaEvent("settimerange", function(_timeRange){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
76 |
_this.refresh(_timeRange); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
77 |
}) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
78 |
this.segments = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
79 |
this.currentSegment = false |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
80 |
} |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
81 |
|
|
1048
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
82 |
this.onMdpEvent("CreateAnnotation.hide", function(){ |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
83 |
_this.writeButton_$.toggleClass("selected", false); |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
84 |
}) |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
85 |
this.onMdpEvent("CreateAnnotation.show", function(){ |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
86 |
_this.writeButton_$.toggleClass("selected", true); |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
87 |
}) |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
88 |
this.onMdpEvent("AnnotationsList.hide", function(){ |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
89 |
_this.displayButton_$.toggleClass("selected", false); |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
90 |
}) |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
91 |
this.onMdpEvent("AnnotationsList.show", function(){ |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
92 |
_this.displayButton_$.toggleClass("selected", true); |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
93 |
}) |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
94 |
|
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
95 |
if (this.starts_hidden) { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
96 |
this.visible = true |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
97 |
this.hide(); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
98 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
99 |
else{ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
100 |
this.visible = false |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
101 |
this.show(); |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
102 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
103 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
104 |
}; |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
105 |
|
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
106 |
IriSP.Widgets.AnnotationsController.prototype.refresh = function(_timeRange){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
107 |
_timeRange = typeof _timeRange !== 'undefined' ? _timeRange : false ; |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
108 |
|
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
109 |
if(!_timeRange){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
110 |
if (this.media.getTimeRange()){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
111 |
_timeRange = this.media.getTimeRange(); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
112 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
113 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
114 |
|
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
115 |
if (this.hide_without_segment){ |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
116 |
if (!_timeRange && !this.media.getTimeRange()){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
117 |
_currentTime = this.media.getCurrentTime() |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
118 |
_currentSegments = this.segments.filter(function(_segment){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
119 |
return (_currentTime >= _segment.begin && _currentTime <= _segment.end) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
120 |
}); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
121 |
if(_currentSegments.length > 0){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
122 |
currentSegment = true; |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
123 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
124 |
else { |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
125 |
currentSegment = false; |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
126 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
127 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
128 |
else { |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
129 |
var _timeRangeBegin = _timeRange[0], |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
130 |
_timeRangeEnd = _timeRange[1]; |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
131 |
_currentSegments = this.segments.filter(function(_segment){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
132 |
return (_timeRangeBegin == _segment.begin && _timeRangeEnd == _segment.end) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
133 |
}); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
134 |
if(_currentSegments.length > 0){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
135 |
currentSegment = true; |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
136 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
137 |
else { |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
138 |
currentSegment = false; |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
139 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
140 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
141 |
if (!currentSegment && _currentSegments.length == 0){ |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
142 |
if (this.visible){ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
143 |
this.hide(); |
|
1048
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
144 |
this.writeButton_$.toggleClass("selected", false); |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
145 |
this.displayButton_$.toggleClass("selected", false); |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
146 |
this.player.trigger("CreateAnnotation.hide"); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
147 |
this.player.trigger("AnnotationsList.hide"); |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
148 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
149 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
150 |
else { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
151 |
if (!this.visible){ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
152 |
this.show(); |
|
1048
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
153 |
this.writeButton_$.toggleClass("selected", false); |
|
13211bca0256
Updated Annotation controller to assign "selected" class to buttons when they get clicked on, for use in custom css.
durandn
parents:
1046
diff
changeset
|
154 |
this.displayButton_$.toggleClass("selected", false); |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
155 |
this.player.trigger("CreateAnnotation.hide"); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1039
diff
changeset
|
156 |
this.player.trigger("AnnotationsList.hide"); |
|
1039
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
157 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
158 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
159 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
160 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
161 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
162 |
IriSP.Widgets.AnnotationsController.prototype.hide = function() { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
163 |
if (this.visible){ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
164 |
this.visible = false; |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
165 |
this.element_$.hide() |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
166 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
167 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
168 |
|
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
169 |
IriSP.Widgets.AnnotationsController.prototype.show = function() { |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
170 |
if(!this.visible){ |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
171 |
this.visible = true; |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
172 |
this.element_$.show() |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
173 |
} |
|
4fddc765a716
New widget AnnotationsController that displays buttons to hide/show AnnotationsList and CreateAnnotations
durandn
parents:
diff
changeset
|
174 |
} |