wavesurfer.js 6.2.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -10
- package/dist/plugin/wavesurfer.cursor.js +29 -49
- package/dist/plugin/wavesurfer.cursor.js.map +1 -1
- package/dist/plugin/wavesurfer.cursor.min.js +2 -2
- package/dist/plugin/wavesurfer.cursor.min.js.map +1 -1
- package/dist/plugin/wavesurfer.elan.js +19 -49
- package/dist/plugin/wavesurfer.elan.js.map +1 -1
- package/dist/plugin/wavesurfer.elan.min.js +1 -1
- package/dist/plugin/wavesurfer.elan.min.js.map +1 -1
- package/dist/plugin/wavesurfer.markers.js +87 -67
- package/dist/plugin/wavesurfer.markers.js.map +1 -1
- package/dist/plugin/wavesurfer.markers.min.js +2 -2
- package/dist/plugin/wavesurfer.markers.min.js.map +1 -1
- package/dist/plugin/wavesurfer.mediasession.js +5 -15
- package/dist/plugin/wavesurfer.mediasession.js.map +1 -1
- package/dist/plugin/wavesurfer.mediasession.min.js +1 -1
- package/dist/plugin/wavesurfer.mediasession.min.js.map +1 -1
- package/dist/plugin/wavesurfer.microphone.js +44 -62
- package/dist/plugin/wavesurfer.microphone.js.map +1 -1
- package/dist/plugin/wavesurfer.microphone.min.js +1 -1
- package/dist/plugin/wavesurfer.microphone.min.js.map +1 -1
- package/dist/plugin/wavesurfer.minimap.js +16 -68
- package/dist/plugin/wavesurfer.minimap.js.map +1 -1
- package/dist/plugin/wavesurfer.minimap.min.js +1 -1
- package/dist/plugin/wavesurfer.minimap.min.js.map +1 -1
- package/dist/plugin/wavesurfer.playhead.js +2 -29
- package/dist/plugin/wavesurfer.playhead.js.map +1 -1
- package/dist/plugin/wavesurfer.playhead.min.js +1 -1
- package/dist/plugin/wavesurfer.playhead.min.js.map +1 -1
- package/dist/plugin/wavesurfer.regions.js +99 -253
- package/dist/plugin/wavesurfer.regions.js.map +1 -1
- package/dist/plugin/wavesurfer.regions.min.js +2 -2
- package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
- package/dist/plugin/wavesurfer.spectrogram.js +52 -147
- package/dist/plugin/wavesurfer.spectrogram.js.map +1 -1
- package/dist/plugin/wavesurfer.spectrogram.min.js +2 -2
- package/dist/plugin/wavesurfer.spectrogram.min.js.map +1 -1
- package/dist/plugin/wavesurfer.timeline.js +42 -85
- package/dist/plugin/wavesurfer.timeline.js.map +1 -1
- package/dist/plugin/wavesurfer.timeline.min.js +1 -1
- package/dist/plugin/wavesurfer.timeline.min.js.map +1 -1
- package/dist/wavesurfer-html-init.js +31 -53
- package/dist/wavesurfer-html-init.js.map +1 -1
- package/dist/wavesurfer-html-init.min.js +1 -1
- package/dist/wavesurfer-html-init.min.js.map +1 -1
- package/dist/wavesurfer.js +448 -1008
- package/dist/wavesurfer.js.map +1 -1
- package/dist/wavesurfer.min.js +2 -2
- package/dist/wavesurfer.min.js.map +1 -1
- package/package.json +18 -19
- package/src/drawer.multicanvas.js +4 -4
- package/src/plugin/cursor/index.js +15 -3
- package/src/plugin/markers/index.js +70 -5
- package/src/plugin/regions/index.js +1 -1
- package/src/plugin/spectrogram/index.js +1 -1
- package/src/wavesurfer.js +12 -9
- package/CHANGES.md +0 -474
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wavesurfer.js elan plugin 6.
|
|
2
|
+
* wavesurfer.js elan plugin 6.4.0 (2022-11-05)
|
|
3
3
|
* https://wavesurfer-js.org
|
|
4
4
|
* @license BSD-3-Clause
|
|
5
5
|
*/
|
|
@@ -29,15 +29,10 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
29
29
|
value: true
|
|
30
30
|
}));
|
|
31
31
|
exports["default"] = void 0;
|
|
32
|
-
|
|
33
32
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
34
|
-
|
|
35
33
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
36
|
-
|
|
37
34
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
38
|
-
|
|
39
35
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
40
|
-
|
|
41
36
|
/**
|
|
42
37
|
* @typedef {Object} ElanPluginParams
|
|
43
38
|
* @property {string|HTMLElement} container CSS selector or HTML element where
|
|
@@ -47,7 +42,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
47
42
|
* @property {?Object} tiers If set only shows the data tiers with the `TIER_ID`
|
|
48
43
|
* in this map.
|
|
49
44
|
*/
|
|
50
|
-
|
|
51
45
|
/**
|
|
52
46
|
* Downloads and renders ELAN audio transcription documents alongside the
|
|
53
47
|
* waveform.
|
|
@@ -77,26 +71,21 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
77
71
|
var ElanPlugin = /*#__PURE__*/function () {
|
|
78
72
|
function ElanPlugin(params, ws) {
|
|
79
73
|
_classCallCheck(this, ElanPlugin);
|
|
80
|
-
|
|
81
74
|
_defineProperty(this, "Types", {
|
|
82
75
|
ALIGNABLE_ANNOTATION: 'ALIGNABLE_ANNOTATION',
|
|
83
76
|
REF_ANNOTATION: 'REF_ANNOTATION'
|
|
84
77
|
});
|
|
85
|
-
|
|
86
78
|
this.data = null;
|
|
87
79
|
this.params = params;
|
|
88
80
|
this.container = 'string' == typeof params.container ? document.querySelector(params.container) : params.container;
|
|
89
|
-
|
|
90
81
|
if (!this.container) {
|
|
91
82
|
throw Error('No container for ELAN');
|
|
92
83
|
}
|
|
93
84
|
}
|
|
94
|
-
|
|
95
85
|
_createClass(ElanPlugin, [{
|
|
96
86
|
key: "init",
|
|
97
87
|
value: function init() {
|
|
98
88
|
this.bindClick();
|
|
99
|
-
|
|
100
89
|
if (this.params.url) {
|
|
101
90
|
this.load(this.params.url);
|
|
102
91
|
}
|
|
@@ -111,12 +100,9 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
111
100
|
key: "load",
|
|
112
101
|
value: function load(url) {
|
|
113
102
|
var _this = this;
|
|
114
|
-
|
|
115
103
|
this.loadXML(url, function (xml) {
|
|
116
104
|
_this.data = _this.parseElan(xml);
|
|
117
|
-
|
|
118
105
|
_this.render();
|
|
119
|
-
|
|
120
106
|
_this.fireEvent('ready', _this.data);
|
|
121
107
|
});
|
|
122
108
|
}
|
|
@@ -135,7 +121,6 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
135
121
|
key: "parseElan",
|
|
136
122
|
value: function parseElan(xml) {
|
|
137
123
|
var _this2 = this;
|
|
138
|
-
|
|
139
124
|
var _forEach = Array.prototype.forEach;
|
|
140
125
|
var _map = Array.prototype.map;
|
|
141
126
|
var data = {
|
|
@@ -152,17 +137,14 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
152
137
|
data.media.type = media.getAttribute('MIME_TYPE');
|
|
153
138
|
var timeSlots = xml.querySelectorAll('TIME_ORDER TIME_SLOT');
|
|
154
139
|
var timeOrder = {};
|
|
155
|
-
|
|
156
140
|
_forEach.call(timeSlots, function (slot) {
|
|
157
|
-
var value = parseFloat(slot.getAttribute('TIME_VALUE'));
|
|
158
|
-
|
|
141
|
+
var value = parseFloat(slot.getAttribute('TIME_VALUE'));
|
|
142
|
+
// If in milliseconds, convert to seconds with rounding
|
|
159
143
|
if (inMilliseconds) {
|
|
160
144
|
value = Math.round(value * 1e2) / 1e5;
|
|
161
145
|
}
|
|
162
|
-
|
|
163
146
|
timeOrder[slot.getAttribute('TIME_SLOT_ID')] = value;
|
|
164
147
|
});
|
|
165
|
-
|
|
166
148
|
data.tiers = _map.call(xml.querySelectorAll('TIER'), function (tier) {
|
|
167
149
|
return {
|
|
168
150
|
id: tier.getAttribute('TIER_ID'),
|
|
@@ -175,37 +157,36 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
175
157
|
ref: node.getAttribute('ANNOTATION_REF'),
|
|
176
158
|
value: node.querySelector('ANNOTATION_VALUE').textContent.trim()
|
|
177
159
|
};
|
|
178
|
-
|
|
179
160
|
if (_this2.Types.ALIGNABLE_ANNOTATION == annot.type) {
|
|
180
161
|
// Add start & end to alignable annotation
|
|
181
162
|
annot.start = timeOrder[node.getAttribute('TIME_SLOT_REF1')];
|
|
182
|
-
annot.end = timeOrder[node.getAttribute('TIME_SLOT_REF2')];
|
|
183
|
-
|
|
163
|
+
annot.end = timeOrder[node.getAttribute('TIME_SLOT_REF2')];
|
|
164
|
+
// Add to the list of alignable annotations
|
|
184
165
|
data.alignableAnnotations.push(annot);
|
|
185
|
-
}
|
|
186
|
-
|
|
166
|
+
}
|
|
187
167
|
|
|
168
|
+
// Additionally, put into the flat map of all annotations
|
|
188
169
|
data.annotations[annot.id] = annot;
|
|
189
170
|
return annot;
|
|
190
171
|
})
|
|
191
172
|
};
|
|
192
|
-
});
|
|
173
|
+
});
|
|
193
174
|
|
|
175
|
+
// Create JavaScript references between annotations
|
|
194
176
|
data.tiers.forEach(function (tier) {
|
|
195
177
|
tier.annotations.forEach(function (annot) {
|
|
196
178
|
if (null != annot.ref) {
|
|
197
179
|
annot.reference = data.annotations[annot.ref];
|
|
198
180
|
}
|
|
199
181
|
});
|
|
200
|
-
});
|
|
182
|
+
});
|
|
201
183
|
|
|
184
|
+
// Sort alignable annotations by start & end
|
|
202
185
|
data.alignableAnnotations.sort(function (a, b) {
|
|
203
186
|
var d = a.start - b.start;
|
|
204
|
-
|
|
205
187
|
if (d == 0) {
|
|
206
188
|
d = b.end - a.end;
|
|
207
189
|
}
|
|
208
|
-
|
|
209
190
|
return d;
|
|
210
191
|
});
|
|
211
192
|
data.length = data.alignableAnnotations.length;
|
|
@@ -215,17 +196,15 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
215
196
|
key: "render",
|
|
216
197
|
value: function render() {
|
|
217
198
|
var _this3 = this;
|
|
218
|
-
|
|
219
199
|
// apply tiers filter
|
|
220
200
|
var tiers = this.data.tiers;
|
|
221
|
-
|
|
222
201
|
if (this.params.tiers) {
|
|
223
202
|
tiers = tiers.filter(function (tier) {
|
|
224
203
|
return tier.id in _this3.params.tiers;
|
|
225
204
|
});
|
|
226
|
-
}
|
|
227
|
-
|
|
205
|
+
}
|
|
228
206
|
|
|
207
|
+
// denormalize references to alignable annotations
|
|
229
208
|
var backRefs = {};
|
|
230
209
|
var indeces = {};
|
|
231
210
|
tiers.forEach(function (tier, index) {
|
|
@@ -234,7 +213,6 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
234
213
|
if (!(annot.reference.id in backRefs)) {
|
|
235
214
|
backRefs[annot.ref] = {};
|
|
236
215
|
}
|
|
237
|
-
|
|
238
216
|
backRefs[annot.ref][index] = annot;
|
|
239
217
|
indeces[index] = true;
|
|
240
218
|
}
|
|
@@ -243,11 +221,13 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
243
221
|
indeces = Object.keys(indeces).sort();
|
|
244
222
|
this.renderedAlignable = this.data.alignableAnnotations.filter(function (alignable) {
|
|
245
223
|
return backRefs[alignable.id];
|
|
246
|
-
});
|
|
224
|
+
});
|
|
247
225
|
|
|
226
|
+
// table
|
|
248
227
|
var table = this.table = document.createElement('table');
|
|
249
|
-
table.className = 'wavesurfer-annotations';
|
|
228
|
+
table.className = 'wavesurfer-annotations';
|
|
250
229
|
|
|
230
|
+
// head
|
|
251
231
|
var thead = document.createElement('thead');
|
|
252
232
|
var headRow = document.createElement('tr');
|
|
253
233
|
thead.appendChild(headRow);
|
|
@@ -261,14 +241,13 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
261
241
|
var th = document.createElement('th');
|
|
262
242
|
th.className = 'wavesurfer-tier-' + tier.id;
|
|
263
243
|
th.textContent = tier.id;
|
|
264
|
-
|
|
265
244
|
if (_this3.params.tiers) {
|
|
266
245
|
th.style.width = _this3.params.tiers[tier.id];
|
|
267
246
|
}
|
|
268
|
-
|
|
269
247
|
headRow.appendChild(th);
|
|
270
|
-
});
|
|
248
|
+
});
|
|
271
249
|
|
|
250
|
+
// body
|
|
272
251
|
var tbody = document.createElement('tbody');
|
|
273
252
|
table.appendChild(tbody);
|
|
274
253
|
this.renderedAlignable.forEach(function (alignable) {
|
|
@@ -284,7 +263,6 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
284
263
|
var tier = tiers[index];
|
|
285
264
|
var td = document.createElement('td');
|
|
286
265
|
var annotation = backRef[index];
|
|
287
|
-
|
|
288
266
|
if (annotation) {
|
|
289
267
|
td.id = 'wavesurfer-annotation-' + annotation.id;
|
|
290
268
|
td.dataset.ref = alignable.id;
|
|
@@ -292,7 +270,6 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
292
270
|
td.dataset.end = alignable.end;
|
|
293
271
|
td.textContent = annotation.value;
|
|
294
272
|
}
|
|
295
|
-
|
|
296
273
|
td.className = 'wavesurfer-tier-' + tier.id;
|
|
297
274
|
row.appendChild(td);
|
|
298
275
|
});
|
|
@@ -304,19 +281,15 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
304
281
|
key: "bindClick",
|
|
305
282
|
value: function bindClick() {
|
|
306
283
|
var _this4 = this;
|
|
307
|
-
|
|
308
284
|
this._onClick = function (e) {
|
|
309
285
|
var ref = e.target.dataset.ref;
|
|
310
|
-
|
|
311
286
|
if (null != ref) {
|
|
312
287
|
var annot = _this4.data.annotations[ref];
|
|
313
|
-
|
|
314
288
|
if (annot) {
|
|
315
289
|
_this4.fireEvent('select', annot.start, annot.end);
|
|
316
290
|
}
|
|
317
291
|
}
|
|
318
292
|
};
|
|
319
|
-
|
|
320
293
|
this.container.addEventListener('click', this._onClick);
|
|
321
294
|
}
|
|
322
295
|
}, {
|
|
@@ -328,7 +301,6 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
328
301
|
result = annotation;
|
|
329
302
|
return true;
|
|
330
303
|
}
|
|
331
|
-
|
|
332
304
|
return false;
|
|
333
305
|
});
|
|
334
306
|
return result;
|
|
@@ -359,10 +331,8 @@ var ElanPlugin = /*#__PURE__*/function () {
|
|
|
359
331
|
};
|
|
360
332
|
}
|
|
361
333
|
}]);
|
|
362
|
-
|
|
363
334
|
return ElanPlugin;
|
|
364
335
|
}();
|
|
365
|
-
|
|
366
336
|
exports["default"] = ElanPlugin;
|
|
367
337
|
module.exports = exports.default;
|
|
368
338
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wavesurfer.elan.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACqBA;EAwBjB,oBAAYC,MAAZ,EAAoBC,EAApB,EAAwB;IAAA;;IAAA,+BALhB;MACJC,oBAAoB,EAAE,sBADlB;MAEJC,cAAc,EAAE;IAFZ,CAKgB;;IACpB,KAAKC,IAAL,GAAY,IAAZ;IACA,KAAKJ,MAAL,GAAcA,MAAd;IACA,KAAKK,SAAL,GACI,YAAY,OAAOL,MAAM,CAACK,SAA1B,GACMC,QAAQ,CAACC,aAAT,CAAuBP,MAAM,CAACK,SAA9B,CADN,GAEML,MAAM,CAACK,SAHjB;;IAKA,IAAI,CAAC,KAAKA,SAAV,EAAqB;MACjB,MAAMG,KAAK,CAAC,uBAAD,CAAX;IACH;EACJ;;;;WAED,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,MAAP;IACH;;;WAED,2BAAkBJ,UAAlB,EAA8B;MAC1B,OAAOzF,QAAQ,CAAC+F,cAAT,CAAwB,0BAA0BN,UAAU,CAACxC,EAA7D,CAAP;IACH;;;;IA5QD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI,gBAAcvD,MAAd,EAAsB;MAClB,OAAO;QACHsG,IAAI,EAAE,MADH;QAEHC,SAAS,EAAEvG,MAAM,IAAIA,MAAM,CAACuG,SAAjB,GAA6BvG,MAAM,CAACuG,SAApC,GAAgD,KAFxD;QAGHvG,MAAM,EAAEA,MAHL;QAIHwG,QAAQ,EAAEzG;MAJP,CAAP;IAMH;;;;;;;;;;;;;UCrDL;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/elan/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/before-startup","webpack://WaveSurfer/webpack/startup","webpack://WaveSurfer/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"elan\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} ElanPluginParams\n * @property {string|HTMLElement} container CSS selector or HTML element where\n * the ELAN information should be rendered.\n * @property {string} url The location of ELAN XML data\n * @property {?boolean} deferInit Set to true to manually call\n * @property {?Object} tiers If set only shows the data tiers with the `TIER_ID`\n * in this map.\n */\n\n/**\n * Downloads and renders ELAN audio transcription documents alongside the\n * waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import ElanPlugin from 'wavesurfer.elan.js';\n *\n * // commonjs\n * var ElanPlugin = require('wavesurfer.elan.js');\n *\n * // if you are using <script> tags\n * var ElanPlugin = window.WaveSurfer.elan;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * ElanPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class ElanPlugin {\n /**\n * Elan plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {ElanPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'elan',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: ElanPlugin\n };\n }\n\n Types = {\n ALIGNABLE_ANNOTATION: 'ALIGNABLE_ANNOTATION',\n REF_ANNOTATION: 'REF_ANNOTATION'\n };\n\n constructor(params, ws) {\n this.data = null;\n this.params = params;\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw Error('No container for ELAN');\n }\n }\n\n init() {\n this.bindClick();\n\n if (this.params.url) {\n this.load(this.params.url);\n }\n }\n\n destroy() {\n this.container.removeEventListener('click', this._onClick);\n this.container.removeChild(this.table);\n }\n\n load(url) {\n this.loadXML(url, xml => {\n this.data = this.parseElan(xml);\n this.render();\n this.fireEvent('ready', this.data);\n });\n }\n\n loadXML(url, callback) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'document';\n xhr.send();\n xhr.addEventListener('load', e => {\n callback && callback(e.target.responseXML);\n });\n }\n\n parseElan(xml) {\n const _forEach = Array.prototype.forEach;\n const _map = Array.prototype.map;\n\n const data = {\n media: {},\n timeOrder: {},\n tiers: [],\n annotations: {},\n alignableAnnotations: []\n };\n\n const header = xml.querySelector('HEADER');\n const inMilliseconds =\n header.getAttribute('TIME_UNITS') == 'milliseconds';\n const media = header.querySelector('MEDIA_DESCRIPTOR');\n data.media.url = media.getAttribute('MEDIA_URL');\n data.media.type = media.getAttribute('MIME_TYPE');\n\n const timeSlots = xml.querySelectorAll('TIME_ORDER TIME_SLOT');\n const timeOrder = {};\n _forEach.call(timeSlots, slot => {\n let value = parseFloat(slot.getAttribute('TIME_VALUE'));\n // If in milliseconds, convert to seconds with rounding\n if (inMilliseconds) {\n value = Math.round(value * 1e2) / 1e5;\n }\n timeOrder[slot.getAttribute('TIME_SLOT_ID')] = value;\n });\n\n data.tiers = _map.call(xml.querySelectorAll('TIER'), tier => ({\n id: tier.getAttribute('TIER_ID'),\n linguisticTypeRef: tier.getAttribute('LINGUISTIC_TYPE_REF'),\n defaultLocale: tier.getAttribute('DEFAULT_LOCALE'),\n annotations: _map.call(\n tier.querySelectorAll('REF_ANNOTATION, ALIGNABLE_ANNOTATION'),\n node => {\n const annot = {\n type: node.nodeName,\n id: node.getAttribute('ANNOTATION_ID'),\n ref: node.getAttribute('ANNOTATION_REF'),\n value: node\n .querySelector('ANNOTATION_VALUE')\n .textContent.trim()\n };\n\n if (this.Types.ALIGNABLE_ANNOTATION == annot.type) {\n // Add start & end to alignable annotation\n annot.start =\n timeOrder[node.getAttribute('TIME_SLOT_REF1')];\n annot.end =\n timeOrder[node.getAttribute('TIME_SLOT_REF2')];\n // Add to the list of alignable annotations\n data.alignableAnnotations.push(annot);\n }\n\n // Additionally, put into the flat map of all annotations\n data.annotations[annot.id] = annot;\n\n return annot;\n }\n )\n }));\n\n // Create JavaScript references between annotations\n data.tiers.forEach(tier => {\n tier.annotations.forEach(annot => {\n if (null != annot.ref) {\n annot.reference = data.annotations[annot.ref];\n }\n });\n });\n\n // Sort alignable annotations by start & end\n data.alignableAnnotations.sort((a, b) => {\n let d = a.start - b.start;\n if (d == 0) {\n d = b.end - a.end;\n }\n return d;\n });\n\n data.length = data.alignableAnnotations.length;\n\n return data;\n }\n\n render() {\n // apply tiers filter\n let tiers = this.data.tiers;\n if (this.params.tiers) {\n tiers = tiers.filter(tier => tier.id in this.params.tiers);\n }\n\n // denormalize references to alignable annotations\n const backRefs = {};\n let indeces = {};\n tiers.forEach((tier, index) => {\n tier.annotations.forEach(annot => {\n if (\n annot.reference &&\n annot.reference.type == this.Types.ALIGNABLE_ANNOTATION\n ) {\n if (!(annot.reference.id in backRefs)) {\n backRefs[annot.ref] = {};\n }\n backRefs[annot.ref][index] = annot;\n indeces[index] = true;\n }\n });\n });\n indeces = Object.keys(indeces).sort();\n\n this.renderedAlignable = this.data.alignableAnnotations.filter(\n alignable => backRefs[alignable.id]\n );\n\n // table\n const table = (this.table = document.createElement('table'));\n table.className = 'wavesurfer-annotations';\n\n // head\n const thead = document.createElement('thead');\n const headRow = document.createElement('tr');\n thead.appendChild(headRow);\n table.appendChild(thead);\n const th = document.createElement('th');\n th.textContent = 'Time';\n th.className = 'wavesurfer-time';\n headRow.appendChild(th);\n indeces.forEach(index => {\n const tier = tiers[index];\n const th = document.createElement('th');\n th.className = 'wavesurfer-tier-' + tier.id;\n th.textContent = tier.id;\n if (this.params.tiers) { th.style.width = this.params.tiers[tier.id]; }\n headRow.appendChild(th);\n });\n\n // body\n const tbody = document.createElement('tbody');\n table.appendChild(tbody);\n this.renderedAlignable.forEach(alignable => {\n const row = document.createElement('tr');\n row.id = 'wavesurfer-alignable-' + alignable.id;\n tbody.appendChild(row);\n\n const td = document.createElement('td');\n td.className = 'wavesurfer-time';\n td.textContent =\n alignable.start.toFixed(1) + '–' + alignable.end.toFixed(1);\n row.appendChild(td);\n\n const backRef = backRefs[alignable.id];\n indeces.forEach(index => {\n const tier = tiers[index];\n const td = document.createElement('td');\n const annotation = backRef[index];\n if (annotation) {\n td.id = 'wavesurfer-annotation-' + annotation.id;\n td.dataset.ref = alignable.id;\n td.dataset.start = alignable.start;\n td.dataset.end = alignable.end;\n td.textContent = annotation.value;\n }\n td.className = 'wavesurfer-tier-' + tier.id;\n row.appendChild(td);\n });\n });\n\n this.container.innerHTML = '';\n this.container.appendChild(table);\n }\n\n bindClick() {\n this._onClick = e => {\n const ref = e.target.dataset.ref;\n if (null != ref) {\n const annot = this.data.annotations[ref];\n if (annot) {\n this.fireEvent('select', annot.start, annot.end);\n }\n }\n };\n this.container.addEventListener('click', this._onClick);\n }\n\n getRenderedAnnotation(time) {\n let result;\n this.renderedAlignable.some(annotation => {\n if (annotation.start <= time && annotation.end >= time) {\n result = annotation;\n return true;\n }\n return false;\n });\n return result;\n }\n\n getAnnotationNode(annotation) {\n return document.getElementById('wavesurfer-alignable-' + annotation.id);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/plugin/elan/index.js\");\n",""],"names":["ElanPlugin","params","ws","ALIGNABLE_ANNOTATION","REF_ANNOTATION","data","container","document","querySelector","Error","bindClick","url","load","removeEventListener","_onClick","removeChild","table","loadXML","xml","parseElan","render","fireEvent","callback","xhr","XMLHttpRequest","open","responseType","send","addEventListener","e","target","responseXML","_forEach","Array","prototype","forEach","_map","map","media","timeOrder","tiers","annotations","alignableAnnotations","header","inMilliseconds","getAttribute","type","timeSlots","querySelectorAll","call","slot","value","parseFloat","Math","round","tier","id","linguisticTypeRef","defaultLocale","node","annot","nodeName","ref","textContent","trim","Types","start","end","push","reference","sort","a","b","d","length","filter","backRefs","indeces","index","Object","keys","renderedAlignable","alignable","createElement","className","thead","headRow","appendChild","th","style","width","tbody","row","td","toFixed","backRef","annotation","dataset","innerHTML","time","result","some","getElementById","name","deferInit","instance"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"wavesurfer.elan.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,CAAC;AACD;;;;;;;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAzBA,IA0BqBA,UAAU;EAwB3B,oBAAYC,MAAM,EAAEC,EAAE,EAAE;IAAA;IAAA,+BALhB;MACJC,oBAAoB,EAAE,sBAAsB;MAC5CC,cAAc,EAAE;IACpB,CAAC;IAGG,IAAI,CAACC,IAAI,GAAG,IAAI;IAChB,IAAI,CAACJ,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACK,SAAS,GACV,QAAQ,IAAI,OAAOL,MAAM,CAACK,SAAS,GAC7BC,QAAQ,CAACC,aAAa,CAACP,MAAM,CAACK,SAAS,CAAC,GACxCL,MAAM,CAACK,SAAS;IAE1B,IAAI,CAAC,IAAI,CAACA,SAAS,EAAE;MACjB,MAAMG,KAAK,CAAC,uBAAuB,CAAC;IACxC;EACJ;EAAC;IAAA;IAAA,OAED,gBAAO;MACH,IAAI,CAACC,SAAS,EAAE;MAEhB,IAAI,IAAI,CAACT,MAAM,CAACU,GAAG,EAAE;QACjB,IAAI,CAACC,IAAI,CAAC,IAAI,CAACX,MAAM,CAACU,GAAG,CAAC;MAC9B;IACJ;EAAC;IAAA;IAAA,OAED,mBAAU;MACN,IAAI,CAACL,SAAS,CAACO,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAACC,QAA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1B,OAAOzF,QAAQ,CAAC+F,cAAc,CAAC,uBAAuB,GAAGN,UAAU,CAACxC,EAAE,CAAC;IAC3E;EAAC;IAAA;IAAA;IA5QD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI,gBAAcvD,MAAM,EAAE;MAClB,OAAO;QACHsG,IAAI,EAAE,MAAM;QACZC,SAAS,EAAEvG,MAAM,IAAIA,MAAM,CAACuG,SAAS,GAAGvG,MAAM,CAACuG,SAAS,GAAG,KAAK;QAChEvG,MAAM,EAAEA,MAAM;QACdwG,QAAQ,EAAEzG;MACd,CAAC;IACL;EAAC;EAAA;AAAA;AAAA;AAAA;;;;;;UCrDL;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/elan/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/before-startup","webpack://WaveSurfer/webpack/startup","webpack://WaveSurfer/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"elan\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} ElanPluginParams\n * @property {string|HTMLElement} container CSS selector or HTML element where\n * the ELAN information should be rendered.\n * @property {string} url The location of ELAN XML data\n * @property {?boolean} deferInit Set to true to manually call\n * @property {?Object} tiers If set only shows the data tiers with the `TIER_ID`\n * in this map.\n */\n\n/**\n * Downloads and renders ELAN audio transcription documents alongside the\n * waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import ElanPlugin from 'wavesurfer.elan.js';\n *\n * // commonjs\n * var ElanPlugin = require('wavesurfer.elan.js');\n *\n * // if you are using <script> tags\n * var ElanPlugin = window.WaveSurfer.elan;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * ElanPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class ElanPlugin {\n /**\n * Elan plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {ElanPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'elan',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: ElanPlugin\n };\n }\n\n Types = {\n ALIGNABLE_ANNOTATION: 'ALIGNABLE_ANNOTATION',\n REF_ANNOTATION: 'REF_ANNOTATION'\n };\n\n constructor(params, ws) {\n this.data = null;\n this.params = params;\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw Error('No container for ELAN');\n }\n }\n\n init() {\n this.bindClick();\n\n if (this.params.url) {\n this.load(this.params.url);\n }\n }\n\n destroy() {\n this.container.removeEventListener('click', this._onClick);\n this.container.removeChild(this.table);\n }\n\n load(url) {\n this.loadXML(url, xml => {\n this.data = this.parseElan(xml);\n this.render();\n this.fireEvent('ready', this.data);\n });\n }\n\n loadXML(url, callback) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'document';\n xhr.send();\n xhr.addEventListener('load', e => {\n callback && callback(e.target.responseXML);\n });\n }\n\n parseElan(xml) {\n const _forEach = Array.prototype.forEach;\n const _map = Array.prototype.map;\n\n const data = {\n media: {},\n timeOrder: {},\n tiers: [],\n annotations: {},\n alignableAnnotations: []\n };\n\n const header = xml.querySelector('HEADER');\n const inMilliseconds =\n header.getAttribute('TIME_UNITS') == 'milliseconds';\n const media = header.querySelector('MEDIA_DESCRIPTOR');\n data.media.url = media.getAttribute('MEDIA_URL');\n data.media.type = media.getAttribute('MIME_TYPE');\n\n const timeSlots = xml.querySelectorAll('TIME_ORDER TIME_SLOT');\n const timeOrder = {};\n _forEach.call(timeSlots, slot => {\n let value = parseFloat(slot.getAttribute('TIME_VALUE'));\n // If in milliseconds, convert to seconds with rounding\n if (inMilliseconds) {\n value = Math.round(value * 1e2) / 1e5;\n }\n timeOrder[slot.getAttribute('TIME_SLOT_ID')] = value;\n });\n\n data.tiers = _map.call(xml.querySelectorAll('TIER'), tier => ({\n id: tier.getAttribute('TIER_ID'),\n linguisticTypeRef: tier.getAttribute('LINGUISTIC_TYPE_REF'),\n defaultLocale: tier.getAttribute('DEFAULT_LOCALE'),\n annotations: _map.call(\n tier.querySelectorAll('REF_ANNOTATION, ALIGNABLE_ANNOTATION'),\n node => {\n const annot = {\n type: node.nodeName,\n id: node.getAttribute('ANNOTATION_ID'),\n ref: node.getAttribute('ANNOTATION_REF'),\n value: node\n .querySelector('ANNOTATION_VALUE')\n .textContent.trim()\n };\n\n if (this.Types.ALIGNABLE_ANNOTATION == annot.type) {\n // Add start & end to alignable annotation\n annot.start =\n timeOrder[node.getAttribute('TIME_SLOT_REF1')];\n annot.end =\n timeOrder[node.getAttribute('TIME_SLOT_REF2')];\n // Add to the list of alignable annotations\n data.alignableAnnotations.push(annot);\n }\n\n // Additionally, put into the flat map of all annotations\n data.annotations[annot.id] = annot;\n\n return annot;\n }\n )\n }));\n\n // Create JavaScript references between annotations\n data.tiers.forEach(tier => {\n tier.annotations.forEach(annot => {\n if (null != annot.ref) {\n annot.reference = data.annotations[annot.ref];\n }\n });\n });\n\n // Sort alignable annotations by start & end\n data.alignableAnnotations.sort((a, b) => {\n let d = a.start - b.start;\n if (d == 0) {\n d = b.end - a.end;\n }\n return d;\n });\n\n data.length = data.alignableAnnotations.length;\n\n return data;\n }\n\n render() {\n // apply tiers filter\n let tiers = this.data.tiers;\n if (this.params.tiers) {\n tiers = tiers.filter(tier => tier.id in this.params.tiers);\n }\n\n // denormalize references to alignable annotations\n const backRefs = {};\n let indeces = {};\n tiers.forEach((tier, index) => {\n tier.annotations.forEach(annot => {\n if (\n annot.reference &&\n annot.reference.type == this.Types.ALIGNABLE_ANNOTATION\n ) {\n if (!(annot.reference.id in backRefs)) {\n backRefs[annot.ref] = {};\n }\n backRefs[annot.ref][index] = annot;\n indeces[index] = true;\n }\n });\n });\n indeces = Object.keys(indeces).sort();\n\n this.renderedAlignable = this.data.alignableAnnotations.filter(\n alignable => backRefs[alignable.id]\n );\n\n // table\n const table = (this.table = document.createElement('table'));\n table.className = 'wavesurfer-annotations';\n\n // head\n const thead = document.createElement('thead');\n const headRow = document.createElement('tr');\n thead.appendChild(headRow);\n table.appendChild(thead);\n const th = document.createElement('th');\n th.textContent = 'Time';\n th.className = 'wavesurfer-time';\n headRow.appendChild(th);\n indeces.forEach(index => {\n const tier = tiers[index];\n const th = document.createElement('th');\n th.className = 'wavesurfer-tier-' + tier.id;\n th.textContent = tier.id;\n if (this.params.tiers) { th.style.width = this.params.tiers[tier.id]; }\n headRow.appendChild(th);\n });\n\n // body\n const tbody = document.createElement('tbody');\n table.appendChild(tbody);\n this.renderedAlignable.forEach(alignable => {\n const row = document.createElement('tr');\n row.id = 'wavesurfer-alignable-' + alignable.id;\n tbody.appendChild(row);\n\n const td = document.createElement('td');\n td.className = 'wavesurfer-time';\n td.textContent =\n alignable.start.toFixed(1) + '–' + alignable.end.toFixed(1);\n row.appendChild(td);\n\n const backRef = backRefs[alignable.id];\n indeces.forEach(index => {\n const tier = tiers[index];\n const td = document.createElement('td');\n const annotation = backRef[index];\n if (annotation) {\n td.id = 'wavesurfer-annotation-' + annotation.id;\n td.dataset.ref = alignable.id;\n td.dataset.start = alignable.start;\n td.dataset.end = alignable.end;\n td.textContent = annotation.value;\n }\n td.className = 'wavesurfer-tier-' + tier.id;\n row.appendChild(td);\n });\n });\n\n this.container.innerHTML = '';\n this.container.appendChild(table);\n }\n\n bindClick() {\n this._onClick = e => {\n const ref = e.target.dataset.ref;\n if (null != ref) {\n const annot = this.data.annotations[ref];\n if (annot) {\n this.fireEvent('select', annot.start, annot.end);\n }\n }\n };\n this.container.addEventListener('click', this._onClick);\n }\n\n getRenderedAnnotation(time) {\n let result;\n this.renderedAlignable.some(annotation => {\n if (annotation.start <= time && annotation.end >= time) {\n result = annotation;\n return true;\n }\n return false;\n });\n return result;\n }\n\n getAnnotationNode(annotation) {\n return document.getElementById('wavesurfer-alignable-' + annotation.id);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/plugin/elan/index.js\");\n",""],"names":["ElanPlugin","params","ws","ALIGNABLE_ANNOTATION","REF_ANNOTATION","data","container","document","querySelector","Error","bindClick","url","load","removeEventListener","_onClick","removeChild","table","loadXML","xml","parseElan","render","fireEvent","callback","xhr","XMLHttpRequest","open","responseType","send","addEventListener","e","target","responseXML","_forEach","Array","prototype","forEach","_map","map","media","timeOrder","tiers","annotations","alignableAnnotations","header","inMilliseconds","getAttribute","type","timeSlots","querySelectorAll","call","slot","value","parseFloat","Math","round","tier","id","linguisticTypeRef","defaultLocale","node","annot","nodeName","ref","textContent","trim","Types","start","end","push","reference","sort","a","b","d","length","filter","backRefs","indeces","index","Object","keys","renderedAlignable","alignable","createElement","className","thead","headRow","appendChild","th","style","width","tbody","row","td","toFixed","backRef","annotation","dataset","innerHTML","time","result","some","getElementById","name","deferInit","instance"],"sourceRoot":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wavesurfer.elan.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,GAAIA,EAAiB,WAAQ,KAAIC,KAR9E,CASGK,MAAM,IACT,M,4QC0BqBC,EAAAA,WAwBjB,WAAYC,EAAQC,G,UAQhB,G,4FARoB,S,EALhB,CACJC,qBAAsB,uBACtBC,eAAgB,mB,EAGI,W,EAAA,M,sFACpBC,KAAKC,KAAO,KACZD,KAAKJ,OAASA,EACdI,KAAKE,UACD,iBAAmBN,EAAOM,UACpBC,SAASC,cAAcR,EAAOM,WAC9BN,EAAOM,WAEZF,KAAKE,UACN,MAAMG,MAAM,yB,4CAvBpB,SAAcT,GACV,MAAO,CACHU,KAAM,OACNC,aAAWX,IAAUA,EAAOW,YAAYX,EAAOW,UAC/CX,OAAQA,EACRY,SAAUb,O,qBAsBlB,WACIK,KAAKS,YAEDT,KAAKJ,OAAOc,KACZV,KAAKW,KAAKX,KAAKJ,OAAOc,O,qBAI9B,WACIV,KAAKE,UAAUU,oBAAoB,QAASZ,KAAKa,UACjDb,KAAKE,UAAUY,YAAYd,KAAKe,S,kBAGpC,SAAKL,GAAK,WACNV,KAAKgB,QAAQN,GAAK,SAAAO,GACd,EAAKhB,KAAO,EAAKiB,UAAUD,GAC3B,EAAKE,SACL,EAAKC,UAAU,QAAS,EAAKnB,W,qBAIrC,SAAQS,EAAKW,GACT,IAAMC,EAAM,IAAIC,eACh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MiC,EAAMjC,EAAEC,OAAOmE,QAAQnC,IAC7B,GAAI,MAAQA,EAAK,CACb,IAAMF,EAAQ,EAAK1D,KAAKuC,YAAYqB,GAChCF,GACA,EAAKvC,UAAU,SAAUuC,EAAMM,MAAON,EAAMO,OAIxDlE,KAAKE,UAAUyB,iBAAiB,QAAS3B,KAAKa,Y,mCAGlD,SAAsBqF,GAClB,IAAIC,EAQJ,OAPAnG,KAAKgF,kBAAkBoB,MAAK,SAAAL,GACxB,OAAIA,EAAW9B,OAASiC,GAAQH,EAAW7B,KAAOgC,IAC9CC,EAASJ,GACF,MAIRI,I,+BAGX,SAAkBJ,GACd,OAAO5F,SAASkG,eAAe,wBAA0BN,EAAWxC,S,gFA5QvD5D,G,kCCnCjB2G,EAA2B,GCE/B,IAAIC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAapH,QAGrB,IAAIC,EAAS+G,EAAyBG,GAAY,CAGjDnH,QAAS,IAOV,OAHAsH,EAAoBH,GAAUlH,EAAQA,EAAOD,QAASkH,GAG/CjH,EAAOD,QClBWkH,CAAoB,K,UHO9C","sources":["webpack://WaveSurfer/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/elan/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"elan\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} ElanPluginParams\n * @property {string|HTMLElement} container CSS selector or HTML element where\n * the ELAN information should be rendered.\n * @property {string} url The location of ELAN XML data\n * @property {?boolean} deferInit Set to true to manually call\n * @property {?Object} tiers If set only shows the data tiers with the `TIER_ID`\n * in this map.\n */\n\n/**\n * Downloads and renders ELAN audio transcription documents alongside the\n * waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import ElanPlugin from 'wavesurfer.elan.js';\n *\n * // commonjs\n * var ElanPlugin = require('wavesurfer.elan.js');\n *\n * // if you are using <script> tags\n * var ElanPlugin = window.WaveSurfer.elan;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * ElanPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class ElanPlugin {\n /**\n * Elan plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {ElanPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'elan',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: ElanPlugin\n };\n }\n\n Types = {\n ALIGNABLE_ANNOTATION: 'ALIGNABLE_ANNOTATION',\n REF_ANNOTATION: 'REF_ANNOTATION'\n };\n\n constructor(params, ws) {\n this.data = null;\n this.params = params;\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw Error('No container for ELAN');\n }\n }\n\n init() {\n this.bindClick();\n\n if (this.params.url) {\n this.load(this.params.url);\n }\n }\n\n destroy() {\n this.container.removeEventListener('click', this._onClick);\n this.container.removeChild(this.table);\n }\n\n load(url) {\n this.loadXML(url, xml => {\n this.data = this.parseElan(xml);\n this.render();\n this.fireEvent('ready', this.data);\n });\n }\n\n loadXML(url, callback) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'document';\n xhr.send();\n xhr.addEventListener('load', e => {\n callback && callback(e.target.responseXML);\n });\n }\n\n parseElan(xml) {\n const _forEach = Array.prototype.forEach;\n const _map = Array.prototype.map;\n\n const data = {\n media: {},\n timeOrder: {},\n tiers: [],\n annotations: {},\n alignableAnnotations: []\n };\n\n const header = xml.querySelector('HEADER');\n const inMilliseconds =\n header.getAttribute('TIME_UNITS') == 'milliseconds';\n const media = header.querySelector('MEDIA_DESCRIPTOR');\n data.media.url = media.getAttribute('MEDIA_URL');\n data.media.type = media.getAttribute('MIME_TYPE');\n\n const timeSlots = xml.querySelectorAll('TIME_ORDER TIME_SLOT');\n const timeOrder = {};\n _forEach.call(timeSlots, slot => {\n let value = parseFloat(slot.getAttribute('TIME_VALUE'));\n // If in milliseconds, convert to seconds with rounding\n if (inMilliseconds) {\n value = Math.round(value * 1e2) / 1e5;\n }\n timeOrder[slot.getAttribute('TIME_SLOT_ID')] = value;\n });\n\n data.tiers = _map.call(xml.querySelectorAll('TIER'), tier => ({\n id: tier.getAttribute('TIER_ID'),\n linguisticTypeRef: tier.getAttribute('LINGUISTIC_TYPE_REF'),\n defaultLocale: tier.getAttribute('DEFAULT_LOCALE'),\n annotations: _map.call(\n tier.querySelectorAll('REF_ANNOTATION, ALIGNABLE_ANNOTATION'),\n node => {\n const annot = {\n type: node.nodeName,\n id: node.getAttribute('ANNOTATION_ID'),\n ref: node.getAttribute('ANNOTATION_REF'),\n value: node\n .querySelector('ANNOTATION_VALUE')\n .textContent.trim()\n };\n\n if (this.Types.ALIGNABLE_ANNOTATION == annot.type) {\n // Add start & end to alignable annotation\n annot.start =\n timeOrder[node.getAttribute('TIME_SLOT_REF1')];\n annot.end =\n timeOrder[node.getAttribute('TIME_SLOT_REF2')];\n // Add to the list of alignable annotations\n data.alignableAnnotations.push(annot);\n }\n\n // Additionally, put into the flat map of all annotations\n data.annotations[annot.id] = annot;\n\n return annot;\n }\n )\n }));\n\n // Create JavaScript references between annotations\n data.tiers.forEach(tier => {\n tier.annotations.forEach(annot => {\n if (null != annot.ref) {\n annot.reference = data.annotations[annot.ref];\n }\n });\n });\n\n // Sort alignable annotations by start & end\n data.alignableAnnotations.sort((a, b) => {\n let d = a.start - b.start;\n if (d == 0) {\n d = b.end - a.end;\n }\n return d;\n });\n\n data.length = data.alignableAnnotations.length;\n\n return data;\n }\n\n render() {\n // apply tiers filter\n let tiers = this.data.tiers;\n if (this.params.tiers) {\n tiers = tiers.filter(tier => tier.id in this.params.tiers);\n }\n\n // denormalize references to alignable annotations\n const backRefs = {};\n let indeces = {};\n tiers.forEach((tier, index) => {\n tier.annotations.forEach(annot => {\n if (\n annot.reference &&\n annot.reference.type == this.Types.ALIGNABLE_ANNOTATION\n ) {\n if (!(annot.reference.id in backRefs)) {\n backRefs[annot.ref] = {};\n }\n backRefs[annot.ref][index] = annot;\n indeces[index] = true;\n }\n });\n });\n indeces = Object.keys(indeces).sort();\n\n this.renderedAlignable = this.data.alignableAnnotations.filter(\n alignable => backRefs[alignable.id]\n );\n\n // table\n const table = (this.table = document.createElement('table'));\n table.className = 'wavesurfer-annotations';\n\n // head\n const thead = document.createElement('thead');\n const headRow = document.createElement('tr');\n thead.appendChild(headRow);\n table.appendChild(thead);\n const th = document.createElement('th');\n th.textContent = 'Time';\n th.className = 'wavesurfer-time';\n headRow.appendChild(th);\n indeces.forEach(index => {\n const tier = tiers[index];\n const th = document.createElement('th');\n th.className = 'wavesurfer-tier-' + tier.id;\n th.textContent = tier.id;\n if (this.params.tiers) { th.style.width = this.params.tiers[tier.id]; }\n headRow.appendChild(th);\n });\n\n // body\n const tbody = document.createElement('tbody');\n table.appendChild(tbody);\n this.renderedAlignable.forEach(alignable => {\n const row = document.createElement('tr');\n row.id = 'wavesurfer-alignable-' + alignable.id;\n tbody.appendChild(row);\n\n const td = document.createElement('td');\n td.className = 'wavesurfer-time';\n td.textContent =\n alignable.start.toFixed(1) + '–' + alignable.end.toFixed(1);\n row.appendChild(td);\n\n const backRef = backRefs[alignable.id];\n indeces.forEach(index => {\n const tier = tiers[index];\n const td = document.createElement('td');\n const annotation = backRef[index];\n if (annotation) {\n td.id = 'wavesurfer-annotation-' + annotation.id;\n td.dataset.ref = alignable.id;\n td.dataset.start = alignable.start;\n td.dataset.end = alignable.end;\n td.textContent = annotation.value;\n }\n td.className = 'wavesurfer-tier-' + tier.id;\n row.appendChild(td);\n });\n });\n\n this.container.innerHTML = '';\n this.container.appendChild(table);\n }\n\n bindClick() {\n this._onClick = e => {\n const ref = e.target.dataset.ref;\n if (null != ref) {\n const annot = this.data.annotations[ref];\n if (annot) {\n this.fireEvent('select', annot.start, annot.end);\n }\n }\n };\n this.container.addEventListener('click', this._onClick);\n }\n\n getRenderedAnnotation(time) {\n let result;\n this.renderedAlignable.some(annotation => {\n if (annotation.start <= time && annotation.end >= time) {\n result = annotation;\n return true;\n }\n return false;\n });\n return result;\n }\n\n getAnnotationNode(annotation) {\n return document.getElementById('wavesurfer-alignable-' + annotation.id);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(375);\n"],"names":["root","factory","exports","module","define","amd","self","ElanPlugin","params","ws","ALIGNABLE_ANNOTATION","REF_ANNOTATION","this","data","container","document","querySelector","Error","name","deferInit","instance","bindClick","url","load","removeEventListener","_onClick","removeChild","table","loadXML","xml","parseElan","render","fireEvent","callback","xhr","XMLHttpRequest","open","responseType","send","addEventListener","e","target","responseXML","_forEach","Array","prototype","forEach","_map","map","media","timeOrder","tiers","annotations","alignableAnnotations","header","inMilliseconds","getAttribute","type","timeSlots","querySelectorAll","call","slot","value","parseFloat","Math","round","tier","id","linguisticTypeRef","defaultLocale","node","annot","nodeName","ref","textContent","trim","Types","start","end","push","reference","sort","a","b","d","length","filter","backRefs","indeces","index","Object","keys","renderedAlignable","alignable","createElement","className","thead","headRow","appendChild","th","style","width","tbody","row","td","toFixed","backRef","annotation","dataset","innerHTML","time","result","some","getElementById","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"wavesurfer.elan.min.js","mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,aAAc,GAAIH,GACC,iBAAZC,QACdA,QAAoB,WAAID,KAExBD,EAAiB,WAAIA,EAAiB,YAAK,CAAC,EAAGA,EAAiB,WAAQ,KAAIC,IAC7E,CATD,CASGK,MAAM,IACT,M,wQCAA,IA0BqBC,EAAU,WAwB3B,WAAYC,EAAQC,G,UAQhB,G,4FARoB,S,EALhB,CACJC,qBAAsB,uBACtBC,eAAgB,mB,EAGI,W,EAAA,M,sFACpBC,KAAKC,KAAO,KACZD,KAAKJ,OAASA,EACdI,KAAKE,UACD,iBAAmBN,EAAOM,UACpBC,SAASC,cAAcR,EAAOM,WAC9BN,EAAOM,WAEZF,KAAKE,UACN,MAAMG,MAAM,wBAEpB,C,UAlBC,O,EAkBA,E,EA0OA,qBAnQD,SAAcT,GACV,MAAO,CACHU,KAAM,OACNC,aAAWX,IAAUA,EAAOW,YAAYX,EAAOW,UAC/CX,OAAQA,EACRY,SAAUb,EAElB,K,EAkBC,mBAED,WACIK,KAAKS,YAEDT,KAAKJ,OAAOc,KACZV,KAAKW,KAAKX,KAAKJ,OAAOc,IAE9B,GAAC,qBAED,WACIV,KAAKE,UAAUU,oB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er/webpack/universalModuleDefinition","webpack://WaveSurfer/./src/plugin/elan/index.js","webpack://WaveSurfer/webpack/bootstrap","webpack://WaveSurfer/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"WaveSurfer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"WaveSurfer\"] = factory();\n\telse\n\t\troot[\"WaveSurfer\"] = root[\"WaveSurfer\"] || {}, root[\"WaveSurfer\"][\"elan\"] = factory();\n})(self, () => {\nreturn ","/**\n * @typedef {Object} ElanPluginParams\n * @property {string|HTMLElement} container CSS selector or HTML element where\n * the ELAN information should be rendered.\n * @property {string} url The location of ELAN XML data\n * @property {?boolean} deferInit Set to true to manually call\n * @property {?Object} tiers If set only shows the data tiers with the `TIER_ID`\n * in this map.\n */\n\n/**\n * Downloads and renders ELAN audio transcription documents alongside the\n * waveform.\n *\n * @implements {PluginClass}\n * @extends {Observer}\n * @example\n * // es6\n * import ElanPlugin from 'wavesurfer.elan.js';\n *\n * // commonjs\n * var ElanPlugin = require('wavesurfer.elan.js');\n *\n * // if you are using <script> tags\n * var ElanPlugin = window.WaveSurfer.elan;\n *\n * // ... initialising wavesurfer with the plugin\n * var wavesurfer = WaveSurfer.create({\n * // wavesurfer options ...\n * plugins: [\n * ElanPlugin.create({\n * // plugin options ...\n * })\n * ]\n * });\n */\nexport default class ElanPlugin {\n /**\n * Elan plugin definition factory\n *\n * This function must be used to create a plugin definition which can be\n * used by wavesurfer to correctly instantiate the plugin.\n *\n * @param {ElanPluginParams} params parameters use to initialise the plugin\n * @return {PluginDefinition} an object representing the plugin\n */\n static create(params) {\n return {\n name: 'elan',\n deferInit: params && params.deferInit ? params.deferInit : false,\n params: params,\n instance: ElanPlugin\n };\n }\n\n Types = {\n ALIGNABLE_ANNOTATION: 'ALIGNABLE_ANNOTATION',\n REF_ANNOTATION: 'REF_ANNOTATION'\n };\n\n constructor(params, ws) {\n this.data = null;\n this.params = params;\n this.container =\n 'string' == typeof params.container\n ? document.querySelector(params.container)\n : params.container;\n\n if (!this.container) {\n throw Error('No container for ELAN');\n }\n }\n\n init() {\n this.bindClick();\n\n if (this.params.url) {\n this.load(this.params.url);\n }\n }\n\n destroy() {\n this.container.removeEventListener('click', this._onClick);\n this.container.removeChild(this.table);\n }\n\n load(url) {\n this.loadXML(url, xml => {\n this.data = this.parseElan(xml);\n this.render();\n this.fireEvent('ready', this.data);\n });\n }\n\n loadXML(url, callback) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'document';\n xhr.send();\n xhr.addEventListener('load', e => {\n callback && callback(e.target.responseXML);\n });\n }\n\n parseElan(xml) {\n const _forEach = Array.prototype.forEach;\n const _map = Array.prototype.map;\n\n const data = {\n media: {},\n timeOrder: {},\n tiers: [],\n annotations: {},\n alignableAnnotations: []\n };\n\n const header = xml.querySelector('HEADER');\n const inMilliseconds =\n header.getAttribute('TIME_UNITS') == 'milliseconds';\n const media = header.querySelector('MEDIA_DESCRIPTOR');\n data.media.url = media.getAttribute('MEDIA_URL');\n data.media.type = media.getAttribute('MIME_TYPE');\n\n const timeSlots = xml.querySelectorAll('TIME_ORDER TIME_SLOT');\n const timeOrder = {};\n _forEach.call(timeSlots, slot => {\n let value = parseFloat(slot.getAttribute('TIME_VALUE'));\n // If in milliseconds, convert to seconds with rounding\n if (inMilliseconds) {\n value = Math.round(value * 1e2) / 1e5;\n }\n timeOrder[slot.getAttribute('TIME_SLOT_ID')] = value;\n });\n\n data.tiers = _map.call(xml.querySelectorAll('TIER'), tier => ({\n id: tier.getAttribute('TIER_ID'),\n linguisticTypeRef: tier.getAttribute('LINGUISTIC_TYPE_REF'),\n defaultLocale: tier.getAttribute('DEFAULT_LOCALE'),\n annotations: _map.call(\n tier.querySelectorAll('REF_ANNOTATION, ALIGNABLE_ANNOTATION'),\n node => {\n const annot = {\n type: node.nodeName,\n id: node.getAttribute('ANNOTATION_ID'),\n ref: node.getAttribute('ANNOTATION_REF'),\n value: node\n .querySelector('ANNOTATION_VALUE')\n .textContent.trim()\n };\n\n if (this.Types.ALIGNABLE_ANNOTATION == annot.type) {\n // Add start & end to alignable annotation\n annot.start =\n timeOrder[node.getAttribute('TIME_SLOT_REF1')];\n annot.end =\n timeOrder[node.getAttribute('TIME_SLOT_REF2')];\n // Add to the list of alignable annotations\n data.alignableAnnotations.push(annot);\n }\n\n // Additionally, put into the flat map of all annotations\n data.annotations[annot.id] = annot;\n\n return annot;\n }\n )\n }));\n\n // Create JavaScript references between annotations\n data.tiers.forEach(tier => {\n tier.annotations.forEach(annot => {\n if (null != annot.ref) {\n annot.reference = data.annotations[annot.ref];\n }\n });\n });\n\n // Sort alignable annotations by start & end\n data.alignableAnnotations.sort((a, b) => {\n let d = a.start - b.start;\n if (d == 0) {\n d = b.end - a.end;\n }\n return d;\n });\n\n data.length = data.alignableAnnotations.length;\n\n return data;\n }\n\n render() {\n // apply tiers filter\n let tiers = this.data.tiers;\n if (this.params.tiers) {\n tiers = tiers.filter(tier => tier.id in this.params.tiers);\n }\n\n // denormalize references to alignable annotations\n const backRefs = {};\n let indeces = {};\n tiers.forEach((tier, index) => {\n tier.annotations.forEach(annot => {\n if (\n annot.reference &&\n annot.reference.type == this.Types.ALIGNABLE_ANNOTATION\n ) {\n if (!(annot.reference.id in backRefs)) {\n backRefs[annot.ref] = {};\n }\n backRefs[annot.ref][index] = annot;\n indeces[index] = true;\n }\n });\n });\n indeces = Object.keys(indeces).sort();\n\n this.renderedAlignable = this.data.alignableAnnotations.filter(\n alignable => backRefs[alignable.id]\n );\n\n // table\n const table = (this.table = document.createElement('table'));\n table.className = 'wavesurfer-annotations';\n\n // head\n const thead = document.createElement('thead');\n const headRow = document.createElement('tr');\n thead.appendChild(headRow);\n table.appendChild(thead);\n const th = document.createElement('th');\n th.textContent = 'Time';\n th.className = 'wavesurfer-time';\n headRow.appendChild(th);\n indeces.forEach(index => {\n const tier = tiers[index];\n const th = document.createElement('th');\n th.className = 'wavesurfer-tier-' + tier.id;\n th.textContent = tier.id;\n if (this.params.tiers) { th.style.width = this.params.tiers[tier.id]; }\n headRow.appendChild(th);\n });\n\n // body\n const tbody = document.createElement('tbody');\n table.appendChild(tbody);\n this.renderedAlignable.forEach(alignable => {\n const row = document.createElement('tr');\n row.id = 'wavesurfer-alignable-' + alignable.id;\n tbody.appendChild(row);\n\n const td = document.createElement('td');\n td.className = 'wavesurfer-time';\n td.textContent =\n alignable.start.toFixed(1) + '–' + alignable.end.toFixed(1);\n row.appendChild(td);\n\n const backRef = backRefs[alignable.id];\n indeces.forEach(index => {\n const tier = tiers[index];\n const td = document.createElement('td');\n const annotation = backRef[index];\n if (annotation) {\n td.id = 'wavesurfer-annotation-' + annotation.id;\n td.dataset.ref = alignable.id;\n td.dataset.start = alignable.start;\n td.dataset.end = alignable.end;\n td.textContent = annotation.value;\n }\n td.className = 'wavesurfer-tier-' + tier.id;\n row.appendChild(td);\n });\n });\n\n this.container.innerHTML = '';\n this.container.appendChild(table);\n }\n\n bindClick() {\n this._onClick = e => {\n const ref = e.target.dataset.ref;\n if (null != ref) {\n const annot = this.data.annotations[ref];\n if (annot) {\n this.fireEvent('select', annot.start, annot.end);\n }\n }\n };\n this.container.addEventListener('click', this._onClick);\n }\n\n getRenderedAnnotation(time) {\n let result;\n this.renderedAlignable.some(annotation => {\n if (annotation.start <= time && annotation.end >= time) {\n result = annotation;\n return true;\n }\n return false;\n });\n return result;\n }\n\n getAnnotationNode(annotation) {\n return document.getElementById('wavesurfer-alignable-' + annotation.id);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(375);\n"],"names":["root","factory","exports","module","define","amd","self","ElanPlugin","params","ws","ALIGNABLE_ANNOTATION","REF_ANNOTATION","this","data","container","document","querySelector","Error","name","deferInit","instance","bindClick","url","load","removeEventListener","_onClick","removeChild","table","loadXML","xml","parseElan","render","fireEvent","callback","xhr","XMLHttpRequest","open","responseType","send","addEventListener","e","target","responseXML","_forEach","Array","prototype","forEach","_map","map","media","timeOrder","tiers","annotations","alignableAnnotations","header","inMilliseconds","getAttribute","type","timeSlots","querySelectorAll","call","slot","value","parseFloat","Math","round","tier","id","linguisticTypeRef","defaultLocale","node","annot","nodeName","ref","textContent","trim","Types","start","end","push","reference","sort","a","b","d","length","filter","backRefs","indeces","index","Object","keys","renderedAlignable","alignable","createElement","className","thead","headRow","appendChild","th","style","width","tbody","row","td","toFixed","backRef","annotation","dataset","innerHTML","time","result","some","getElementById","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
|