src/widgets/AnnotationsList.js
author ymh <ymh.work@gmail.com>
Fri, 18 Oct 2024 10:24:57 +0200
changeset 1074 231ea5ea7de4
parent 1072 ac1eacb3aa33
child 1075 92cb33eb7a75
permissions -rw-r--r--
change http to https for default thumb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     1
import annotationsListStyles from "./AnnotationsList.module.css";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     2
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     3
import Mustache from "mustache";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     4
import _ from "lodash";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     5
import jQuery from "jquery";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     6
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     7
const AnnotationsList = function (ns) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     8
  return class extends ns.Widgets.Widget {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
     9
    constructor(player, config) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    10
      super(player, config);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    11
      this.lastIds = [];
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    12
      var _this = this;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    13
      this.throttledRefresh = _.throttle(function (full) {
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
    14
        _this.refresh(full);
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    15
      }, 800);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    16
      this.searchString = false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    17
      this.lastSearch = false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    18
      this.localSource = undefined;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    19
    }
585
44a4a4a179c1 first version of the AnnotationListWidget.
hamidouk
parents:
diff changeset
    20
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    21
    static defaults = {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    22
      pre_draw_callback: function () {
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
    23
        return this.importUsers();
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    24
      },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    25
      /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    26
       * URL when the annotations are to be reloaded from an LDT-like segment API
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    27
       * e.g.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    28
       * http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    29
       */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    30
      ajax_url: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    31
      /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    32
       * number of milliseconds before/after the current timecode when calling the
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    33
       * segment API
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    34
       */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    35
      ajax_granularity: 600000,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    36
      default_thumbnail: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    37
      custom_external_icon: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    38
      /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    39
       * URL when the annotation is not in the current project, e.g.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    40
       * http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    41
       */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    42
      foreign_url: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    43
      annotation_type: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    44
      refresh_interval: 0,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    45
      limit_count: 20,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    46
      newest_first: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    47
      show_title: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    48
      show_audio: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    49
      show_creator: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    50
      show_controls: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    51
      show_end_time: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    52
      show_publish: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    53
      show_twitter: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    54
      twitter_hashtag: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    55
      // Callback for Edit action. Leave undefined for default action.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    56
      on_edit: undefined,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    57
      publish_type: "PublicContribution",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    58
      // Used to publish annotations
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    59
      api_endpoint_template: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    60
      api_serializer: "ldt_annotate",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    61
      api_method: "POST",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    62
      editable: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    63
      // Id that will be used as localStorage key
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    64
      editable_storage: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    65
      widget_max_height: 680,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    66
      always_visible: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    67
      start_visible: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    68
      show_audio: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    69
      show_filters: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    70
      keyword_filter: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    71
      date_filter: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    72
      user_filter: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    73
      segment_filter: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    74
      latest_contributions_filter: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    75
      current_day_filter: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    76
      show_header: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    77
      custom_header: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    78
      annotations_count_header: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    79
      annotations_count_header_string: "annotations",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    80
      show_creation_date: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    81
      show_timecode: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    82
      show_end_time: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    83
      project_id: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    84
      /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    85
       * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    86
       */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    87
      allow_annotations_deletion: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    88
      /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    89
       * URL to call when deleting annotation. Expects a mustache template with {{annotation_id}}, ex /api/anotations/{{annotation_id}}/
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    90
       */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    91
      api_delete_endpoint: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    92
      api_delete_method: "DELETE",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    93
      api_users_endpoint: "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    94
      api_users_method: "GET",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    95
      make_name_string_function: function (params) {
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
    96
        return params.username ? params.username : "Anonymous";
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    97
      },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    98
      filter_by_segments: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
    99
      segment_filter: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   100
      segments_annotation_type: "chap",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   101
      /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   102
       * Set to a username if you only want to display annotations from a given user
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   103
       */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   104
      show_only_annotation_from_user: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   105
      /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   106
       * Show a text field that filter annotations by username
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   107
       */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   108
      tags: true,
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   109
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   110
      polemics: [
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   111
        {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   112
          keyword: "++",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   113
          background_color: "#c9ecc6",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   114
        },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   115
        {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   116
          keyword: "--",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   117
          background_color: "#f9c5c6",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   118
        },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   119
        {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   120
          keyword: "??",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   121
          background_color: "#cec5f9",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   122
        },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   123
        {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   124
          keyword: "==",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   125
          background_color: "#f9f4c6",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   126
        },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   127
      ],
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   128
    };
