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

Method _loadMedia

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

Source from the content-addressed store, hash-verified

7export default class Imgur extends Media {
8
9 _loadMedia() {
10 try {
11 var self = this;
12
13 if (this.data.url.match("<blockquote class=['\"]imgur-embed-pub['\"]")) {
14 var found = this.data.url.match(/(imgur\.com)\/(\w+)/);
15 this.media_id = found[2];
16 this.data.url = "http://imgur.com/gallery/" + this.media_id;
17 } else if (this.data.url) {
18 this.media_id = this.data.url.split('/').slice(-1)[0];
19 }
20
21 loadJS([
22 'https://s.imgur.com/min/embed.js'
23 ],
24 function() {
25 self.createMedia();
26 }
27 );
28
29 } catch (e) {
30 this.loadErrorDisplay(this._("imgur_invalidurl_err"));
31 }
32 }
33
34 createMedia() {
35 var self = this;

Callers

nothing calls this directly

Calls 4

loadJSFunction · 0.90
loadErrorDisplayMethod · 0.80
createMediaMethod · 0.45
_Method · 0.45

Tested by

no test coverage detected