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