585
44a4a4a179c1 first version of the AnnotationListWidget.
hamidouk
parents:
diff changeset
   129
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   130
    importUsers() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   131
      if (!this.source.users_data && this.api_users_endpoint) {
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   132
        this.usernames = Array();
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   133
        var _this = this,
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   134
          _list = this.getWidgetAnnotations(),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   135
          usernames_list_string = "";
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   136
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   137
        _list.forEach(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   138
          if (_this.usernames.indexOf(_annotation.creator) == -1) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   139
            _this.usernames.push(_annotation.creator);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   140
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   141
        });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   142
        this.usernames.forEach(function (_username) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   143
          usernames_list_string += _username + ",";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   144
        });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   145
        usernames_list_string = usernames_list_string.substring(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   146
          0,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   147
          usernames_list_string.length - 1
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   148
        );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   149
        _url = Mustache.render(this.api_users_endpoint, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   150
          usernames_list_string: encodeURIComponent(usernames_list_string),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   151
          usernames_list_length: this.usernames.length,
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   152
        });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   153
        return jQuery.ajax({
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   154
          async: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   155
          url: _url,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   156
          type: "GET",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   157
          success: function (_data) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   158
            _this.source.users_data = _data.objects;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   159
          },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   160
          error: function (_xhr, _error, _thrown) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   161
            console.log(_xhr);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   162
            console.log(_error);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   163
            console.log(_thrown);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   164
          },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   165
        });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   166
      }
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   167
    }
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   168
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   169
    static messages =  {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   170
      en: {
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   171
        voice_annotation: "Voice Annotation",
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   172
        now_playing: "Now playing...",
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   173
        previous: "Previous",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   174
        next: "Next",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   175
        set_time: "Double-click to update to current player time",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   176
        edit_annotation: "Edit note",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   177
        delete_annotation: "Delete note",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   178
        publish_annotation: "Make note public",
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   179
        import_annotations:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   180
          "Paste or load notes in this field and press Import.",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   181
        confirm_delete_message:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   182
          "You are about to delete {{ annotation.title }}. Are you sure you want to delete it?",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   183
        confirm_publish_message:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   184
          "You are about to publish {{ annotation.title }}. Are you sure you want to make it public?",
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   185
        tweet_annotation: "Tweet annotation",
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1068
diff changeset
   186
        external_annotation: "This annotation was submitted to another project",
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   187
        everyone: "Everyone",
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   188
        header: "Annotations for this content",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   189
        segment_filter: "All cuttings",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   190
        latest_contributions: "Latest contributions",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   191
        close_widget: "Close",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   192
        confirm: "Confirm",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   193
        cancel: "Cancel",
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1068
diff changeset
   194
        annotation_deletion_delete: "You will delete this annotation",
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   195
        annotation_deletion_sending: "Your deletion request is being sent ... ",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   196
        annotation_deletion_success: "The annotation has been deleted.",
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   197
        annotation_deletion_error:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   198
          "There was an error contacting the server. The annotation has not been deleted.",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   199
      },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   200
      fr: {
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   201
        voice_annotation: "Annotation Vocale",
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   202
        now_playing: "Lecture en cours...",
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   203
        previous: "Précédent",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   204
        next: "Suivant",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   205
        set_time: "Double-cliquer pour fixer au temps du lecteur",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   206
        edit_annotation: "Éditer la note",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   207
        delete_annotation: "Supprimer la note",
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   208
        publish_annotation: "Rendre la note publique",
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   209
        import_annotations:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   210
          "Copiez ou chargez des notes dans ce champ et appuyez sur Import",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   211
        confirm_delete_message:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   212
          "Vous allez supprimer {{ annotation.title }}. Êtes-vous certain(e) ?",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   213
        confirm_publish_message:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   214
          "Vous allez publier {{ annotation.title }}. Êtes-vous certain(e) ?",
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   215
        tweet_annotation: "Tweeter l'annotation",
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   216
        external_annotation:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   217
          "Cette annotation a été postée sur un autre projet",
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   218
        everyone: "Tous",
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   219
        header: "Annotations sur ce contenu",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   220
        segment_filter: "Tous les segments",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   221
        latest_contributions: "Dernières contributions",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   222
        close_widget: "Fermer",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   223
        confirm: "Confirmer",
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   224
        cancel: "Annuler",
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1068
diff changeset
   225
        annotation_deletion_delete: "Vous allez supprimer cette annotation",
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   226
        annotation_deletion_sending:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   227
          "Votre demande de suppression est en cours d'envoi ... ",
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   228
        annotation_deletion_success: "L'annotation a été supprimée.",
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   229
        annotation_deletion_error:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   230
          "Une erreur s'est produite en contactant le serveur. L'annotation n'a pas été supprimée.",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   231
      },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   232
    };
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   233
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   234
    static template =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   235
      '{{#show_header}}<p class="Ldt-AnnotationsList-header">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   236
      "{{#custom_header}}{{custom_header}}{{/custom_header}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   237
      "{{^custom_header}}{{l10n.header}}{{/custom_header}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   238
      "</p>{{/show_header}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   239
      '<div class="Ldt-AnnotationsListWidget">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   240
      '<div class="Ldt-AnnotationsList-ScreenMain">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   241
      "{{#show_filters}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   242
      '<div class="Ldt-AnnotationsList-Filters">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   243
      '{{#keyword_filter}}<input class="Ldt-AnnotationsList-filter-text" id="Ldt-AnnotationsList-keywordsFilter" type="text" value=""></input>{{/keyword_filter}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   244
      '{{#user_filter}}<select class="Ldt-AnnotationsList-filter-dropdown" id="Ldt-AnnotationsList-userFilter"><option selected value="">{{l10n.everyone}}</option></select>{{/user_filter}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   245
      '{{#date_filter}}<label class="Ldt-AnnotationsList-filter-date">Date: <input id="Ldt-AnnotationsList-dateFilter" type="text"></input></label>{{/date_filter}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   246
      '{{#segment_filter}}<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-ignoreSegmentsFilter">{{l10n.segment_filter}}</label>{{/segment_filter}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   247
      '{{#latest_contributions_filter}}<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-latestContributionsFilter">{{l10n.latest_contributions}}</label>{{/latest_contributions_filter}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   248
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   249
      "{{/show_filters}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   250
      '{{#show_controls}}<div class="Ldt-AnnotationsList-Controls"><span class="Ldt-AnnotationsList-Control-Prev">{{ l10n.previous }}</span> | <span class="Ldt-AnnotationsList-Control-Next">{{ l10n.next }}</span></div>{{/show_controls}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   251
      '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   252
      '<ul class="Ldt-AnnotationsList-ul">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   253
      "</ul>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   254
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   255
      "{{#allow_annotations_deletion}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   256
      '<div data-annotation="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenDelete">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   257
      '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   258
      "{{l10n.annotation_deletion_delete}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   259
      '<ul class="Ldt-AnnotationsList-ul-ToDelete"></ul>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   260
      '<a class="Ldt-AnnotationsList-ConfirmDelete">{{l10n.confirm}}</a> <a class="Ldt-AnnotationsList-CancelDelete">{{l10n.cancel}}</a>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   261
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   262
      '<div data-annotation="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenSending">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   263
      '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   264
      "{{l10n.annotation_deletion_sending}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   265
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   266
      '<div data-annotation="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenSuccess">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   267
      '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   268
      "{{l10n.annotation_deletion_success}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   269
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   270
      '<div data.annotation="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenError">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   271
      '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   272
      "{{l10n.annotation_deletion_error}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   273
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   274
      "{{/allow_annotations_deletion}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   275
      "</div>";
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   276
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   277
    static annotationTemplate =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   278
      '<li class="Ldt-AnnotationsList-li Ldt-Highlighter-Annotation Ldt-TraceMe" data-annotation="{{ id }}" data-begin="{{ begin_ms }}" data-end="{{ end_ms }}" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   279
      '<div data-annotation="{{ id }}" class="Ldt-AnnotationsList-ThumbContainer Ldt-AnnotationsList-Annotation-Screen Ldt-AnnotationsList-Annotation-ScreenMain">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   280
      '<a {{#url}}href="{{url}}"{{/url}} draggable="true">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   281
      '<img title="{{^external}}{{ begin }} - {{ end }}{{/external}}{{#external}}{{l10n.external_annotation}}{{/external}}" class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   282
      '{{#external}}<div title="{{l10n.external_annotation}}" class="Ldt-AnnotationsList-External-Icon"></div>{{/external}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   283
      "</a>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   284
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   285
      "{{#allow_annotations_deletion}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   286
      '<div data-annotation="{{ id }}" class="Ldt-AnnotationsList-DeleteButton">&#10006;</div>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   287
      "{{/allow_annotations_deletion}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   288
      '{{#show_timecode}}<div title="{{l10n.set_time}}" class="Ldt-AnnotationsList-Duration"><span class="Ldt-AnnotationsList-Begin Ldt-live-editable Ldt-AnnotationsList-TimeEdit" data-editable_value="{{begin}}" data-editable_id="{{id}}" data-editable_field="begin" data-editable_type="timestamp">{{begin}}</span>{{#show_end_time}} - <span class="Ldt-AnnotationsList-End Ldt-live-editable" data-editable_value="{{end}}" data-editable_id="{{id}}" data-editable_field="end" data-editable_type="timestamp">{{end}}</span>{{/show_end_time}}</div>{{/show_timecode}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   289
      '<h3 class="Ldt-AnnotationsList-Title Ldt-Annotation-Timecode" data-timecode="{{ begin_ms }}" draggable="true">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   290
      '{{#show_title}}<span class="Ldt-AnnotationsList-TitleContent Ldt-live-editable" data-editable_value="{{title}}" data-editable_type="multiline" data-editable_id="{{id}}" data-editable_field="title">{{{htitle}}}</span>{{/show_title}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   291
      '{{#show_creator}}<span class="Ldt-AnnotationsList-Creator">{{ creator }}</span>{{/show_creator}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   292
      "</h3>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   293
      '<p class="Ldt-AnnotationsList-Description Ldt-live-editable" data-editable_type="multiline" data-editable_value="{{description}}" data-editable_id="{{id}}" data-editable_field="description">{{{hdescription}}}</p>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   294
      "{{#created}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   295
      '<div class="Ldt-AnnotationsList-CreationDate">{{{created}}}</div>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   296
      "{{/created}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   297
      "{{#tags.length}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   298
      '<ul class="Ldt-AnnotationsList-Tags">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   299
      "{{#tags}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   300
      "{{#.}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   301
      '<li class="Ldt-AnnotationsList-Tag-Li">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   302
      "<span>{{.}}</span>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   303
      "</li>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   304
      "{{/.}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   305
      "{{/tags}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   306
      "</ul>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   307
      "{{/tags.length}}" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   308
      '{{#audio}}<div class="Ldt-AnnotationsList-Play" data-annotation-id="{{id}}">{{l10n.voice_annotation}}</div>{{/audio}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   309
      '<div class="Ldt-AnnotationsList-EditControls">' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   310
      '{{#show_twitter}}<a title="{{l10n.tweet_annotation}}" target="_blank" href="https://twitter.com/intent/tweet?{{twitter_param}}"><img width="16" height="16" src="metadataplayer/img/twitter.svg"></a>{{/show_twitter}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   311
      '{{#show_publish}}<div title="{{l10n.publish_annotation}}" class="Ldt-AnnotationsList-PublishAnnotation" data-editable_id="{{id}}"></div>{{/show_publish}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   312
      '{{#editable}}<div title="{{l10n.edit_annotation}}" class="Ldt-AnnotationsList-Edit" data-editable_id="{{id}}"></div>' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   313
      '<div title="{{l10n.delete_annotation}}" class="Ldt-AnnotationsList-Delete" data-editable_id="{{id}}"></div>{{/editable}}' +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   314
      "</div>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   315
      "</li>";
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   316
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   317
    // obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   318
    // + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   319
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   320
    ajaxSource() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   321
      var _currentTime = this.media.getCurrentTime(),
