src/widgets/CurrentSegmentInfobox.js
author ymh <ymh.work@gmail.com>
Sun, 12 Nov 2017 22:07:33 +0100
changeset 1071 02c04d2c8fd8
parent 1069 2409cb4cebaf
child 1072 ac1eacb3aa33
permissions -rw-r--r--
Various changes from git version and make autoplayer determine video type on lowercase url
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     1
/* Widget displays info on the current segment, with possibility of config for editing description and tags */
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     2
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     3
IriSP.Widgets.CurrentSegmentInfobox = function(player, config){
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     4
    IriSP.Widgets.Widget.call(this, player, config);
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     5
};
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     6
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     7
IriSP.Widgets.CurrentSegmentInfobox.prototype = new IriSP.Widgets.Widget();
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     8
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
     9
IriSP.Widgets.CurrentSegmentInfobox.prototype.defaults = {
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    10
    annotation_type: "chap",
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: 1040
diff changeset
    11
    editable_segments: 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: 1040
diff changeset
    12
    empty_message: 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: 1040
diff changeset
    13
    project_id: 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: 1040
diff changeset
    14
    api_serializer: "ldt_annotate",
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: 1040
diff changeset
    15
    api_method: "PUT",
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    16
    api_endpoint_template: "",
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    17
    new_tag_button: true,
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
    18
    show_headers: false,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    19
    custom_edit_text: false,
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    20
    empty_description_placeholder: false,
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    21
};
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    22
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    23
IriSP.Widgets.CurrentSegmentInfobox.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: 1040
diff changeset
    24
      '<div class="Ldt-CurrentSegmentInfobox">'
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    25
    +   '<div class="Ldt-CurrentSegmentInfobox-SelectedSegment">'
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
    26
    +     '{{#editable_segments}}<div class="Ldt-CurrentSegmentInfobox-EditButton">{{edit}}</div>{{/editable_segments}}'
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: 1040
diff changeset
    27
    +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Title">{{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: 1040
diff changeset
    28
    +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Description">{{description}}</div>' 
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    29
    +     '{{^description}}{{^tags.length}}{{#description_placeholder}}<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Description-placeholder">{{description_placeholder}}</div>{{/description_placeholder}}{{/tags.length}}{{/description}}' 
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: 1040
diff changeset
    30
    +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Tags">'
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: 1040
diff changeset
    31
    +         '{{#tags.length}}'
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: 1040
diff changeset
    32
    +         '<ul class="Ldt-CurrentSegmentInfobox-Tags-Ul">'
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: 1040
diff changeset
    33
    +         '{{#tags}}'
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: 1040
diff changeset
    34
    +             '{{#.}}'
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: 1040
diff changeset
    35
    +             '<li class="Ldt-CurrentSegmentInfobox-Tags-Li">'
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: 1040
diff changeset
    36
    +                 '<span>{{.}}</span>'
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: 1040
diff changeset
    37
    +             '</li>'
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: 1040
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: 1040
diff changeset
    39
    +         '{{/tags}}'
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: 1040
diff changeset
    40
    +         '</ul>'
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: 1040
diff changeset
    41
    +         '{{/tags.length}}'
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: 1040
diff changeset
    42
    +     '</div>'
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    43
    +   '</div>'
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: 1040
diff changeset
    44
    + '</div>'
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    45
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: 1040
diff changeset
    46
