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

Method _loadMedia

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

Source from the content-addressed store, hash-verified

5 /* Load the media
6 ================================================== */
7 _loadMedia() {
8 var url,
9 self = this;
10
11 // Create Dom element
12 this._el.content_item = this.domCreate("div", "tl-media-item tl-media-iframe", this._el.content);
13
14 // Get Media ID
15 if (this.data.url.match(/open\?id=([^&]+)/)) {
16 var doc_id = this.data.url.match(/open\?id=([^&]+)/)[1];
17 url = 'https://drive.google.com/file/d/' + doc_id + '/preview'
18 } else if (this.data.url.match(/file\/d\/([^/]*)\/?/)) {
19 var doc_id = this.data.url.match(/file\/d\/([^/]*)\/?/)[1];
20 url = 'https://drive.google.com/file/d/' + doc_id + '/preview'
21 } else {
22 url = this.data.url;
23 }
24
25 // this URL makes something suitable for an img src but what if it's not an image?
26 // api_url = "http://www.googledrive.com/host/" + this.media_id + "/";
27
28 this._el.content_item.innerHTML = "<iframe class='doc' frameborder='0' width='100%' height='100%' src='" + url + "'></iframe>";
29
30 // After Loaded
31 this.onLoaded();
32 }
33
34 // Update Media Display
35 _updateMediaDisplay() {

Callers

nothing calls this directly

Calls 2

domCreateMethod · 0.80
onLoadedMethod · 0.45

Tested by

no test coverage detected