src/widgets/LatestAnnotation.js
author durandn
Fri, 18 Sep 2015 14:44:36 +0200
changeset 1053 149a4ea20ea7
parent 1046 eb77616c245f
child 1054 cfea8c04c8c7
permissions -rw-r--r--
Added support for deleting annotations + Added support for displaying user names under another format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     1
/* Widget that displays the last annotation that was posted, optionally for current segment, optionally for a given username */
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     2
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     3
IriSP.Widgets.LatestAnnotation = function(player, config){
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     4
    IriSP.Widgets.Widget.call(this, player, config);
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     5
};
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     6
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     7
IriSP.Widgets.LatestAnnotation.prototype = new IriSP.Widgets.Widget();
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     8
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
     9
IriSP.Widgets.LatestAnnotation.prototype.defaults = {
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    10
    from_user: false,
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    11
    filter_by_segment: false,
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    12
    segments_annotation_type: "chap",
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    13
    hide_without_segment: false,
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    14
    annotation_type: "contribution",
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    15
    /*
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    16
     * Set to a username if you only want to display annotations from a given user
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    17
     */
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    18
    show_only_annotation_from_user: 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: 1041
diff changeset
    19
    /*
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: 1041
diff changeset
    20
     * Displays a button that copy currently displayed annotation into CreateAnnotation input field
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: 1041
diff changeset
    21
     */
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: 1041
diff changeset
    22
    copy_and_edit_button: 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: 1041
diff changeset
    23
    /*
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: 1041
diff changeset
    24
     * Allows clicks on an annotation from Annotations to display the annotation content into this widget
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: 1041
diff changeset
    25
     */
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: 1041
diff changeset
    26
    selectable_annotations: false,
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    27
    empty_message: false,
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    28
    starts_hidden: 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: 1041
diff changeset
    29
    show_header: 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: 1041
diff changeset
    30
    custom_header: false,
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    31
};
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    32
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: 1041
diff changeset
    33
IriSP.Widgets.LatestAnnotation.prototype.messages = {
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: 1041
diff changeset
    34
    fr : {
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: 1041
diff changeset
    35
        copy_and_edit: "Copier et Editer",
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: 1041
diff changeset
    36
        empty : "Aucune annotation à afficher",
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: 1041
diff changeset
    37
        header: "Dernière annotation"
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: 1041
diff changeset
    38
    },
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: 1041
diff changeset
    39
    en: {
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: 1041
diff changeset
    40
        copy_and_edit: "Copy and Edit",
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: 1041
diff changeset
    41
        empty: "No annotation to display",
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: 1041
diff changeset
    42
        header: "Last annotation"
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: 1041
diff changeset
    43
    }
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: 1041
diff changeset
    44
}
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: 1041
diff changeset
    45
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    46
IriSP.Widgets.LatestAnnotation.prototype.template = 
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: 1041
diff changeset
    47
    "{{#show_header}}"
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: 1041
diff changeset
    48
    + "<p class='Ldt-LatestAnnotation-header'>"
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: 1041
diff changeset
    49
    +     "{{#custom_header}}{{custom_header}}{{/custom_header}}"
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: 1041
diff changeset
    50
    +     "{{^custom_header}}{{l10n.header}}{{/custom_header}}"
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: 1041
diff changeset
    51
    + "</p>"
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: 1041
diff changeset
    52
    + "{{/show_header}}"
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: 1041
diff changeset
    53
    + "<div class='Ldt-LatestAnnotation'>"
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    54
    + "</div>";
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    55
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    56
IriSP.Widgets.LatestAnnotation.prototype.annotationTemplate =
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    57
    "<div class='Ldt-LatestAnnotation-Box'>"
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: 1041
diff changeset
    58
    +     "<div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-CreationDate'>{{{annotation_created}}}</div>" 
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: 1041
diff changeset
    59
    +     "<div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-Title'>{{{annotation_creator}}}{{#annotation_title}}: {{{annotation_title}}}{{/annotation_title}}</div>" 
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: 1041
diff changeset
    60
    +     "<div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-Content'>"
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    61
    +         "{{{annotation_content}}}"
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: 1041
diff changeset
    62
    +     "</div>"
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: 1041
diff changeset
    63
    + "{{#copy_and_edit_button}}<div class='Ldt-LatestAnnotation-CopyEditButton'>{{button_text}}</div>{{/copy_and_edit_button}}"
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    64
    + "</div>"
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    65
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: 1041
diff changeset
    66
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    67
IriSP.Widgets.LatestAnnotation.prototype.draw = function(){
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    68
    var _this = this;
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    69
    this.renderTemplate();
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    70
    
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    71
    this.annotationContainer_$ = this.$.find('.Ldt-LatestAnnotation');
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
    72
    
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: 1041
diff changeset
    73
    if (this.selectable_annotations){
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: 1041
diff changeset
    74
        this.onMdpEvent("AnnotationsList.refresh", 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: 1041
diff changeset
    75
            _this.getWidgetAnnotations().forEach(function(_annotation){
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: 1041
diff changeset
    76
                _annotation.off("click");
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: 1041
diff changeset
    77
                _annotation.on("click", 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: 1041
diff changeset
    78
                    _html = Mustache.to_html(_this.annotationTemplate, {
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: 1041
diff changeset
    79
                        annotation_created: _annotation.created.toLocaleDateString()+", "+_annotation.created.toLocaleTimeString(),
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: 1041
diff changeset
    80
                        annotation_creator: _annotation.creator,
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: 1041
diff changeset
    81
                        annotation_title: _annotation.title,
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: 1041
diff changeset
    82
                        annotation_content: _annotation.description,
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: 1041
diff changeset
    83
                        copy_and_edit_button: _this.copy_and_edit_button,
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: 1041
diff changeset
    84
                        button_text: _this.l10n.copy_and_edit,
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: 1041
diff changeset
    85
                    });
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: 1041
diff changeset
    86
                    _this.annotationContainer_$.html(_html);
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: 1041
diff changeset
    87
                    _this.selectedAnnotation = 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: 1041
diff changeset
    88
                });
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: 1041
diff changeset
    89
            }); 
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: 1041
diff changeset
    90
        });
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: 1041
diff changeset
    91
        
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: 1041
diff changeset
    92
        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: 1041