IriSP.Widgets.CurrentSegmentInfobox.prototype.editTemplate = 
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: 1040
diff changeset
    47
      '<div class="Ldt-CurrentSegmentInfobox">'
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    48
    +   '<div class="Ldt-CurrentSegmentInfobox-SelectedSegment">'
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
    49
    +     '{{#headers}}<div class="Ldt-CurrentSegmentInfobox-FieldsHeader">{{fields_header}}</div>{{/headers}}'
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: 1040
diff changeset
    50
    +     '<input type="text" class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-TitleInput Ldt-CurrentSegmentInfobox-Title" value="{{title}}"></input>'   
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: 1040
diff changeset
    51
    +     '<textarea class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-DescriptionInput Ldt-CurrentSegmentInfobox-Description">{{description}}</textarea>'
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    52
    +     '<div class="Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Tags">'
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
    53
    +         '{{#headers}}<div class="Ldt-CurrentSegmentInfobox-TagsHeader">{{tags_header}}</div>{{/headers}}'
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    54
    +     '{{#new_tag_button}}'
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: 1040
diff changeset
    55
    +         '<div class="Ldt-CurrentSegmentInfobox-CreateTagButton">{{new_tag}}</div>'
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    56
    +     '{{/new_tag_button}}'
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    57
    +     '{{^new_tag_button}}'
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    58
    +         '<input class="Ldt-CurrentSegmentInfobox-CreateTagInput" placeholder="{{new_tag}}"></input>'
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
    59
    +         '<div class="Ldt-CurrentSegmentInfobox-CreateTagInput-Add">+</div>'
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
    60
    +     '{{/new_tag_button}}'
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: 1040
diff changeset
    61
    +         '<ul class="Ldt-CurrentSegmentInfobox-Tags-Ul">'
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: 1040
diff changeset
    62
    +         '{{#tags}}'
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: 1040
diff changeset
    63
    +             '{{#.}}'
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: 1040
diff changeset
    64
    +             '<li class="Ldt-CurrentSegmentInfobox-Tags-Li">'
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: 1040
diff changeset
    65
    +                 '<input type="text" class="Ldt-CurrentSegmentInfobox-Tags-Li-Input" value="{{.}}"></input>'
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: 1040
diff changeset
    66
    +                 '<div class="Ldt-CurrentSegmentInfobox-Tags-Li-DeleteTagButton">{{delete_tag}}</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: 1040
diff changeset
    67
    +             '</li>'
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: 1040
diff changeset
    68
    +             '{{/.}}'
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: 1040
diff changeset
    69
    +         '{{/tags}}'
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: 1040
diff changeset
    70
    +         '</ul>'
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: 1040
diff changeset
    71
    +     '</div>'
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    72
    +     '<div class="Ldt-CurrentSegmentInfobox-SubmitButton">{{submit}}</div>'
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    73
    +     '<div class="Ldt-CurrentSegmentInfobox-CancelButton">{{cancel}}</div>'
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    74
    +   '</div>'
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: 1040
diff changeset
    75
    + '</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: 1040
diff changeset
    76
    
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    77
IriSP.Widgets.CurrentSegmentInfobox.prototype.messages = {
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    78
    fr : {
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: 1040
diff changeset
    79
        submit : "Soumettre",
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: 1040
diff changeset
    80
        cancel : "Annuler",
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
    81
        edit : "Editer",
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: 1040
diff changeset
    82
        new_tag : "Nouveau tag",
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: 1040
diff changeset
    83
        delete_tag : "Supprimer",
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    84
        fields_header : "Commentaire associé à ce segment",
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    85
        tags_header : "Mots-clés associés à ce segment",
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    86
        empty : "Le player vidéo ne lit actuellement aucun segment"
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    87
    },
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    88
    en: {
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: 1040
diff changeset
    89
        submit : "Submit",
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: 1040
diff changeset
    90
        cancel : "Cancel",
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
    91
        edit : "Edit",
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: 1040
diff changeset
    92
        new_tag : "New tag",
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: 1040
diff changeset
    93
        delete_tag : "Delete tag",
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
    94
        fields_header : "Current segment content",
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
    95
        tags_header : "Current segment tags",
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: 1040
diff changeset
    96
        empty : "The player currently doesn't read any segment"
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    97
    }
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    98
}    
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
    99
    
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   100
IriSP.Widgets.CurrentSegmentInfobox.prototype.draw = function() {
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   101
    var _this = this;
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   102
    this.segments = this.getWidgetAnnotations();
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   103
    this.renderTemplate();
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: 1040
diff changeset
   104
    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: 1040
diff changeset
   105
    this.clearBox();
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   106
    this.refresh();
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: 1040
diff changeset
   107
    this.onMediaEvent("timeupdate", "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: 1040
diff changeset
   108
    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: 1040
diff changeset
   109
        var _segmentBegin = _timeRange[0],
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1040
diff changeset
   110
            _segmentEnd = _timeRange[1],
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1040
diff changeset
   111
            _list = _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: 1040
diff changeset
   112
                return _segment.begin.milliseconds == _segmentBegin.milliseconds && _segment.end.milliseconds == _segmentEnd.milliseconds
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: 1040
diff changeset
   113
            });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1040
