MCPcopy
hub / github.com/NUKnightLab/TimelineJS3 / _loadMedia

Method _loadMedia

src/js/media/types/DocumentCloud.js:7–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5export default class DocumentCloud extends Media {
6
7 _loadMedia() {
8 var self = this;
9
10 // Create Dom elements
11 this._el.content_item = this.domCreate("div", "tl-media-item tl-media-documentcloud tl-media-shadow", this._el.content);
12 this._el.content_item.id = unique_ID(7)
13
14 // Check url
15 if (this.data.url.match(/\.html$/)) {
16 this.data.url = this._transformURL(this.data.url);
17 } else if (!(this.data.url.match(/.(json|js)$/))) {
18 trace("DOCUMENT CLOUD IN URL BUT INVALID SUFFIX");
19 }
20
21 // Load viewer API
22 loadJS([
23 'https://assets.documentcloud.org/viewer/loader.js',
24 'https://assets.documentcloud.org/viewer/viewer.js'
25 ],
26 function() {
27 self.createMedia();
28 }
29 );
30 }
31
32 // Viewer API needs js, not html
33 _transformURL(url) {

Callers

nothing calls this directly

Calls 6

_transformURLMethod · 0.95
unique_IDFunction · 0.90
traceFunction · 0.90
loadJSFunction · 0.90
domCreateMethod · 0.80
createMediaMethod · 0.45

Tested by

no test coverage detected