diff changeset
    93
        this.segments.forEach(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: 1041
diff changeset
    94
            _segment.on("click", 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: 1041
diff changeset
    95
                _this.selectedAnnotation = 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: 1041
diff changeset
    96
            })
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: 1041
diff changeset
    97
        })
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: 1041
diff changeset
    98
        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: 1041
diff changeset
    99
    }
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: 1041
diff changeset
   100
    
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: 1041
diff changeset
   101
    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: 1041
diff changeset
   102
        _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: 1041
diff changeset
   103
    });
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: 1041
diff changeset
   104
    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: 1041
diff changeset
   105
        _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: 1041
diff changeset
   106
    })
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   107
    
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   108
    if (this.starts_hidden){
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   109
        this.visible = true;
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   110
        this.hide();
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   111
    }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   112
    else{
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   113
        this.visible = false;
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   114
        this.show();
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   115
    }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   116
    
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: 1041
diff changeset
   117
    this.selectedAnnotation = false; // This flag tells the widget if it must display last annotation (false) or clicked annotation (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: 1041
diff changeset
   118
    this.player.trigger("AnnotationsList.refresh");
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   119
    this.refresh();
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   120
}
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   121
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   122
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: 1041
diff changeset
   123
IriSP.Widgets.LatestAnnotation.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: 1041
diff changeset
   124
    _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: 1041
diff changeset
   125
    var _this = this;
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   126
    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: 1041
diff changeset
   127
        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: 1041
diff changeset
   128
            var _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: 1041
diff changeset
   129
            var _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: 1041
diff changeset
   130
                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: 1041
diff changeset
   131
            });
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: 1041
diff changeset
   132
            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: 1041
diff changeset
   133
                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: 1041
diff changeset
   134
                this.selectedAnnotation = 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: 1041
diff changeset
   135
            }
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: 1041
diff changeset
   136
            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: 1041
diff changeset
   137
                this.currentSegment = _currentSegments[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: 1041
diff changeset
   138
            }
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: 1041
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: 1041
diff changeset
   140
        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: 1041