diff changeset
   114
        if (_list.length >0){
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   115
            _this.$.toggleClass("editing", 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: 1040
diff changeset
   116
            if (_this.currentSegment.id != _list[0].id){
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: 1040
diff changeset
   117
                _this.currentSegment = _list[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: 1040
diff changeset
   118
                _data = {
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   119
                        editable_segments: _this.editable_segments,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   120
                        edit: _this.custom_edit_text ? _this.custom_edit_text : _this.l10n.edit,
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   121
                        title: _this.currentSegment.title,
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   122
                        description : _this.currentSegment.description,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   123
                        description_placeholder : _this.empty_description_placeholder,
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   124
                        tags : _this.currentSegment.getTagTexts()
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: 1040
diff changeset
   125
                }
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: 1040
diff changeset
   126
                _this.$.html(Mustache.to_html(_this.template, _data))
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: 1040
diff changeset
   127
                if(_this.editable_segments&&_this.currentSegment){
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: 1040
diff changeset
   128
                    _this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));            
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: 1040
diff changeset
   129
                }
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: 1040
diff changeset
   130
            }
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: 1040
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: 1040
diff changeset
   132
    });
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   133
    
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: 1040
diff changeset
   134
    if(this.editable_segments&&this.currentSegment){
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: 1040
diff changeset
   135
        this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));        
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: 1040
diff changeset
   136
    }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1040
diff changeset
   137
}
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: 1040
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: 1040
diff changeset
   139