957
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   322
        _duration = this.media.duration;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   323
      this.lastAjaxQuery = _currentTime;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   324
      var _url = Mustache.render(this.ajax_url, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   325
        media: this.source.currentMedia.id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   326
        begin: Math.max(0, _currentTime - this.ajax_granularity),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   327
        end: Math.min(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   328
          _duration.milliseconds,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   329
          _currentTime + this.ajax_granularity
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   330
        ),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   331
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   332
      this.currentSource = this.player.loadMetadata(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   333
        _.defaults(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   334
          {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   335
            url: _url,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   336
          },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   337
          this.metadata
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   338
        )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   339
      );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   340
    }
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   341
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   342
    showScreen(_screenName) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   343
      this.$.find(".Ldt-AnnotationsList-Screen" + _screenName)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   344
        .show()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   345
        .siblings()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   346
        .hide();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   347
    }
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   348
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   349
    ajaxMashup() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   350
      var _currentTime = this.media.getCurrentTime();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   351
      var _currentAnnotation =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   352
        this.source.currentMedia.getAnnotationAtTime(_currentTime);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   353
      if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   354
        typeof _currentAnnotation !== "undefined" &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   355
        _currentAnnotation.id !== this.lastMashupAnnotation
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   356
      ) {
916
ec6849bbbdcc Removed Namespacing before rewrite
veltr
parents: 909
diff changeset
   357
        this.lastMashupAnnotation = _currentAnnotation.id;
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   358
        var _currentMedia = _currentAnnotation.getMedia(),
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   359
          _url = Mustache.render(this.ajax_url, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   360
            media: _currentMedia.id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   361
            begin: Math.max(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   362
              0,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   363
              _currentAnnotation.annotation.begin.milliseconds -
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   364
                this.ajax_granularity
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   365
            ),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   366
            end: Math.min(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   367
              _currentMedia.duration.milliseconds,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   368
              _currentAnnotation.annotation.end.milliseconds +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   369
                this.ajax_granularity
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   370
            ),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   371
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   372
        this.currentSource = this.player.loadMetadata(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   373
          _.defaults(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   374
            {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   375
              url: _url,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   376
            },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   377
            this.metadata
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   378
          )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   379
        );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   380
      }
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   381
    }
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   382
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   383
    /*
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   384
     * Import annotations
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   385
     */
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   386
    importAnnotations() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   387
      var widget = this;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   388
      var $ = jQuery;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   389
      var textarea = $("<textarea>");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   390
      var el = $("<div>")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   391
        .append(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   392
          $("<span>")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   393
            .addClass("importAnnotationsLabel")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   394
            .text(widget.messages.import_annotations)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   395
        )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   396
        .addClass("importContainer")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   397
        .dialog({
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   398
          title: "Annotation import",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   399
          autoOpen: true,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   400
          width: "80%",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   401
          minHeight: "400",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   402
          height: 400,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   403
          buttons: [
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   404
            {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   405
              text: "Close",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   406
              click: function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   407
                $(this).dialog("close");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   408
              },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   409
            },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   410
            // { text: "Load", click: function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   411
            //     // TODO
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   412
            //     // http://www.html5rocks.com/en/tutorials/file/dndfiles/?redirect_from_locale=fr
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   413
            //     console.log("Load from a file");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   414
            // } },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   415
            {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   416
              text: "Import",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   417
              click: function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   418
                // FIXME: this should be a model.Source method
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   419
                var time_regexp = /(\[[\d:]+\])/;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   420
                // widget.localSource
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   421
                // Dummy parsing for the moment
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   422
                var data = textarea[0].value
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   423
                  .split(time_regexp)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   424
                  .filter(function (s) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   425
                    return !s.match(/^\s*$/);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   426
                  });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   427
                var begin = null,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   428
                  end = null,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   429
                  content = null,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   430
                  // Previous is either null, timestamp or text
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   431
                  previous = null;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   432
                for (var i = 0; i < data.length; i++) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   433
                  var el = data[i];
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   434
                  if (el.match(time_regexp)) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   435
                    if (previous == "text") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   436
                      // Timestamp following text. Let's make it an annotation
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   437
                      end = ns.timestamp2ms(el.slice(1, -1));
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   438
                      TODO.createAnnotation(begin, end, content);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   439
                      // Preserve the end value, which may be the begin value of the next annotation.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   440
                      begin = end;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   441
                      end = null;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   442
                      content = null;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   443
                    } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   444
                      //  (previous == 'timestamp' || previous == null)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   445
                      // 2 consecutive timestamps. Let's start a new annotation
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   446
                      content = null;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   447
                      begin = ns.timestamp2ms(el.slice(1, -1));
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   448
                      end = null;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   449
                    }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   450
                    previous = "timestamp";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   451
                  } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   452
                    // Text content
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   453
                    content = el;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   454
                    previous = "text";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   455
                  }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   456
                  // Last textual value
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   457
                  if (previous == "text" && begin !== null) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   458
                    TODO.createAnnotation(begin, begin, content);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   459
                  }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   460
                }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   461
              },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   462
            },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   463
          ],
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   464
        });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   465
    }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   466
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   467
    refresh(_forceRedraw) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   468
      _forceRedraw = typeof _forceRedraw !== "undefined" && _forceRedraw;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   469
      if (this.currentSource.status !== ns.Model._SOURCE_STATUS_READY) {
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   470
        return 0;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   471
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   472
      var _this = this,
957
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   473
        _currentTime = this.media.getCurrentTime();
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   474
      var _list = this.annotation_type
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   475
        ? this.currentSource.getAnnotationsByTypeTitle(this.annotation_type)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   476
        : this.currentSource.getAnnotations();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   477
      if (this.mashupMode) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   478
        var _currentAnnotation =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   479
          this.source.currentMedia.getAnnotationAtTime(_currentTime);
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   480
        if (typeof _currentAnnotation !== "undefined") {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   481
          _currentTime =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   482
            _currentTime -
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   483
            _currentAnnotation.begin +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   484
            _currentAnnotation.annotation.begin;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   485
          var _mediaId = _currentAnnotation.getMedia().id;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   486
          _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   487
            return _annotation.getMedia().id === _mediaId;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   488
          });
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   489
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   490
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   491
      _list = _list.filter(function (_annotation) {
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   492
        return _annotation.found !== false;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   493
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   494
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   495
      if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   496
        this.filter_by_segments &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   497
        !(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   498
          this.show_filters &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   499
          this.segment_filter &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   500
          this.ignoresegmentcheckbox_$[0].checked
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   501
        )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   502
      ) {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   503
        /*
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   504
         *  A given annotation is considered "in" segment if the middle of it is between the segment beginning and the segment end.
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   505
         *  Note this is meant to be used for "markings" annotations (not segments)
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   506
         */
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   507
        _segmentsAnnotation = this.currentSource.getAnnotationsByTypeTitle(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   508
          this.segments_annotation_type
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   509
        );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   510
        if (this.media.getTimeRange()) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   511
          _currentSegments = _segmentsAnnotation.filter(function (_segment) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   512
            return (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   513
              _this.media.getTimeRange()[0] == _segment.begin &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   514
              _this.media.getTimeRange()[1] == _segment.end
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   515
            );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   516
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   517
        } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   518
          _currentSegments = _segmentsAnnotation.filter(function (_segment) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   519
            return (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   520
              _currentTime >= _segment.begin && _currentTime <= _segment.end
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   521
            );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   522
          });
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   523
        }
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   524
        if (_currentSegments.length == 0) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   525
          _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   526
            return false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   527
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   528
        } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   529
          _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   530
            _annotation_time = (_annotation.begin + _annotation.end) / 2;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   531
            return (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   532
              _currentSegments[0].begin <= _annotation_time &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   533
              _currentSegments[0].end >= _annotation_time
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   534
            );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   535
          });
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   536
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   537
        if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   538
          this.annotations_count_header &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   539
          this.annotations_count != _list.length
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   540
        ) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   541
          this.annotations_count = _list.length;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   542
          this.refreshHeader();
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   543
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   544
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   545
      if (this.show_only_annotation_from_user) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   546
        _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   547
          return _annotation.creator == _this.show_only_annotation_from_user;
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   548
        });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   549
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   550
      if (this.limit_count) {
965
eadb7290c325 Improvements in widget communication
veltr
parents: 963
diff changeset
   551
        /* Get the n annotations closest to current timecode */
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   552
        _list = _list
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   553
          .sortBy(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   554
            return Math.abs(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   555
              (_annotation.begin + _annotation.end) / 2 - _currentTime
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   556
            );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   557
          })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   558
          .slice(0, this.limit_count);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   559
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   560
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   561
      if (this.newest_first) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   562
        _list = _list.sortBy(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   563
          return -_annotation.created.valueOf();
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   564
        });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   565
      } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   566
        _list = _list.sortBy(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   567
          return _annotation.begin;
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   568
        });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   569
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   570
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   571
      if (this.show_filters) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   572
        if (this.user_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   573
          _username =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   574
            this.userselect_$[0].options[this.userselect_$[0].selectedIndex]
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   575
              .value;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   576
          if (_username != "false") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   577
            _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   578
              return _annotation.creator == _username;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   579
            });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   580
          }
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   581
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   582
        if (this.keyword_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   583
          _keyword = this.keywordinput_$[0].value;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   584
          if (_keyword != "") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   585
            _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   586
              return _annotation.description
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   587
                .toLowerCase()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   588
                .match(_keyword.toLowerCase());
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   589
            });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   590
          }
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   591
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   592
        if (this.date_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   593
          if (this.datefilterinput_$[0].value != "") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   594
            _date = this.datefilterinput_$.datepicker("getDate");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   595
            _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   596
              return (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   597
                _annotation.created.getDate() == _date.getDate() &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   598
                _annotation.created.getMonth() == _date.getMonth() &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   599
                _annotation.created.getFullYear() == _date.getFullYear()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   600
              );
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
   601
            });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   602
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   603
        }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   604
        if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   605
          this.latest_contributions_filter &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   606
          this.latestcontributionscheckbox_$[0].checked
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   607
        ) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   608
          _list = _list.sortBy(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   609
            return -_annotation.created.valueOf();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   610
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   611
          this.usernames.forEach(function (_user) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   612
            latest_ann = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   613
              return _annotation.creator == _user;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   614
            })[0];
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   615
            _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   616
              return (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   617
                _annotation.id == (latest_ann ? latest_ann.id : false) ||
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   618
                _annotation.creator != _user
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   619
              );
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   620
            });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   621
          });
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   622
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   623
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   624
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   625
      var _ids = _list.idIndex;
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   626
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   627
      if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   628
        _forceRedraw ||
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   629
        !_.isEqual(_ids, this.lastIds) ||
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   630
        this.searchString !== this.lastSearch
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   631
      ) {
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   632
        /* This part only gets executed if the list needs updating */
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   633
        this.lastSearch = this.searchString;
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   634
        this.lastIds = _ids;
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   635
        this.list_$.html("");
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   636
        _list.forEach(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   637
          var _url =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   638
              typeof _annotation.url !== "undefined" && _annotation.url
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   639
                ? _annotation.url
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   640
                : typeof _this.source.projectId !== "undefined" &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   641
                  typeof _annotation.project !== "undefined" &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   642
                  _annotation.project &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   643
                  _this.source.projectId !== _annotation.project
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   644
                ? Mustache.render(_this.foreign_url, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   645
                    project: _annotation.project,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   646
                    media: _annotation.media.id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   647
                    annotation: _annotation.id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   648
                    annotationType: _annotation.annotationType.id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   649
                  })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   650
                : document.location.href.replace(/#.*$/, "") +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   651
                  "#id=" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   652
                  _annotation.id +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   653
                  "&t=" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   654
                  _annotation.begin / 1000.0,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   655
            _external =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   656
              _annotation.project != _this.source.projectId ? true : false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   657
            _title = "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   658
            _description = _annotation.description,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   659
            _thumbnail =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   660
              typeof _annotation.thumbnail !== "undefined" &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   661
              _annotation.thumbnail
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   662
                ? _annotation.thumbnail
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   663
                : _this.default_thumbnail;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   664
          if (_this.show_creator) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   665
            if (_annotation.creator) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   666
              var _users = [],
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   667
                _user = {},
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   668
                _creator = "";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   669
              if (_this.source.users_data) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   670
                _users = _this.source.users_data.filter(function (_user_data) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   671
                  return _user_data.username == _annotation.creator;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   672
                });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   673
              }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   674
              if (_users.length == 0) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   675
                _user.username = _annotation.creator;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   676
              } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   677
                _user = _users[0];
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   678
              }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   679
              _creator = _this.make_name_string_function(_user);
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   680
            }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   681
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   682
          if (_this.show_title && _annotation.title) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   683
            var _title = _annotation.title;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   684
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   685
          var _bgcolor;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   686
          _(_this.polemics).each(function (_polemic) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   687
            var _rgxp = ns.Model.regexpFromTextOrArray(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   688
              _polemic.keyword,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   689
              true
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   690
            );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   691
            if (_rgxp.test(_title + " " + _description)) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   692
              _bgcolor = _polemic.background_color;
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   693
            }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   694
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   695
          var _created = false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   696
          if (_this.show_creation_date) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   697
            _created =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   698
              _annotation.created.toLocaleDateString() +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   699
              ", " +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   700
              _annotation.created
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   701
                .toLocaleTimeString()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   702
                .replace(/\u200E/g, "")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   703
                .replace(/^([^\d]*\d{1,2}:\d{1,2}):\d{1,2}([^\d]*)$/, "$1$2");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   704
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   705
          if (_this.tags == true) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   706
            var _tags = _annotation.getTagTexts();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   707
          } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   708
            var _tags = false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   709
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   710
          var _data = {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   711
            id: _annotation.id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   712
            media_id: _annotation.getMedia().id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   713
            htitle: ns.textFieldHtml(_title),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   714
            title: _title,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   715
            creator: _creator,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   716
            hdescription: ns.textFieldHtml(_description),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   717
            description: _description,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   718
            begin: _annotation.begin.toString(),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   719
            end: _annotation.end.toString(),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   720
            created: _created,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   721
            show_timecode: _this.show_timecode,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   722
            show_end_time: _this.show_end_time,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   723
            show_title: _this.show_title && _title,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   724
            thumbnail: _thumbnail,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   725
            url: _url,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   726
            tags: _tags,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   727
            specific_style:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   728
              typeof _bgcolor !== "undefined"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   729
                ? "background-color: " + _bgcolor
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   730
                : "",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   731
            l10n: _this.l10n,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   732
            editable: _this.editable,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   733
            external: _external,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   734
            show_publish: _this.show_publish,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   735
            show_creator: _this.show_creator,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   736
            show_twitter: _this.show_twitter,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   737
            twitter_param: jQuery.param({
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   738
              url: _url,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   739
              text:
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   740
                ns.textFieldHtml(_title) +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   741
                (_this.twitter_hashtag ? " #" + _this.twitter_hashtag : ""),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   742
            }),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   743
            allow_annotations_deletion: _this.allow_annotations_deletion,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   744
          };
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   745
          // if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   746
          //   _this.show_audio &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   747
          //   _annotation.audio &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   748
          //   _annotation.audio.href &&
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   749
          //   _annotation.audio.href != "null"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   750
          // ) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   751
          //   _data.audio = true;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   752
          //   if (!_this.jwplayers[_annotation.id]) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   753
          //     var _audiofile = _annotation.audio.href;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   754
          //     if (_this.audio_url_transform) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   755
          //       _audiofile = _this.audio_url_transform(_annotation.audio.href);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   756
          //     }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   757
          //     var _tmpId = "jwplayer-" + ns.Model.getUID();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   758
          //     _this.jwplayers[_annotation.id] = _tmpId;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   759
          //     _this.$.find(".Ldt-AnnotationsList-Audio").append(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   760
          //       jQuery("<div>").attr("id", _tmpId)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   761
          //     );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   762
          //     jwplayer(_tmpId).setup({
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   763
          //       //flashplayer: ns.getLib("jwPlayerSWF"),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   764
          //       file: _audiofile,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   765
          //       fallback: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   766
          //       primary: "flash",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   767
          //       controls: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   768
          //       width: 1,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   769
          //       height: 1,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   770
          //       events: {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   771
          //         onPause: function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   772
          //           _this.$.find(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   773
          //             ".Ldt-AnnotationsList-Play[data-annotation-id=" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   774
          //               _annotation.id +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   775
          //               "]"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   776
          //           ).text(_this.l10n.voice_annotation);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   777
          //         },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   778
          //         onPlay: function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   779
          //           _this.$.find(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   780
          //             ".Ldt-AnnotationsList-Play[data-annotation-id=" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   781
          //               _annotation.id +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   782
          //               "]"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   783
          //           ).text(_this.l10n.now_playing);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   784
          //         },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   785
          //       },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   786
          //     });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   787
          //   }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   788
          //}
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   789
          var _html = Mustache.render(_this.constructor.annotationTemplate, _data),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   790
            _el = jQuery(_html),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   791
            _onselect = function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   792
              _this.$.find(".Ldt-AnnotationsList-li").removeClass("selected");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   793
              _el.addClass("selected");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   794
            },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   795
            _onunselect = function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   796
              _this.$.find(".Ldt-AnnotationsList-li").removeClass("selected");
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   797
            };
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   798
          _el
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   799
            .mouseover(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   800
              _annotation.trigger("select");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   801
            })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   802
            .mouseout(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   803
              _annotation.trigger("unselect");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   804
            })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   805
            .click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   806
              if (_this.filter_by_segments && _this.media.getTimeRange()) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   807
                _ann_time = (_annotation.begin + _annotation.end) / 2;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   808
                if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   809
                  _ann_time <= _this.media.getTimeRange()[0] ||
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   810
                  _ann_time >= _this.media.getTimeRange()[1]
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   811
                ) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   812
                  _this.media.resetTimeRange();
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   813
                }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   814
              }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   815
              _annotation.trigger("click");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   816
            })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   817
            .appendTo(_this.list_$);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   818
          ns.attachDndData(_el.find("[draggable]"), {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   819
            title: _title,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   820
            description: _description,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   821
            uri: _url,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   822
            image: _annotation.thumbnail,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   823
            text: "[" + _annotation.begin.toString() + "] " + _title,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   824
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   825
          _el.on("remove", function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   826
            _annotation.off("select", _onselect);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   827
            _annotation.off("unselect", _onunselect);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   828
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   829
          _annotation.on("select", _onselect);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   830
          _annotation.on("unselect", _onunselect);
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   831
        });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   832
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   833
        /* Correct the empty tag bug */
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   834
        this.$.find(".Ldt-AnnotationsList-Tag-Li").each(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   835
          var _el = jQuery(this);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   836
          if (!_el.text().replace(/(^\s+|\s+$)/g, "")) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   837
            _el.remove();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   838
          }
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   839
        });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   840
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   841
        if (this.editable) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   842
          var widget = _this;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   843
          var $ = jQuery;
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   844
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   845
          var edit_element = function (_this, insertion_point) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   846
            var feedback_wrong = "#FF9999";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   847
            var feedback_ok = "#99FF99";
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   848
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   849
            // insertion_point can be used to specify where to
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   850
            // insert the input field.  Firefox is buggy wrt input
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   851
            // fields inside <a> or <h?> tags, it does not
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   852
            // propagate mouse clicks. If _this is a <a> then we
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   853
            // have to specify the ancestor before which we can
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   854
            // insert the input widget.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   855
            if (insertion_point === undefined) insertion_point = _this;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   856
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   857
            // Insert input element
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   858
            var input_element = $(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   859
              _this.dataset.editable_type === "multiline"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   860
                ? "<textarea>"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   861
                : "<input>"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   862
            )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   863
              .addClass("editableInput")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   864
              .insertBefore($(insertion_point));
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   865
            input_element[0].value = _this.dataset.editable_value;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   866
            $(input_element).show().focus();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   867
            $(_this).addClass("editing");
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   868
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   869
            function feedback(color) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   870
              // Give some feedback
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   871
              $(_this).removeClass("editing");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   872
              input_element.remove();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   873
              var previous_color = $(_this).css("background-color");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   874
              $(_this)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   875
                .stop()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   876
                .css("background-color", color)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   877
                .animate({ backgroundColor: previous_color }, 1000);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   878
            }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   879
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   880
            function cancelChanges(s) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   881
              feedback(feedback_wrong);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   882
            }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   883
            function validateChanges() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   884
              var n = input_element[0].value;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   885
              if (n == _this.dataset.editable_value) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   886
                // No change
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   887
                feedback(feedback_ok);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   888
                return;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   889
              }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   890
              if (n == "") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   891
                // Delete annotation
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   892
                delete_local_annotation(_this.dataset.editable_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   893
                widget.player.trigger(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   894
                  "Annotation.delete",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   895
                  _this.dataset.editable_id
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   896
                );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   897
                return;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   898
              } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   899
                // Convert value if necessary.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   900
                var val = n;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   901
                if (_this.dataset.editable_type == "timestamp") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   902
                  val = ns.timestamp2ms(n);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   903
                  if (Number.isNaN(val)) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   904
                    // Invalid value. Cancel changes
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   905
                    cancelChanges();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   906
                    return;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   907
                  }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   908
                }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   909
                _this.dataset.editable_value = n;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   910
                n = val;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   911
                $(_this).text(val);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   912
              }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   913
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   914
              // We cannot use .getElement since it fetches
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   915
              // elements from the global Directory
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   916
              var an = get_local_annotation(_this.dataset.editable_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   917
              if (an === undefined) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   918
                console.log("Strange error: cannot find edited annotation");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   919
                feedback(feedback_wrong);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   920
              } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   921
                _this.dataset.editable_value = n;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   922
                // Update annotation for storage
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   923
                if (_this.dataset.editable_field == "begin") an.setBegin(n);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   924
                else if (_this.dataset.editable_field == "end") an.setEnd(n);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   925
                else an[_this.dataset.editable_field] = n;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   926
                an.modified = new Date();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   927
                // FIXME: use user name, when available
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   928
                an.contributor = widget.player.config.username || "COCo User";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   929
                widget.player.addLocalAnnotation(an);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   930
                widget.player.trigger("Annotation.update", an);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   931
                feedback(feedback_ok);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   932
              }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   933
            }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   934
            $(input_element)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   935
              .bind("keydown", function (e) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   936
                if (e.which == 13) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   937
                  e.preventDefault();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   938
                  validateChanges();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   939
                } else if (e.which == 27) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   940
                  e.preventDefault();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   941
                  cancelChanges();
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   942
                }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   943
              })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   944
              .bind("blur", function (e) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   945
                validateChanges();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   946
              });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   947
          };
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   948
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   949
          var get_local_annotation = function (ident) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   950
            return widget.player.getLocalAnnotation(ident);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   951
          };
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   952
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   953
          var save_local_annotations = function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   954
            widget.player.saveLocalAnnotations();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   955
            // Merge modifications into widget source
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   956
            widget.source.merge(widget.player.localSource);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   957
          };
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   958
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   959
          var delete_local_annotation = function (ident) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   960
            widget.source.getAnnotations().removeId(ident, true);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   961
            widget.player.deleteLocalAnnotation(ident);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   962
            widget.refresh(true);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   963
          };
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
   964
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   965
          this.$.find(".Ldt-AnnotationsList-Delete").click(function (e) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   966
            // Delete annotation
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   967
            var _annotation = get_local_annotation(this.dataset.editable_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   968
            if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   969
              confirm(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   970
                Mustache.render(widget.l10n.confirm_delete_message, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   971
                  annotation: _annotation,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   972
                })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   973
              )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   974
            )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   975
              delete_local_annotation(this.dataset.editable_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   976
            widget.refresh(true);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   977
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   978
          this.$.find(".Ldt-AnnotationsList-Edit").click(function (e) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   979
            if (widget.on_edit) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   980
              var _annotation = get_local_annotation(this.dataset.editable_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   981
              widget.on_edit(_annotation);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   982
            } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   983
              // Edit annotation title. We have to specify the insertion point.
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   984
              var element = $(this)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   985
                .parents(".Ldt-AnnotationsList-li")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   986
                .find(".Ldt-AnnotationsList-TitleContent.Ldt-live-editable");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   987
              edit_element(element[0]);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   988
            }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   989
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   990
          this.$.find(".Ldt-AnnotationsList-PublishAnnotation").click(function (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   991
            e
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   992
          ) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   993
            var _annotation = get_local_annotation(this.dataset.editable_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   994
            // Publish annotation to the server
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   995
            if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   996
              !confirm(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   997
                Mustache.render(widget.l10n.confirm_publish_message, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   998
                  annotation: _annotation,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
   999
                })
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1000
              )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1001
            )
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1002
              return;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1003
            var _url = Mustache.render(widget.api_endpoint_template, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1004
              id: widget.source.projectId,
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1005
            });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1006
            if (_url !== "") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1007
              var _export = widget.player.sourceManager.newLocalSource({
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1008
                serializer: ns.serializers[widget.api_serializer],
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1009
              });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1010
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1011
              if (widget.publish_type) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1012
                // If publish_type is specified, try to set the annotation type of the exported annotation
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1013
                var at = widget.source
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1014
                  .getAnnotationTypes()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1015
                  .filter(function (at) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1016
                    return at.title == widget.publish_type;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1017
                  });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1018
                if (at.length == 1) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1019
                  _annotation.setAnnotationType(at[0].id);
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1020
                }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1021
              }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1022
              var _exportedAnnotations = new ns.Model.List(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1023
                widget.player.sourceManager
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1024
              );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1025
              _exportedAnnotations.push(_annotation);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1026
              _export.addList("annotation", _exportedAnnotations);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1027
              jQuery.ajax({
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1028
                url: _url,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1029
                type: widget.api_method,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1030
                contentType: "application/json",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1031
                data: _export.serialize(),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1032
                success: function (_data) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1033
                  $(this).addClass("published");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1034
                  // Save the published information
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1035
                  var an = get_local_annotation(_annotation.id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1036
                  // FIXME: handle "published" tag
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1037
                  an.setTags(["published"]);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1038
                  save_local_annotations();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1039
                  widget.player.trigger("Annotation.publish", _annotation);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1040
                },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1041
                error: function (_xhr, _error, _thrown) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1042
                  ns.log("Error when sending annotation", _thrown);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1043
                },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1044
              });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1045
            }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1046
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1047
          this.$.find(".Ldt-AnnotationsList-TimeEdit").dblclick(function (e) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1048
            var _this = this;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1049
            // Use current player time
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1050
            var an = get_local_annotation(_this.dataset.editable_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1051
            if (an !== undefined) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1052
              // FIXME: implement Undo feature
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1053
              an.setBegin(widget.media.getCurrentTime().milliseconds);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1054
              save_local_annotations();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1055
              widget.player.trigger("Annotation.update", an);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1056
              widget.refresh(true);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1057
            }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1058
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1059
        }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1060
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1061
        this.$.find(".Ldt-AnnotationsList-Tag-Li").click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1062
          _this.source.getAnnotations().search(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1063
            jQuery(this)
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1064
              .text()
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1065
              .replace(/(^\s+|\s+$)/g, "")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1066
          );
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
  1067
        });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1068
        this.$.find(".Ldt-Annotation-Timecode").click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1069
          _this.media.setCurrentTime(Number(this.dataset.timecode));
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1070
        });
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1071
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1072
        this.$.find(".Ldt-AnnotationsList-Play").click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1073
          var _el = jQuery(this),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1074
            _annid = _el.attr("data-annotation-id");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1075
          if (_this.jwplayers[_annid]) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1076
            jwplayer(_this.jwplayers[_annid]).play();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1077
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1078
          _this.media.pause();
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
  1079
        });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1080
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1081
        if (this.source.getAnnotations().searching) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1082
          var rx = _this.source.getAnnotations().regexp || false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1083
          this.$.find(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1084
            ".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1085
          ).each(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1086
            var _$ = jQuery(this);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1087
            _$.html(ns.textFieldHtml(_$.text(), rx));
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1088
          });
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
  1089
        }
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1090
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1091
        this.$.find(".Ldt-AnnotationsList-DeleteButton").click(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1092
          _this.functionWrapper("onDeleteClick")
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1093
        );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1094
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1095
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1096
      if (this.ajax_url) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1097
        if (this.mashupMode) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1098
          this.ajaxMashup();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1099
        } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1100
          if (
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1101
            Math.abs(_currentTime - this.lastAjaxQuery) > this.ajax_granularity
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1102
          ) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1103
            this.ajaxSource();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1104
          }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1105
        }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1106
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1107
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1108
      return _list.length;
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
  1109
    }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1110
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1111
    onDeleteClick(event) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1112
      _list = this.getWidgetAnnotations();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1113
      ann_id = event.target.dataset.annotation;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1114
      delete_preview_$ = this.$.find(".Ldt-AnnotationsList-ul-ToDelete");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1115
      delete_preview_$.html("");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1116
      _list = _list.filter(function (_annotation) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1117
        return _annotation.id == ann_id;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1118
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1119
      var _annotation = _list[0],
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1120
        _title = "",
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1068
diff changeset
  1121
        _creator = "",
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1122
        _this = this;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1123
      if (_annotation.creator) {
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1124
        var _users = [],
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1125
          _user = {};
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1126
        if (_this.source.users_data) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1127
          _users = _this.source.users_data.filter(function (_user_data) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1128
            return _user_data.username == _annotation.creator;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1129
          });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1130
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1131
        if (_users.length == 0) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1132
          _user.username = _annotation.creator;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1133
        } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1134
          _user = _users[0];
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1135
        }
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1068
diff changeset
  1136
        _creator = _this.make_name_string_function(_user);
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1137
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1138
      if (_annotation.title) {
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1139
        var tempTitle = _annotation.title;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1140
        if (tempTitle.substr(0, _title.length + 1) == _title + ":") {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1141
          _title = "";
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1142
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1143
        _title = _title + (_title == "" ? "" : ": ") + _annotation.title;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1144
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1145
      var _created = false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1146
      if (this.show_creation_date) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1147
        _created =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1148
          _annotation.created.toLocaleDateString() +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1149
          ", " +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1150
          _annotation.created.toLocaleTimeString();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1151
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1152
      var _data = {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1153
        id: _annotation.id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1154
        media_id: _annotation.getMedia().id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1155
        htitle: ns.textFieldHtml(_title),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1156
        hdescription: ns.textFieldHtml(_annotation.description),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1157
        begin: _annotation.begin.toString(),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1158
        end: _annotation.end.toString(),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1159
        created: _created,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1160
        show_timecode: this.show_timecode,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1161
        show_creator: this.show_creator,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1162
        creator: _creator,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1163
        tags: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1164
        l10n: this.l10n,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1165
        allow_annotations_deletion: false,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1166
      };
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1167
      _html = Mustache.render(this.constructor.annotationTemplate, _data);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1168
      delete_preview_$.html(_html);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1169
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1170
      this.$.find(".Ldt-AnnotationsList-ConfirmDelete").click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1171
        _this.sendDelete(ann_id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1172
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1173
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1174
      this.showScreen("Delete");
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1175
    }
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1176
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1177
    refreshHeader() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1178
      var annotation_count_string =
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1179
        " (" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1180
        this.annotations_count +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1181
        " " +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1182
        this.annotations_count_header_string +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1183
        ")";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1184
      this.$.find(".Ldt-AnnotationsList-header").html("");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1185
      this.$.find(".Ldt-AnnotationsList-header").html(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1186
        this.custom_header && typeof this.custom_header == "string"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1187
          ? this.custom_header + annotation_count_string
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1188
          : this.l10n.header + annotation_count_string
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1189
      );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1190
    }
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1191
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1192
    hide() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1193
      var _this = this;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1194
      if (this.visible) {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1195
        this.visible = false;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1196
        this.widget_$.slideUp(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1197
          _this.$.find(".Ldt-AnnotationsList-header").hide();
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
  1198
        });
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1199
        this.showScreen("Main");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1200
      }
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1201
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1202
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1203
    show() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1204
      if (!this.visible) {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1205
        this.visible = true;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1206
        this.$.find(".Ldt-AnnotationsList-header").show();
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
  1207
        this.widget_$.slideDown();
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1208
        this.showScreen("Main");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1209
      }
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1210
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1211
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1212
    toggle() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1213
      if (!this.always_visible) {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1214
        if (this.visible) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1215
          this.hide();
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1216
        } else {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1217
          this.show();
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1218
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1219
      }
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1220
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
  1221
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1222
    revertToMainScreen() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1223
      if (this.$.find(".Ldt-AnnotationsList-ScreenMain").is(":hidden")) {
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1224
        this.showScreen("Main");
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1225
      }
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1226
    }
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1227
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1228
    sendDelete(id) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1229
      var _this = this,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1230
        _url = Mustache.render(this.api_delete_endpoint, {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1231
          annotation_id: id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1232
          project_id: this.project_id,
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1233
        });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1234
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1235
      jQuery.ajax({
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1236
        url: _url,
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1237
        type: this.api_delete_method,
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1238
        contentType: "application/json",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1239
        success: function (_data) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1240
          _this.showScreen("Success");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1241
          window.setTimeout(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1242
            _this.functionWrapper("revertToMainScreen"),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1243
            _this.after_send_timeout || 2000
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1244
          );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1245
          _this.currentSource.getAnnotations().removeId(id);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1246
          _this.player.trigger("AnnotationsList.refresh");
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1247
        },
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1248
        error: function (_xhr, _error, _thrown) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1249
          ns.log("Error when sending annotation", _thrown);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1250
          _this.showScreen("Error");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1251
          window.setTimeout(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1252
            _this.functionWrapper("revertToMainScreen"),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1253
            _this.after_send_timeout || 2000
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1254
          );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1255
        },
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1256
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1257
      this.showScreen("Sending");