diff changeset
   141
            var _segmentBegin = _timeRange? _timeRange[0] : this.media.getTimeRange()[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: 1041
diff changeset
   142
                _segmentEnd = _timeRange? _timeRange[1] : this.media.getTimeRange()[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: 1041
diff changeset
   143
            if ((!this.currentSegment)||(this.currentSegment.begin != _segmentBegin || this.currentSegment.end != _segmentEnd)) {
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: 1041
diff changeset
   144
                var _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: 1041
diff changeset
   145
                    return _segment.begin == _segmentBegin && _segment.end == _segmentEnd
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: 1041
diff changeset
   146
                });
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: 1041
diff changeset
   147
                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: 1041
diff changeset
   148
                    this.selectedAnnotation = 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: 1041
diff changeset
   149
                    this.currentSegment = _currentSegments[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: 1041
diff changeset
   150
                }
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: 1041
diff changeset
   151
            }
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: 1041
diff changeset
   152
        }
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: 1041
diff changeset
   153
        if (!this.currentSegment){
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   154
            if (this.visible){
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: 1041
diff changeset
   155
                this.hide();
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   156
            }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   157
        }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   158
        else {
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   159
            if (!this.visible){
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: 1041
diff changeset
   160
                this.show();
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   161
            }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   162
        }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   163
    }
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: 1041
diff changeset
   164
    
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: 1041
diff changeset
   165
    if (this.visible && !this.selectedAnnotation){
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   166
        var _list = this.getWidgetAnnotations();
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: 1041
diff changeset
   167
        
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   168
        if(this.filter_by_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: 1041
diff changeset
   169
            if (!this.currentSegment) {
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   170
                _list = _list.filter(function(_annotation){
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   171
                    return false;
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   172
                });
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   173
            }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   174
            else {
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   175
                _list = _list.filter(function(_annotation){
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   176
                    _annotationTime = (_annotation.begin+_annotation.end)/2;
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: 1041
diff changeset
   177
                    return (_this.currentSegment.begin <= _annotationTime && _this.currentSegment.end >= _annotationTime);
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   178
                });
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   179
            }
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: 1041
diff changeset
   180
        }
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: 1041
diff changeset
   181
        _list = _list.sortBy(function(_annotation){
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: 1041
diff changeset
   182
            return _annotation.created;
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: 1041
diff changeset
   183
        });
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: 1041
diff changeset
   184
        
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: 1041
diff changeset
   185
        var _latestAnnotation = 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: 1041
diff changeset
   186
        var _html="";
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: 1041
diff changeset
   187
        if (_list.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: 1041
diff changeset
   188
            _latestAnnotation = _list.pop();
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: 1041
diff changeset
   189
            _html = Mustache.to_html(this.annotationTemplate, {
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: 1041
diff changeset
   190
                annotation_created: _latestAnnotation.created.toLocaleDateString()+", "+_latestAnnotation.created.toLocaleTimeString(),
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: 1041
diff changeset
   191
                annotation_creator: _latestAnnotation.creator,
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: 1041
diff changeset
   192
                annotation_title: _latestAnnotation.title,
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: 1041
diff changeset
   193
                annotation_content: _latestAnnotation.description,
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: 1041
diff changeset
   194
                copy_and_edit_button: this.copy_and_edit_button,
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: 1041
diff changeset
   195
                button_text: this.l10n.copy_and_edit,
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   196
            });
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: 1041
diff changeset
   197
        }
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: 1041
diff changeset
   198
        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: 1041
diff changeset
   199
            var _empty_message = this.l10n.empty
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: 1041
diff changeset
   200
            if (this.empty_message) {
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: 1041
diff changeset
   201
                _empty_message = this.empty_message
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   202
            }
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: 1041
diff changeset
   203
            _html = "<div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-NoAnnotation'>"+_empty_message+"</div>";
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   204
        }
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: 1041
diff changeset
   205
        this.annotationContainer_$.html(_html);    
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   206
    }
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: 1041
diff changeset
   207
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: 1041
diff changeset
   208
    if(this.copy_and_edit_button){
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: 1041
diff changeset
   209
        this.copyAndEditButton_$ = this.$.find('.Ldt-LatestAnnotation-CopyEditButton');
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: 1041
diff changeset
   210
        this.copyAndEditButton_$.click(this.functionWrapper("copy_and_edit"));
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: 1041
diff changeset
   211
    }
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: 1041
diff changeset
   212
}
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: 1041
diff changeset
   213
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: 1041
diff changeset
   214
IriSP.Widgets.LatestAnnotation.prototype.copy_and_edit = 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: 1041
diff changeset
   215
    this.player.trigger("CreateAnnotation.show");
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: 1041
diff changeset
   216
    this.player.trigger("AnnotationsList.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: 1041
diff changeset
   217
    annotationText = $('.Ldt-LatestAnnotation-Content').get(0).innerHTML;
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: 1041
diff changeset
   218
    
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: 1041
diff changeset
   219
    $('.Ldt-CreateAnnotation-Description').removeClass('empty');
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: 1041
diff changeset
   220
    $('.Ldt-CreateAnnotation-Description').val(annotationText);
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   221
}
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   222
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   223
IriSP.Widgets.LatestAnnotation.prototype.hide = function() {
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   224
    if (this.visible){
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   225
        this.visible = 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: 1041
diff changeset
   226
        this.$.find('.Ldt-LatestAnnotation-header').hide();
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   227
        this.annotationContainer_$.hide()
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   228
    }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   229
}
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   230
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   231
IriSP.Widgets.LatestAnnotation.prototype.show = function() {
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   232
    if(!this.visible){
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   233
        this.visible = true;
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: 1041
diff changeset
   234
        this.$.find('.Ldt-LatestAnnotation-header').show();
1041
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   235
        this.annotationContainer_$.show()
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   236
    }
423a8c6f9c4d New widget LastAnnotation that currently displays last annotation posted (can be configured to work for currently viewed segment)
durandn
parents:
diff changeset
   237
}