IriSP.Widgets.CurrentSegmentInfobox.prototype.enableEditMode = function() {
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   140
    var _this = this;
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: 1040
diff changeset
   141
    if(this.currentSegment){
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: 1040
diff changeset
   142
        _data = {
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: 1040
diff changeset
   143
            title: this.currentSegment.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: 1040
diff changeset
   144
            description : this.currentSegment.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: 1040
diff changeset
   145
            tags : this.currentSegment.getTagTexts(),
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: 1040
diff changeset
   146
            submit : this.l10n.submit,
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: 1040
diff changeset
   147
            cancel : this.l10n.cancel,
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
   148
            headers : this.show_headers,
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
   149
            tags_header : this.custom_tags_header ? this.custom_tags_header : this.l10n.tags_header,
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
   150
            fields_header : this.custom_fields_header ? this.custom_fields_header : this.l10n.fields_header,
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: 1040
diff changeset
   151
            new_tag : this.l10n.new_tag,
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   152
            delete_tag : this.l10n.delete_tag,
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   153
            new_tag_button : this.new_tag_button,
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: 1040
diff changeset
   154
        }
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   155
        this.$.toggleClass("editing", 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: 1040
diff changeset
   156
        this.$.html(Mustache.to_html(this.editTemplate, _data));
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: 1040
diff changeset
   157
        this.$.find(".Ldt-CurrentSegmentInfobox-CancelButton").click(this.functionWrapper("disableEditMode"));
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   158
        if (this.new_tag_button){
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   159
            this.$.find(".Ldt-CurrentSegmentInfobox-CreateTagButton").click(this.functionWrapper("insertTagInput"));            
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   160
        } else {
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
   161
            this.$.find(".Ldt-CurrentSegmentInfobox-CreateTagInput").keypress(this.functionWrapper("insertTagInputKeypress"));
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
   162
            this.$.find(".Ldt-CurrentSegmentInfobox-CreateTagInput-Add").click(this.functionWrapper("insertTagInputKeypress"));
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
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: 1040
diff changeset
   164
        this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Li-DeleteTagButton").click(this.functionWrapper("deleteTagInput"));
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: 1040
diff changeset
   165
        this.$.find(".Ldt-CurrentSegmentInfobox-SubmitButton").click(this.functionWrapper("onSubmit"))
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: 1040
diff changeset
   166
    }
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: 1040
diff changeset
   167
}
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: 1040
diff changeset
   168
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: 1040
diff changeset
   169
IriSP.Widgets.CurrentSegmentInfobox.prototype.disableEditMode = 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: 1040
diff changeset
   170
    if(this.currentSegment){
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   171
        _data = {
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   172
                editable_segments: this.editable_segments,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   173
                edit: this.custom_edit_text ? this.custom_edit_text : this.l10n.edit,
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   174
                title: this.currentSegment.title,
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   175
                description : this.currentSegment.description,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   176
                description_placeholder : this.empty_description_placeholder,
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   177
                tags : this.currentSegment.getTagTexts()
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   178
            }
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   179
        this.$.toggleClass("editing", 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: 1040
diff changeset
   180
        this.$.html(Mustache.to_html(this.template, _data));
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: 1040
diff changeset
   181
        this.$.find(".Ldt-CurrentSegmentInfobox").click(this.functionWrapper("enableEditMode")); 
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: 1040
diff changeset
   182
    }
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: 1040
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: 1040
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: 1040
diff changeset
   185
IriSP.Widgets.CurrentSegmentInfobox.prototype.insertTagInput = 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: 1040
diff changeset
   186
    if((!this.currentSegment.getTagTexts().length)&&(!this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Ul").length)){
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: 1040
diff changeset
   187
        this.$.find(".Ldt-CurrentSegmentInfobox-Tags").prepend('<ul class="Ldt-CurrentSegmentInfobox-Tags-Ul"></ul>')
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: 1040
diff changeset
   188
    }
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: 1040
diff changeset
   189
    this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Ul").append(
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: 1040
diff changeset
   190
        '<li class="Ldt-CurrentSegmentInfobox-Tags-Li">'
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: 1040
diff changeset
   191
        +'<input type="text" class="Ldt-CurrentSegmentInfobox-Tags-Li-Input" value=""></input>'
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: 1040
diff changeset
   192
        +'<div class="Ldt-CurrentSegmentInfobox-Tags-Li-DeleteTagButton">'+this.l10n.delete_tag+'</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: 1040
diff changeset
   193
        +'</li>');
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: 1040
diff changeset
   194
    this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Li-DeleteTagButton").click(this.functionWrapper("deleteTagInput"));
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: 1040
diff changeset
   195
}
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: 1040
diff changeset
   196
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   197
IriSP.Widgets.CurrentSegmentInfobox.prototype.insertTagInputKeypress = function(event) {
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   198
    var keycode = (event.keyCode ? event.keyCode : event.which);
1064
b9c816d95ab0 Added headers to editable fields in CurrentSegmentInfobox
durandn
parents: 1062
diff changeset
   199
    if(keycode == '13' || event.type == 'click'){
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   200
        if((!this.currentSegment.getTagTexts().length)&&(!this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Ul").length)){
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   201
            this.$.find(".Ldt-CurrentSegmentInfobox-Tags").prepend('<ul class="Ldt-CurrentSegmentInfobox-Tags-Ul"></ul>')
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   202
        }
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   203
        this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Ul").append(
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   204
            '<li class="Ldt-CurrentSegmentInfobox-Tags-Li">'
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   205
            +'<input type="text" class="Ldt-CurrentSegmentInfobox-Tags-Li-Input" value="'+ this.$.find(".Ldt-CurrentSegmentInfobox-CreateTagInput").val() +'"></input>'
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   206
            +'<div class="Ldt-CurrentSegmentInfobox-Tags-Li-DeleteTagButton">'+this.l10n.delete_tag+'</div>'
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   207
            +'</li>');
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   208
        this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Li-DeleteTagButton").click(this.functionWrapper("deleteTagInput"));
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   209
        this.$.find(".Ldt-CurrentSegmentInfobox-CreateTagInput").val("");
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   210
        return false;
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   211
    }
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   212
}
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   213
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: 1040
diff changeset
   214
IriSP.Widgets.CurrentSegmentInfobox.prototype.deleteTagInput = function(clickEvent) {
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: 1040
diff changeset
   215
    $(clickEvent.currentTarget).parent().remove();
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: 1040
diff changeset
   216
}
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: 1040
diff changeset
   217
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: 1040
diff changeset
   218
IriSP.Widgets.CurrentSegmentInfobox.prototype.onSubmit = 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: 1040
diff changeset
   219
    new_tags_titles = this.$.find(".Ldt-CurrentSegmentInfobox-Tags-Li-Input").map(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: 1040
diff changeset
   220
        if($(this).val()){
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: 1040
diff changeset
   221
            return $(this).val()
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: 1040
diff changeset
   222
        }
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: 1040
diff changeset
   223
    });
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: 1040
diff changeset
   224
    new_title = this.$.find(".Ldt-CurrentSegmentInfobox-TitleInput").val()
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: 1040
diff changeset
   225
    new_description = this.$.find(".Ldt-CurrentSegmentInfobox-DescriptionInput").val()
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: 1040
diff changeset
   226
    
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: 1040
diff changeset
   227
    var _this = this,
1067
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   228
        _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create an Annotations List to send to the server */
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   229
        _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   230
        _annotation = new IriSP.Model.Annotation(this.currentSegment.id, _export); /* We create an annotation in the source with a generated ID (param. 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: 1040
diff changeset
   231
    
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: 1040
diff changeset
   232
    _annotation.setAnnotationType(this.currentSegment.getAnnotationType().id);
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: 1040
diff changeset
   233
    _annotation.setMedia(this.currentSegment.getMedia().id);
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: 1040
diff changeset
   234
    _annotation.setBegin(this.currentSegment.begin);
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: 1040
diff changeset
   235
    _annotation.setEnd(this.currentSegment.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: 1040
diff changeset
   236
    _annotation.created = this.currentSegment.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: 1040
diff changeset
   237
    _annotation.creator = this.currentSegment.creator;
1067
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   238
    _annotation.title = new_title /* Title field */
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   239
    _annotation.description = new_description /* Description field */
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: 1040
diff changeset
   240
    var _tagIds = IriSP._(new_tags_titles).map(function(_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: 1040
diff changeset
   241
        var _tags = _this.source.getTags(true).searchByTitle(_title, 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: 1040
diff changeset
   242
        if (_tags.length) {
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: 1040
diff changeset
   243
            var _tag = _tags[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: 1040
diff changeset
   244
        }
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: 1040
diff changeset
   245
        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: 1040
diff changeset
   246
            _tag = new IriSP.Model.Tag(_title.replace(/\W/g,'_'), _this.source);
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: 1040
diff changeset
   247
            _tag.title = _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: 1040
diff changeset
   248
            _this.source.getTags().push(_tag);
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: 1040
diff changeset
   249
        }
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: 1040
diff changeset
   250
        return _tag.id;
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: 1040
diff changeset
   251
    });
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: 1040
diff changeset
   252
    _annotation.setTags(_tagIds);
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: 1040
diff changeset
   253
    _annotation.project_id = this.project_id;
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: 1040
diff changeset
   254
    
1067
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   255
    _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   256
    _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */    
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: 1040
diff changeset
   257
    
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: 1040
diff changeset
   258
    _url = Mustache.to_html(this.api_endpoint_template, {annotation_id: this.currentSegment.id});
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: 1040
diff changeset
   259
    
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: 1040
diff changeset
   260
    IriSP.jQuery.ajax({
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: 1040
diff changeset
   261
        url: _url,
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: 1040
diff changeset
   262
        type: this.api_method,
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: 1040
diff changeset
   263
        contentType: 'application/json',
1067
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   264
        data: _export.serialize(), /* Source is serialized */
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: 1040
diff changeset
   265
        success: function(_data) {
1067
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   266
            _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   267
            _export.deSerialize(_data); /* Data deserialization */
539c9bee5372 Translating comments into English
durandn
parents: 1064
diff changeset
   268
            _this.source.merge(_export); /* We merge the deserialized data with the current source data */
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: 1040
diff changeset
   269
            _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: 1040
diff changeset
   270
                if (_segment.id == _annotation.id){
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: 1040
diff changeset
   271
                    _this.segments.removeElement(_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: 1040
diff changeset
   272
                }
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: 1040
diff changeset
   273
            })
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: 1040
diff changeset
   274
            _this.segments.push(_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: 1040
diff changeset
   275
            _this.currentSegment = _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: 1040
diff changeset
   276
            _data = {
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   277
                    editable_segments: _this.editable_segments,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   278
                    edit: _this.custom_edit_text ? _this.custom_edit_text : _this.l10n.edit,
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   279
                    title: _this.currentSegment.title,
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   280
                    description : _this.currentSegment.description,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   281
                    description_placeholder : _this.empty_description_placeholder,
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   282
                    tags : _this.currentSegment.getTagTexts()
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   283
                }
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: 1040
diff changeset
   284
            _this.$.html(Mustache.to_html(_this.template, _data))
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: 1040
diff changeset
   285
            if(_this.editable_segments&&_this.currentSegment){
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: 1040
diff changeset
   286
                _this.$.find(".Ldt-CurrentSegmentInfobox").click(_this.functionWrapper("enableEditMode"));             
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: 1040
diff changeset
   287
            }
1052
c8fd9dbf3804 Added support for editing the currently selected segment and its potential tags
durandn
parents: 1046
diff changeset
   288
            _this.$.toggleClass("editing", 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: 1040
diff changeset
   289
        },
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: 1040
diff changeset
   290
        error: function(_xhr, _error, _thrown) {
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: 1040
diff changeset
   291
            IriSP.log("Error when sending annotation", _thrown);
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: 1040
diff changeset
   292
            _export.getAnnotations().removeElement(_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: 1040
diff changeset
   293
        }
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: 1040
diff changeset
   294
    });
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   295
}
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   296
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   297
IriSP.Widgets.CurrentSegmentInfobox.prototype.refresh = function() {
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: 1040
diff changeset
   298
    if(!this.media.getTimeRange()){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1040
diff changeset
   299
        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: 1040
diff changeset
   300
        var _list = 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: 1040
diff changeset
   301
            return (_segment.begin <= _currentTime && _segment.end >= _currentTime);
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: 1040
diff changeset
   302
        })
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: 1040
diff changeset
   303
        
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: 1040
diff changeset
   304
        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: 1040
diff changeset
   305
            if (this.currentSegment.id != _list[0].id){
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: 1040
diff changeset
   306
                this.currentSegment = _list[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: 1040
diff changeset
   307
                _data = {
1060
3a4f2217a04f Added an edit button to make edit functionality easier to read
durandn
parents: 1052
diff changeset
   308
                    editable_segments: this.editable_segments,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   309
                    edit: this.custom_edit_text ? this.custom_edit_text : this.l10n.edit,
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: 1040
diff changeset
   310
                    title: this.currentSegment.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: 1040
diff changeset
   311
                    description : this.currentSegment.description,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   312
                    description_placeholder : this.empty_description_placeholder,
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: 1040
diff changeset
   313
                    tags : this.currentSegment.getTagTexts()
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: 1040
diff changeset
   314
                }
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: 1040
diff changeset
   315
                this.$.html(Mustache.to_html(this.template, _data))
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: 1040
diff changeset
   316
                if(this.editable_segments&&this.currentSegment){
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: 1040
diff changeset
   317
                    this.$.find(".Ldt-CurrentSegmentInfobox").click(this.functionWrapper("enableEditMode"));             
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: 1040
diff changeset
   318
                }
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: 1040
diff changeset
   319
            }
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   320
        }
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: 1040
diff changeset
   321
        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: 1040
diff changeset
   322
            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: 1040
diff changeset
   323
            this.clearBox();
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: 1040
diff changeset
   324
        }
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   325
    }
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: 1040
diff changeset
   326
}
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: 1040
diff changeset
   327
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: 1040
diff changeset
   328
IriSP.Widgets.CurrentSegmentInfobox.prototype.clearBox = 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: 1040
diff changeset
   329
    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: 1040
diff changeset
   330
    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: 1040
diff changeset
   331
        _empty_message = this.empty_message
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   332
    }
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: 1040
diff changeset
   333
    this.$.find(".Ldt-CurrentSegmentInfobox").html("<div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-NoSegment'>"+_empty_message+"</div>");
1040
be314c4ea4ac New widget CurrentSegmentInfobox that displays infos on currently viewed Segment (future features will allow for possibility to edit title descriptions and tags for current segment)
durandn
parents:
diff changeset
   334
}