src/widgets/Markers.js
author ymh <ymh.work@gmail.com>
Mon, 28 Dec 2015 15:50:04 +0100
changeset 1069 2409cb4cebaf
parent 1067 539c9bee5372
child 1072 ac1eacb3aa33
permissions -rw-r--r--
getting various changes from github
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     1
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     2
IriSP.Widgets.Markers = function(player, config) {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     3
    IriSP.Widgets.Widget.call(this, player, config);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     4
};
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     5
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     6
IriSP.Widgets.Markers.prototype = new IriSP.Widgets.Widget();
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     7
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
     8
IriSP.Widgets.Markers.prototype.defaults = {
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
     9
    pre_draw_callback: function(){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    10
        return this.importUsers();
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    11
    },
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    12
    annotation_type: "markers",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    13
    line_height: 8,
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    14
    background: "#e0e0e0",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    15
    marker_color: "#ff80fc",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    16
    placeholder_color: "#ffffff",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    17
    hover_color: "#e15581",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    18
    selected_color: "#74d600",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    19
    ball_radius: 4,
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    20
    pause_on_write: true,
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    21
    play_on_submit: true,
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    22
    api_serializer: "ldt_annotate",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    23
    api_endpoint_template_create: "",
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    24
    api_endpoint_template_edit: "",
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    25
    api_endpoint_template_delete: "",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    26
    api_method_create: "POST",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    27
    api_method_edit: "PUT",
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    28
    api_method_delete: "DELETE",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    29
    project_id: "",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    30
    creator_name: "",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    31
    after_send_timeout: 0,
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    32
    markers_gap: 2000,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    33
    allow_empty_markers: false,
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    34
    close_after_send: false,
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    35
    custom_send_button: false,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    36
    custom_cancel_button: false,
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
    37
    preview_mode: false,
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    38
    filter_per_user: false,
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    39
    api_users_endpoint: "",
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    40
    make_username_string_function: function(params){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    41
        return params.username ? params.username : "Anonymous";
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    42
    },
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    43
    hide_if_empty: false,
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    44
};
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    45
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    46
IriSP.Widgets.Markers.prototype.template = 
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    47
    '<div class="Ldt-Markers-Display" style="height:{{line_height}}px;">'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    48
    +     '<div class="Ldt-Markers-List" style="height:{{line_height}}px; position: relative;"></div>'
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    49
    +     '<div class="Ldt-Markers-Position" style="height: {{line_height}}px; top: -{{line_height}};"></div>'
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    50
    + '</div>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    51
    + '<div class="Ldt-Markers-Inputs">'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    52
    +     '<div class="Ldt-Markers-Screen Ldt-Markers-ScreenMain">'
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
    53
    +         '<div class="Ldt-Markers-RoundButton Ldt-Markers-CannotCreate" title="{{#preview_mode}}{{l10n.preview_mode_submit}}{{/preview_mode}}{{^preview_mode}}{{l10n.cannot_create}}{{/preview_mode}}">+</div>'
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    54
    +         '<div class="Ldt-Markers-RoundButton Ldt-Markers-Create">+</div>'
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
    55
    +         '{{^preview_mode}}<div class="Ldt-Markers-RoundButton Ldt-Markers-Delete">&#10006;</div>{{/preview_mode}}'
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
    56
    +         '{{#preview_mode}}<div class="Ldt-Markers-RoundButton Ldt-Markers-PreviewDelete" title="{{l10n.preview_mode_delete}}">&#10006;</div>{{/preview_mode}}'
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
    57
    +         '{{#filter_per_user}}{{#preview_mode}}<select class="Ldt-Markers-userFilter-dropdown" id="Ldt-Markers-userFilter"></select>{{/preview_mode}}{{/filter_per_user}}'
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    58
    +         '<div class="Ldt-Markers-Info"></div>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    59
    +     '</div>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    60
    +     '<div class="Ldt-Markers-Screen Ldt-Markers-ScreenSending">'  
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    61
    +         '<div class="Ldt-Markers-Screen-InnerBox">{{l10n.wait_while_processing}}</div>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    62
    +     '</div>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    63
    +     '<div class="Ldt-Markers-Screen Ldt-Markers-ScreenSuccess">'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    64
    +         '<a title="{{l10n.close_widget}}" class="Ldt-Markers-Close" href="#"></a>'    
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    65
    +         '<div class="Ldt-Markers-Screen-InnerBox">{{l10n.annotation_saved}}</div>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    66
    +     '</div>'
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    67
    +     '<div class="Ldt-Markers-Screen Ldt-Markers-ScreenDeleteSuccess">'
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    68
    +         '<a title="{{l10n.close_widget}}" class="Ldt-Markers-Close" href="#"></a>'    
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    69
    +         '<div class="Ldt-Markers-Screen-InnerBox">{{l10n.delete_saved}}</div>'
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    70
    +     '</div>'
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    71
    +     '<div class="Ldt-Markers-Screen Ldt-Markers-ScreenFailure">'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    72
    +         '<a title="{{l10n.close_widget}}" class="Ldt-Markers-Close" href="#"></a>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    73
    +         '<div class="Ldt-Markers-Screen-InnerBox">{{l10n.error_while_contacting}}</div>'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    74
    +     '</div>'
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    75
    +     '<div class="Ldt-Markers-Screen Ldt-Markers-ScreenConfirmDelete">'
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    76
    +         '<a title="{{l10n.close_widget}}" class="Ldt-Markers-Close" href="#"></a>'
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    77
    +         '<div class="Ldt-Markers-Screen-InnerBox">'
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    78
    +           '{{l10n.delete_text}} '
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    79
    +           '<a class="Ldt-Markers-Screen-SubmitDelete">{{l10n.submit_delete}}</a> '
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    80
    +           '<a class="Ldt-Markers-Screen-CancelDelete">{{l10n.cancel}}</a>'
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    81
    +         '</div>'
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    82
    +     '</div>'
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    83
    + '</div>';
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    84
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    85
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    86
IriSP.Widgets.Markers.prototype.markerTemplate = 
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    87
    '<div class="Ldt-Markers-Marker" style="height:{{height}}px; left:{{left}}px; width: 2px; background-color: black;">' +
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    88
        '<div class="Ldt-Markers-MarkerBall" style="background-color: {{marker_color}}; position: relative; width: {{ball_diameter}}px; height: {{ball_diameter}}px; left: {{ball_left}}px; top: {{ball_top}}px; border: 1px solid; border-radius: {{ball_radius}}px"></div>' + 
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    89
    '</div>';
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    90
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    91
IriSP.Widgets.Markers.prototype.markerPlaceholderTemplate = 
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    92
    '<div class="Ldt-Markers-Marker Ldt-Markers-PlaceholderMarker" style="height:{{height}}px; left:{{left}}px; width: 2px; background-color: black;">' +
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    93
        '<div class="Ldt-Markers-MarkerBall" style="background-color: {{marker_color}}; position: relative; width: {{ball_diameter}}px; height: {{ball_diameter}}px; left: {{ball_left}}px; top: {{ball_top}}px; border: 1px solid; border-radius: {{ball_radius}}px"></div>' + 
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
    94
    '</div>'; 
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    95
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    96
IriSP.Widgets.Markers.prototype.infoTemplate = 
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    97
    '{{^edit}}<div class="Ldt-Markers-MarkerDescription">{{marker_info}}</div>{{/edit}}' +
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    98
    '{{#edit}}<div class="Ldt-Markers-MarkerEdit">' + 
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
    99
        '<textarea class="Ldt-Markers-MarkerTextArea" cols="60" rows="4">{{marker_info}}</textarea>' +
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   100
        '<div class="Ldt-Markers-Buttons">' +
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   101
            '{{^preview_mode}}<div class="Ldt-Markers-MarkerSend">{{send}}</div>{{/preview_mode}}' +
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   102
            '{{#preview_mode}}<div class="Ldt-Markers-MarkerPreviewSend" title="{{preview_mode_text}}">{{send}}</div>{{/preview_mode}}' +
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   103
            '<div class="Ldt-Markers-MarkerCancel">{{cancel}}</div>' +
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   104
        '</div>' +
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   105
    '</div>{{/edit}}'
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   106
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   107
IriSP.Widgets.Markers.prototype.messages = {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   108
    en : {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   109
        send : "Send",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   110
        submit_delete: "Delete",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   111
        cancel : "Cancel",
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   112
        preview_mode_submit: "You cannot submit a marker in preview mode.",
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   113
        preview_mode_delete: "You cannot delete a marker in preview mode",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   114
        wait_while_processing: "Please wait while your annotation is being processed...",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   115
        delete_text: "The selected marker will be deleted. Continue?",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   116
        error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   117
        annotation_saved: "Thank you, your annotation has been saved.",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   118
        delete_saved: "Thank you, your annotation has been deleted",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   119
        close_widget: "Close",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   120
        cannot_create: "Cannot create marker on this timecode"
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   121
    },
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   122
    fr : {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   123
        send : "Envoyer",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   124
        submit_delete: "Supprimer",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   125
        cancel : "Annuler",
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   126
        preview_mode_submit: "Vous ne pouvez pas créer ou éditer de marqueur en mode aperçu",
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   127
        preview_mode_delete: "Vous ne pouvez pas supprimer de marqueur en mode aperçu",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   128
        wait_while_processing: "Veuillez patienter pendant le traitement de votre annotation...",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   129
        delete_text: "Le marqueur sélectionné sera supprimé. Continuer?",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   130
        error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée.",
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   131
        annotation_saved: "Merci, votre annotation a été enregistrée.",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   132
        delete_saved: "Merci, votre annotation a été supprimée",
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   133
        close_widget: "Fermer",
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   134
        cannot_create: "Impossible de créer un marqueur sur ce timecode"
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   135
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   136
}
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   137
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   138
IriSP.Widgets.Markers.prototype.importUsers = function(){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   139
    if (this.filter_per_user && this.preview_mode){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   140
        this.usernames = Array();
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   141
        if (!this.source.users_data && this.api_users_endpoint){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   142
            var _this = this,
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   143
                _list = this.getWidgetAnnotations(),
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   144
                usernames_list_string = "";
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   145
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   146
            _list.forEach(function(_annotation){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   147
                if(_this.usernames.indexOf(_annotation.creator) == -1){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   148
                    _this.usernames.push(_annotation.creator);
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   149
                }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   150
            });
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   151
            this.usernames.forEach(function(_username){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   152
                usernames_list_string+=_username+","
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   153
            })
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   154
            usernames_list_string = usernames_list_string.substring(0, usernames_list_string.length - 1);
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   155
            _url = Mustache.to_html(this.api_users_endpoint, {usernames_list_string: encodeURIComponent(usernames_list_string), usernames_list_length: this.usernames.length});
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   156
            return IriSP.jQuery.ajax({
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   157
                async: false,
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   158
                url: _url,
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   159
                type: "GET",
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   160
                success: function(_data) {
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   161
                    _this.source.users_data = _data.objects
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   162
                },
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   163
                error: function(_xhr, _error, _thrown) {
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   164
                    console.log(_xhr)
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   165
                    console.log(_error)
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   166
                    console.log(_thrown)
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   167
                }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   168
            })
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   169
        }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   170
    }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   171
}
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   172
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   173
IriSP.Widgets.Markers.prototype.draw = function(){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   174
    var _this = this;
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   175
    this.renderTemplate();
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   176
    if ((!this.filter_per_user) || (!this.preview_mode) || (this.usernames.length <= 1)){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   177
        this.$.find(".Ldt-Markers-userFilter-dropdown").hide();
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   178
    }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   179
    else {
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   180
        this.usernames.forEach(function(_user){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   181
            var _users = _this.source.users_data.filter(function(_user_data){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   182
                return _user_data.username == _user;
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   183
            }),
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   184
               _user_data = {};
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   185
            if (_users.length == 0){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   186
                _user_data.username = _user;
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   187
            }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   188
            else{
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   189
                _user_data = _users[0];
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   190
            }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   191
            _this.$.find(".Ldt-Markers-userFilter-dropdown").append("<option value='"+_user+"'>"+_this.make_name_string_function(_user_data)+"</option>")
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   192
        }); 
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   193
        this.$.find(".Ldt-Markers-userFilter-dropdown").change(this.functionWrapper("drawMarkers"))
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   194
        this.$.find(".Ldt-Markers-userFilter-dropdown").change(this.functionWrapper("clearSelectedMarker"))
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   195
        
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   196
    }
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   197
    
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   198
    this.markers = this.getWidgetAnnotations().filter(function(_ann) {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   199
        return ((_ann.getDuration() == 0) || (_ann.begin == _ann.end));
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   200
    });
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   201
    if (this.hide_if_empty && this.markers.length <= 0){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   202
        this.$.hide();
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   203
    } 
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   204
    else {
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   205
        this.drawMarkers();
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   206
        
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   207
        this.$.find(".Ldt-Markers-Create").click(this.functionWrapper("onCreateClick"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   208
        this.$.find(".Ldt-Markers-Delete").click(this.functionWrapper("onDeleteClick"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   209
        this.$.find(".Ldt-Markers-RoundButton").hide()
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   210
        this.updateCreateButtonState(this.media.getCurrentTime())
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   211
        this.$.find(".Ldt-Markers-Screen-SubmitDelete").click(this.functionWrapper("sendDelete"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   212
        this.$.find(".Ldt-Markers-Screen-CancelDelete").click(function(){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   213
            _this.showScreen("Main");
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   214
            _this.cancelEdit();
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   215
        })
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   216
        this.showScreen("Main");
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   217
        this.$.css({
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   218
            margin: "1px 0",
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   219
            background: this.background
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   220
        });
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   221
        
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   222
        this.$.find(".Ldt-Markers-Close").click(this.functionWrapper("revertToMainScreen"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   223
        
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   224
        this.onMediaEvent("timeupdate", this.functionWrapper("updatePosition"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   225
        this.onMediaEvent("timeupdate", this.functionWrapper("updateCreateButtonState"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   226
        this.onMediaEvent("play", this.functionWrapper("clearSelectedMarker"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   227
        this.onMdpEvent("Markers.refresh", this.functionWrapper("drawMarkers"));
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   228
       
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   229
        this.newMarkerTimeCode = 0;
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   230
        this.selectedMarker = false;
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   231
    }
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   232
}
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   233
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   234
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   235
IriSP.Widgets.Markers.prototype.updatePosition = function(_time) {    
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   236
    var _x = Math.floor( this.width * _time / this.media.duration);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   237
    this.$.find('.Ldt-Markers-Position').css({
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   238
        left: _x + "px"
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   239
    });
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   240
}
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   241
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   242
IriSP.Widgets.Markers.prototype.updateCreateButtonState = function(_time){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   243
    _this = this
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   244
    var can_create = this.preview_mode? false : this.markers.every(function(_marker){   
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   245
        return ((_time < (_marker.begin-_this.markers_gap))||(_time > (_marker.begin+_this.markers_gap)))
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   246
    });
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   247
    if (can_create){
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   248
        if ((this.$.find(".Ldt-Markers-Create").is(":hidden"))&&(this.$.find(".Ldt-Markers-Delete").is(":hidden")||this.$.find(".Ldt-Markers-PreviewDelete").is(":hidden"))){
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   249
            this.$.find(".Ldt-Markers-RoundButton").hide();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   250
            this.$.find(".Ldt-Markers-Create").show();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   251
        }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   252
    }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   253
    else {
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   254
        if ((this.$.find(".Ldt-Markers-CannotCreate").is(":hidden"))&&(this.$.find(".Ldt-Markers-Delete").is(":hidden")||this.$.find(".Ldt-Markers-PreviewDelete").is(":hidden"))){
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   255
            this.$.find(".Ldt-Markers-RoundButton").hide();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   256
            this.$.find(".Ldt-Markers-CannotCreate").show();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   257
        }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   258
    }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   259
}
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   260
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   261
IriSP.Widgets.Markers.prototype.onCreateClick = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   262
    this.pauseOnWrite();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   263
    if (!this.selectedMarker){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   264
        this.newMarkerCurrentTime = this.media.getCurrentTime();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   265
        this.showPlaceholder(this.media.getCurrentTime());
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   266
        this.startEdit();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   267
    }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   268
}
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   269
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   270
IriSP.Widgets.Markers.prototype.onDeleteClick = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   271
    _this = this;
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   272
    this.pauseOnWrite();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   273
    if(this.selectedMarker){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   274
        this.showScreen("ConfirmDelete");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   275
    }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   276
    else {
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   277
        // Click on "x" without a selected marker: back to initial state
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   278
        this.cancelEdit();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   279
    }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   280
}
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   281
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   282
IriSP.Widgets.Markers.prototype.startEdit = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   283
    if (this.selectedMarker){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   284
        _divHtml = Mustache.to_html(this.infoTemplate, {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   285
            edit: true,
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   286
            preview_mode: this.preview_mode,
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   287
            preview_mode_text: this.l10n.preview_mode_submit,
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   288
            marker_info: this.selectedMarker.description,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   289
            send: this.custom_send_button? this.custom_send_button : this.l10n.send,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   290
            cancel: this.custom_cancel_button? this.custom_cancel_button :this.l10n.cancel
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   291
        })
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   292
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   293
    else {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   294
        _divHtml = Mustache.to_html(this.infoTemplate, {
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   295
            edit: true,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   296
            marker_info: "",
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   297
            preview_mode: this.preview_mode,
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   298
            preview_mode_text: this.l10n.preview_mode_submit,
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   299
            send: this.custom_send_button? this.custom_send_button : this.l10n.send,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   300
            cancel: this.custom_cancel_button? this.custom_cancel_button :this.l10n.cancel
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   301
        })
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   302
    }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   303
    this.$.find(".Ldt-Markers-Info").html(_divHtml);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   304
    this.$.find(".Ldt-Markers-MarkerSend").click(this.functionWrapper("onSubmit"));
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   305
    this.$.find(".Ldt-Markers-MarkerCancel").click(this.functionWrapper("cancelEdit"));
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   306
    this.$.find(".Ldt-Markers-MarkerTextArea").bind("change keyup input paste", this.functionWrapper("onDescriptionChange"));
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   307
    this.$.find(".Ldt-Markers-RoundButton").hide();
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   308
    if (this.preview_mode){
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   309
        this.$.find(".Ldt-Markers-PreviewDelete").show(); 
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   310
    }
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   311
    else {
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   312
        this.$.find(".Ldt-Markers-Delete").show();
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   313
    }
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   314
    this.editing = true;
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   315
}
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   316
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   317
IriSP.Widgets.Markers.prototype.cancelEdit = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   318
    if (this.selectedMarker){
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   319
        // Click on "cancel" while editing a marker: back to visualization state
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   320
        _divHtml = Mustache.to_html(this.infoTemplate, {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   321
            edit: false,
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   322
            marker_info: this.selectedMarker.description,
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   323
        })
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   324
        this.$.find(".Ldt-Markers-Info").html(_divHtml);
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   325
        if (!this.preview_mode){
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   326
            this.$.find(".Ldt-Markers-MarkerDescription").click(this.functionWrapper("startEdit"));
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   327
        }
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   328
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   329
    else {
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   330
        // Click on "cancel" while editing a marker: back to initial state
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   331
        this.hidePlaceholder();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   332
        this.$.find(".Ldt-Markers-Info").html("");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   333
        this.$.find(".Ldt-Markers-RoundButton").hide()
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   334
        this.$.find(".Ldt-Markers-Create").show()
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   335
        this.updateCreateButtonState(this.media.getCurrentTime())
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   336
    }
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   337
    this.editing = false;
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   338
}
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   339
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   340
IriSP.Widgets.Markers.prototype.onDescriptionChange = function(){
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   341
    // Returns false if the textarea is empty, true if there is text in it
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   342
    if(!this.allow_empty_markers){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   343
        var _field = this.$.find(".Ldt-Markers-MarkerTextArea"),
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   344
            _contents = _field.val();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   345
        _field.css("border-color", !!_contents ? "#e87d9f" : "#ff0000");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   346
        if (!!_contents) {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   347
            _field.removeClass("empty");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   348
        } else {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   349
            _field.addClass("empty");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   350
        }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   351
        this.pauseOnWrite();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   352
        return !!_contents;
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   353
    }
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   354
    else {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   355
        // If the widget is configured to allow to post empty markers, it returns true
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   356
        return true
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   357
    }
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   358
};
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   359
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   360
IriSP.Widgets.Markers.prototype.pauseOnWrite = function(){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   361
    if (this.pause_on_write && !this.media.getPaused()) {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   362
        this.media.pause();
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   363
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   364
};
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   365
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   366
IriSP.Widgets.Markers.prototype.showScreen = function(_screenName) {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   367
    this.$.find('.Ldt-Markers-Screen' + _screenName).show()
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   368
        .siblings().hide();
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   369
}
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   370
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   371
IriSP.Widgets.Markers.prototype.revertToMainScreen = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   372
    if (this.$.find(".Ldt-Markers-ScreenMain").is(":hidden")){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   373
        this.showScreen("Main");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   374
        this.cancelEdit();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   375
        if (this.selectedMarker){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   376
            this.$.find(".Ldt-Markers-RoundButton").hide();
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   377
            if (this.preview_mode){
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   378
                this.$.find(".Ldt-Markers-PreviewDelete").show(); 
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   379
            }
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   380
            else {
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   381
                this.$.find(".Ldt-Markers-Delete").show();
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   382
            }
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   383
        }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   384
        else {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   385
            this.$.find(".Ldt-Markers-RoundButton").hide();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   386
            this.$.find(".Ldt-Markers-Create").show();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   387
            this.updateCreateButtonState();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   388
        }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   389
    }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   390
}
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   391
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   392
IriSP.Widgets.Markers.prototype.hidePlaceholder = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   393
    this.$.find(".Ldt-Markers-PlaceholderMarker").remove();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   394
}
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   395
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   396
IriSP.Widgets.Markers.prototype.showPlaceholder = function(_time){   
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   397
    var _scale = this.width / this.source.getDuration(),
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   398
        _left = _time * _scale -1,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   399
        _data = {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   400
            left: _left,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   401
            height: this.line_height-1,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   402
            ball_top: (this.ball_radius*2 > this.line_height) ? 0 : ((this.line_height - this.ball_radius*2)/2)-1,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   403
            ball_radius: (this.ball_radius*2 > this.line_height) ? this.line_height/2 : this.ball_radius,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   404
            ball_diameter: (this.ball_radius*2 > this.line_height) ? this.line_height/2 : this.ball_radius*2,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   405
            ball_left: -this.ball_radius,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   406
            marker_color: this.placeholder_color
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   407
        },
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   408
        _html = Mustache.to_html(this.markerPlaceholderTemplate, _data),
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   409
        _el = IriSP.jQuery(_html);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   410
        
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   411
    list_$ = this.$.find(".Ldt-Markers-List");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   412
    _el.appendTo(list_$);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   413
}
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   414
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   415
IriSP.Widgets.Markers.prototype.clearSelectedMarker = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   416
    if (this.selectedMarker){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   417
        var _divHtml = "";
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   418
        
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   419
        this.selectedMarker = false;
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   420
        this.$.find(".Ldt-Markers-Info").html(_divHtml);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   421
        this.$.find(".Ldt-Markers-RoundButton").hide();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   422
        this.$.find(".Ldt-Markers-Create").show();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   423
        this.$.find(".Ldt-Markers-MarkerBall").toggleClass("selected", false);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   424
        this.updateCreateButtonState(this.media.getCurrentTime())
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   425
    }
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   426
}
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   427
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   428
IriSP.Widgets.Markers.prototype.drawMarkers = function(){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   429
    var _this = this,
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   430
        _scale = this.width / this.source.getDuration(),
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   431
        list_$ = this.$.find('.Ldt-Markers-List'),
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   432
        _displayed_markers = this.markers;
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   433
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   434
    this.$.remove("Ldt-Markers-Marker");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   435
    list_$.html("");
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   436
    
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   437
    if (this.filter_per_user && this.usernames.length > 1){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   438
        var _username = this.$.find(".Ldt-Markers-userFilter-dropdown")[0].options[this.$.find(".Ldt-Markers-userFilter-dropdown")[0].selectedIndex].value;
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   439
        _displayed_markers = _displayed_markers.filter(function(_marker){
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   440
            return _marker.creator == _username;
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   441
        })
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   442
    }
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   443
    
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   444
    _displayed_markers.forEach(function(_marker){
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   445
        var _left = _marker.begin * _scale -1,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   446
            _data = {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   447
                left: _left,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   448
                height: _this.line_height-1,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   449
                ball_top: (_this.ball_radius*2 > _this.line_height) ? 0 : ((_this.line_height - _this.ball_radius*2)/2)-1,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   450
                ball_radius: (_this.ball_radius*2 > _this.line_height) ? _this.line_height/2 : _this.ball_radius,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   451
                ball_diameter: (_this.ball_radius*2 > _this.line_height) ? _this.line_height/2 : _this.ball_radius*2,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   452
                ball_left: -_this.ball_radius,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   453
                marker_color: ((_this.selectedMarker)&&(_this.selectedMarker.id == _marker.id))? _this.selected_color : _this.marker_color
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   454
            },
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   455
            _html = Mustache.to_html(_this.markerTemplate, _data),
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   456
            _el = IriSP.jQuery(_html);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   457
        
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   458
        if ((_this.selectedMarker)&&(_this.selectedMarker.id == _marker.id)){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   459
            _el.children().toggleClass("selected", true);
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   460
        }
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   461
        
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   462
        _el.mouseover(function(){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   463
                if (!((_this.selectedMarker)&&(_this.selectedMarker.id == _marker.id))){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   464
                    _el.children().css("background-color", _this.hover_color);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   465
                };
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   466
            })
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   467
           .mouseout(function(){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   468
              if (!((_this.selectedMarker)&&(_this.selectedMarker.id == _marker.id))){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   469
                  _el.children().css("background-color", _this.marker_color);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   470
              };
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   471
           })
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   472
           .click(function(){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   473
               _this.showScreen("Main");
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   474
               _this.cancelEdit();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   475
               _this.hidePlaceholder();
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   476
               if (!((_this.selectedMarker)&&(_this.selectedMarker.id == _marker.id))){
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   477
                  // if there either is no marker selected or we click a different marker
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   478
                  list_$.find(".Ldt-Markers-MarkerBall").css("background-color", _this.marker_color)
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   479
                  list_$.find(".Ldt-Markers-MarkerBall").toggleClass("selected", false);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   480
                  _el.children().toggleClass("selected", true);
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   481
                  _el.children().css("background-color", _this.selected_color)
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   482
                  _this.selectedMarker = _marker;
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   483
                  
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   484
                  _divHtml = Mustache.to_html(_this.infoTemplate, {
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   485
                      edit: false,
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   486
                      marker_info: _marker.description,
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   487
                  })
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   488
                  
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   489
                  _this.$.find(".Ldt-Markers-Info").html(_divHtml);
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   490
                  if (!_this.preview_mode){
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   491
                      _this.$.find(".Ldt-Markers-MarkerDescription").click(_this.functionWrapper("startEdit"));
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   492
                  }
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   493
                  _this.$.find(".Ldt-Markers-RoundButton").hide();
1066
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   494
                  if (_this.preview_mode){
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   495
                      _this.$.find(".Ldt-Markers-PreviewDelete").show(); 
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   496
                  }
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   497
                  else {
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   498
                      _this.$.find(".Ldt-Markers-Delete").show();
5ef7182907c5 added a "preview" mode for CreateAnnotation and Markers that blocks inputs so sending annotations is impossible
durandn
parents: 1059
diff changeset
   499
                  }
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   500
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   501
               }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   502
               else {
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   503
                   // if we click the currently selected marker, we unselect it
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   504
                   _el.children().css("background-color", _this.hover_color);
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   505
                   _this.clearSelectedMarker();
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   506
               }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   507
               
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   508
               if (_this.selectedMarker) {
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   509
                   // Only if we select a new marker do we pause video and time jump
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   510
                   _this.media.pause();
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   511
                   _marker.trigger("click");
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   512
               }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   513
           })
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   514
           .appendTo(list_$);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   515
    })
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   516
}
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   517
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   518
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   519
IriSP.Widgets.Markers.prototype.onSubmit = function(){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   520
    
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   521
    /* If mandatory fields are empty, we cancel the sending */
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   522
    if (!this.allow_empty_markers && !this.onDescriptionChange()){
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   523
        return false;
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   524
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   525
    
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   526
    /* We pause the video if it's still playing */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   527
    if (!this.media.getPaused()){
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   528
        this.media.pause();
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   529
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   530
    
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   531
    var _this = this,
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   532
        _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create a List to send to the server that will contains the annotation */
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   533
        _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: 1066
diff changeset
   534
        _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* We get the AnnotationType in which the annotation will be added */
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   535
        _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)); /* If it doesn't already exists, we create it */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   536
    if (this.selectedMarker){
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   537
        var _annotation = this.selectedMarker,
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   538
            _url = Mustache.to_html(this.api_endpoint_template_edit, {annotation_id: this.selectedMarker ? this.selectedMarker.id : ""});
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   539
        _annotation.source = _export
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1067
diff changeset
   540
        _annotation.description = this.$.find(".Ldt-Markers-MarkerTextArea").val(); /* Description field */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   541
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   542
    else {
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   543
        var _annotation = new IriSP.Model.Annotation(false, _export),
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   544
            _url = Mustache.to_html(this.api_endpoint_template_create);
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   545
        
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   546
        /* If we created an AnnotationType on the spot ... */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   547
        if (!_annotationTypes.length) {
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   548
            /* ... We must not send its id to the server ... */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   549
            _annotationType.dont_send_id = true;
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   550
            /* ... And we must include its title. */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   551
            _annotationType.title = this.annotation_type;
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   552
        }
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   553
        
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   554
        _annotation.setMedia(this.source.currentMedia.id); /* Annotated media ID */
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   555
        if (!this.selectedMarker){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   556
            _annotation.setBegin(this.newMarkerCurrentTime);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   557
            _annotation.setEnd(this.newMarkerCurrentTime);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   558
        }
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   559
        _annotation.setAnnotationType(_annotationType.id); /* AnnotationType ID */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   560
        if (this.project_id != ""){
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   561
            /* Project id, only if it's been specifiec in the config */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   562
            _annotation.project_id = this.project_id;
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   563
        }
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   564
        _annotation.created = new Date(); /* Creation date */
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   565
        _annotation.description = this.$.find(".Ldt-Markers-MarkerTextArea").val(); /* Description field */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   566
        _annotation.creator = this.creator_name;
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   567
    }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   568
    _annotation.project_id = this.project_id;
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   569
    
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   570
    _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   571
    _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */ 
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   572
    
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   573
    /* We send the AJAX request to the server ! */
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   574
    IriSP.jQuery.ajax({
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   575
        url: _url,
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   576
        type: this.selectedMarker ? this.api_method_edit : this.api_method_create,
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   577
        contentType: 'application/json',
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   578
        data: _export.serialize(),
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   579
        success: function(_data) {
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   580
            _this.showScreen('Success');
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   581
            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   582
            _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   583
            _export.deSerialize(_data); /* Data deserialization */
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   584
            _annotation.id = _data.id;
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   585
            _this.source.merge(_export); /* We merge the deserialized data with the current source data */
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   586
            if (_this.pause_on_write && _this.media.getPaused() && _this.play_on_submit) {
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   587
                _this.media.play();
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   588
            }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   589
            _this.markers.push(_annotation);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   590
            _this.selectedMarker = _annotation;
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   591
            _this.drawMarkers();
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   592
            _this.player.trigger("AnnotationsList.refresh");
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   593
            _this.player.trigger("Markers.refresh");
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   594
        },
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   595
        error: function(_xhr, _error, _thrown) {
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   596
            IriSP.log("Error when sending annotation", _thrown);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   597
            _export.getAnnotations().removeElement(_annotation, true);
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   598
            _this.showScreen('Failure');
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   599
            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
1045
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   600
        }
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   601
    });
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   602
    this.showScreen('Sending');
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   603
    
b06345320ffb Altered ldt_annotate serializer to allow for serializing id for editing annotation + Added Markers widget that allows to make and edit 0 duration annotations.
durandn
parents:
diff changeset
   604
    return false;
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   605
};
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   606
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   607
IriSP.Widgets.Markers.prototype.sendDelete = function(){
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   608
    _this = this;
1059
8158421193e3 Fixed user filter on AnnotationList to not display username in the dropdown but what is displayed in the list + Added project_id to api templates for delete in case the target API understands it
durandn
parents: 1051
diff changeset
   609
    _url = Mustache.to_html(this.api_endpoint_template_delete, {annotation_id: this.selectedMarker ? this.selectedMarker.id : "", project_id: this.selectedMarker.project_id? this.selectedMarker.project_id : this.project_id});
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   610
    IriSP.jQuery.ajax({
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   611
        url: _url,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   612
        type: this.api_method_delete,
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   613
        contentType: 'application/json',
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   614
        success: function(_data) {
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   615
            _this.showScreen('DeleteSuccess');
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   616
            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   617
            if (_this.pause_on_write && _this.media.getPaused() && _this.play_on_submit) {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   618
                _this.media.play();
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   619
            }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   620
            _this.markers.removeElement(_this.selectedMarker);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   621
            _this.selectedMarker = false
1067
539c9bee5372 Translating comments into English
durandn
parents: 1066
diff changeset
   622
            _this.player.trigger("AnnotationsList.refresh");
1051
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   623
            _this.player.trigger("Markers.refresh");
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   624
        },
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   625
        error: function(_xhr, _error, _thrown) {
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   626
            IriSP.log("Error when sending annotation", _thrown);
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   627
            _this.showScreen('Failure');
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   628
            window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000));
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   629
        }
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   630
    });
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   631
    this.showScreen("Sending")
3820cf5fe29e Added support for custom button texts + Added support for deleting markers + reworked the way the "+" and "-" buttons work + Added a "placeholder" marker when clicking "+" to show where in the timeline the marker will be posted
durandn
parents: 1045
diff changeset
   632
}