1069
2409cb4cebaf getting various changes from github
ymh <ymh.work@gmail.com>
parents: 1068
diff changeset
  1258
    }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1259
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1260
    draw() {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1261
      this.jwplayers = {};
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1262
      this.mashupMode = this.media.elementType === "mashup";
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1263
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1264
      this.renderTemplate();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1265
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1266
      var _this = this;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1267
      this.list_$ = this.$.find(".Ldt-AnnotationsList-ul");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1268
      this.widget_$ = this.$.find(".Ldt-AnnotationsListWidget");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1269
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1270
      if (this.widget_max_height) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1271
        this.widget_$.css("max-height", this.widget_max_height);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1272
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1273
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1274
      if (this.show_filters) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1275
        if (this.user_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1276
          this.userselect_$ = this.$.find("#Ldt-AnnotationsList-userFilter");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1277
          this.userselect_$.change(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1278
            _this.player.trigger("AnnotationsList.refresh");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1279
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1280
          this.userselect_$.html(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1281
            "<option selected value='false'>" + this.l10n.everyone + "</option>"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1282
          );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1283
          this.usernames.forEach(function (_user) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1284
            var _users = _this.source.users_data.filter(function (_user_data) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1285
                return _user_data.username == _user;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1286
              }),
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1287
              _user_data = {};
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1288
            if (_users.length == 0) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1289
              _user_data.username = _user;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1290
            } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1291
              _user_data = _users[0];
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1292
            }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1293
            _this.userselect_$.append(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1294
              "<option value='" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1295
                _user +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1296
                "'>" +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1297
                _this.make_name_string_function(_user_data) +
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1298
                "</option>"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1299
            );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1300
          });
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1301
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1302
        if (this.keyword_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1303
          this.keywordinput_$ = this.$.find(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1304
            "#Ldt-AnnotationsList-keywordsFilter"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1305
          );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1306
          this.keywordinput_$.keyup(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1307
            _this.player.trigger("AnnotationsList.refresh");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1308
          });
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1309
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1310
        if (this.segment_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1311
          this.ignoresegmentcheckbox_$ = this.$.find(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1312
            "#Ldt-AnnotationsList-ignoreSegmentsFilter"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1313
          );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1314
          this.ignoresegmentcheckbox_$.click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1315
            _this.player.trigger("AnnotationsList.refresh");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1316
          });
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1317
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1318
        if (this.date_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1319
          this.datefilterinput_$ = this.$.find(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1320
            "#Ldt-AnnotationsList-dateFilter"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1321
          );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1322
          this.datefilterinput_$.datepicker({ dateFormat: "dd/mm/yy" });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1323
          this.datefilterinput_$.change(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1324
            _this.player.trigger("AnnotationsList.refresh");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1325
          });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1326
          if (this.current_day_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1327
            currentDate = new Date();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1328
            this.datefilterinput_$.datepicker("setDate", currentDate);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1329
          }
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1330
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1331
        if (this.latest_contributions_filter) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1332
          this.latestcontributionscheckbox_$ = this.$.find(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1333
            "#Ldt-AnnotationsList-latestContributionsFilter"
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1334
          );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1335
          this.latestcontributionscheckbox_$.click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1336
            _this.player.trigger("AnnotationsList.refresh");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1337
          });
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1338
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1339
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1340
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1341
      this.source.getAnnotations().on("search", function (_text) {
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1342
        _this.searchString = _text;
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1343
        if (_this.source !== _this.currentSource) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1344
          _this.currentSource.getAnnotations().search(_text);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1345
          _this.throttledRefresh();
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1346
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1347
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1348
      this.source.getAnnotations().on("found", function () {
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1349
        _this.throttledRefresh();
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1350
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1351
      this.source.getAnnotations().on("not-found", function () {
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1352
        _this.throttledRefresh();
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1353
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1354
      this.source.getAnnotations().on("clear-search", function () {
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1355
        _this.searchString = false;
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1356
        if (_this.source !== _this.currentSource) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1357
          _this.currentSource.getAnnotations().trigger("clear-search");
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1358
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1359
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1360
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1361
      this.$.find(".Ldt-AnnotationsList-Close").click(function () {
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1362
        _this.showScreen("Main");
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1363
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1364
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1365
      this.source.getAnnotations().on("search-cleared", function () {
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
  1366
        _this.throttledRefresh();
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1367
      });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1368
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1369
      this.onMdpEvent("AnnotationsList.refresh", function () {
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
  1370
        if (_this.ajax_url) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1371
          if (_this.mashupMode) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1372
            _this.ajaxMashup();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1373
          } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1374
            _this.ajaxSource();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1375
          }
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
  1376
        }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1377
        _this.throttledRefresh(false);
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1378
      });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1379
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1380
      this.onMdpEvent("AnnotationsList.update", function () {
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1381
        if (_this.ajax_url) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1382
          if (_this.mashupMode) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1383
            _this.ajaxMashup();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1384
          } else {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1385
            _this.ajaxSource();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1386
          }
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1387
        }
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1388
        _this.throttledRefresh(true);
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1389
      });
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1390
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1391
      if (this.ajax_url) {
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
  1392
        if (this.mashupMode) {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1393
          this.ajaxMashup();
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
  1394
        } else {
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1395
          this.ajaxSource();
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
  1396
        }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1397
      } else {
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
  1398
        this.currentSource = this.source;
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1399
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1400
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1401
      if (this.refresh_interval) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1402
        window.setInterval(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1403
          _this.currentSource.get();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1404
        }, this.refresh_interval);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1405
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1406
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1407
      if (this.annotations_count_header) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1408
        this.annotations_count = false;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1409
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1410
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1411
      this.onMdpEvent("AnnotationsList.toggle", "toggle");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1412
      this.onMdpEvent("AnnotationsList.hide", "hide");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1413
      this.onMdpEvent("AnnotationsList.show", "show");
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1414
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1415
      this.onMdpEvent(
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1416
        "createAnnotationWidget.addedAnnotation",
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1417
        this.throttledRefresh
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1418
      );
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1419
      var _events = ["timeupdate", "seeked", "loadedmetadata", "settimerange"];
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1420
      for (var _i = 0; _i < _events.length; _i++) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1421
        this.onMediaEvent(_events[_i], this.throttledRefresh);
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1422
      }
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1423
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1424
      this.throttledRefresh();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1425
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1426
      this.showScreen("Main");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1427
      this.$.find(".Ldt-AnnotationsList-CancelDelete").click(function () {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1428
        _this.showScreen("Main");
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1429
      });
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1430
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1431
      this.visible = true;
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1432
      if (!this.start_visible) {
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1433
        this.hide();
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1434
      }
1053
149a4ea20ea7 Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents: 1046
diff changeset
  1435
    }
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1436
  };
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1437
};
1068
7623f9af9272 merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents: 1059
diff changeset
  1438
1072
ac1eacb3aa33 Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents: 1069
diff changeset
  1439
export { AnnotationsList, annotationsListStyles };