Fandom Developers Wiki
No edit summary
m (Missing quotes were throwing errors.)
Line 132: Line 132:
 
frameborder: 0,
 
frameborder: 0,
 
scrolling: 'no',
 
scrolling: 'no',
height: 100%,
+
height: '100%',
width: 100%
+
width: '100%'
 
})
 
})
 
);
 
);

Revision as of 15:54, 10 June 2019

mw.hook('wikipage.content').add(function($content) {
    if (!$content) {
        return;
    }
    $content.find('[data-widget-id]:not(.loaded)').each(function() {
        var $this = $(this),
            id = encodeURIComponent($this.attr('data-widget-id')),
            css = {
                width: 'inherit',
                height: 'inherit'
            };
        switch($this.attr('class')) {
            case 'Crackle':
                $this.html(
                    $('<iframe>', {
                        src: 'https://www.crackle.com/embed/' + id,
                        css: css,
                        frameborder: 0,
                        scrolling: 'no',
                        allowfullscreen: true
                    })
                );
                break;
            case 'Facebook':
                $this.html(
                    $('<iframe>', {
                        src: 'https://www.facebook.com/video/embed?video_id=' + id,
                        frameboder: 0,
                        css: css
                    })
                );
                break;
            case 'playerim':
                $this.html(
                    $('<iframe>', {
                        src: 'https://vod02.cdn.web.tv/' + id + '.mp4.urlset/playlist-f3-v1-a1.m3u8',
                         frameborder: 0,
                        css: css
                    })
                );
                    break;
            case 'ok.ru':
                $this.html(
                    $('<iframe>', {
                        src: 'https://ok.ru/videoembed/' + id,
                         frameborder: 0,
                        css: css
                    }) 
                );
                break;
            case 'Vine':
                $this.html(
                    $('<iframe>', {
                        src: 'https://vine.co/v/' + id + '/embed/simple',
                        css: css
                    })
                );
                break;
            case 'afreeca':
                $this.html(
                    $('<iframe>', {
                        src: 'https://play.afreecatv.com/' + id + '/embed',
                        css: css,
                        frameborder: 0,
                        allowfullscreen: true
                    })
                );
                break;
            case 'internetArchive':
                $this.html(
                    $('<iframe>', {
                        src: 'https://archive.org/embed/' + id,
                        css: css,
                        frameboder: 0,
                        allowfullscreen: true
                    })
                );
                break;
            case 'web.tv':
                $this.html(
                    $('<iframe>', {
                        src: 'https://fandomcntr.web.tv/embed/' + id,
                         frameborder: 0,
                        css: css
                    })
                );
                break;
            case 'YahooTV':
                $this.html(
                    $('<iframe>', {
                        src: 'https://www.yahoo.com/tv/v/' + id + '?format=embed',
                        css: css,
                        allowfullscreen: true,
                        allowtransparency: true
                    })
                );
              break;
            case 'YoutubePlaylist':
                $this.html(
                    $('<iframe>', {
                        src: 'https://www.youtube.com/embed/' + id + '?list=' + encodeURIComponent($this.attr('data-list-id')),
                        css: css,
                        frameboder: 0,
                        allowfullscreen: true
                    })
                );
                break;
            case 'WikimediaCommons':
                $this.html(
                    $('<iframe>', {
                        src: 'https://commons.wikimedia.org/wiki/File%3A' + id + '?embedplayer=yes',
                        css: css,
                        frameborder: 0
                    })
                );
                break;
            case 'funnyordie':
                $this.html(
                    $('<iframe>', {
                        src: 'https://www.funnyordie.com/embed/' + id,
                        css: css,
                        frameborder: 0,
                        allowfullscreen: true
                    })
                );
                 break;
            case 'viloud':
                $this.html(
                    $('<iframe>', {
                        src:'//app.viloud.tv/player/embed/video/' + id,
                        css: css,
                        frameborder: 0,
                        scrolling: 'no',
                        height: '100%',
                        width: '100%'
                    })
                );
                break;
            case 'TwitchStream':
                $this.html(
                    $('<iframe>', {
                        src: 'https://player.twitch.tv/?channel=' + id,
                        css: css,
                        frameborder: 0,
                        scrolling: 'no',
                        height: 378,
                        width: 620
                    })
                );
                break;
            case 'ellenTube':
                $this.html(
                    $('<iframe>', {
                        src: 'https://widgets.ellentube.com/videos/' + id + '/',
                        css: css,
                        frameborder: 0,
                        allowfullscreen: true
                    })
                );
                break;
            case 'fandom':
                // TODO: FANDOM has switched to JWPlayer instead of Ooyala and there's a <jwplayer> parser tag
                $this.html(
                    $('<iframe>', {
                        src: 'https://player.ooyala.com/iframe.html' + id + '&docUrl=' + encodeURIComponent(window.location.href),
                        css: css,
                        allowfullscreen: true
                    })
                );
                break;
            case 'logo':
                $this.html(
                    $('<iframe>', {
                        src: 'https://media.mtvnservices.com/embed/mgid:arc:video:logotv.com:' + id,
                        frameborder: 0,
                        allowfullscreen: true,
                        css: {
                            width: '520px',
                            height: '288px'
                        }
                    })
                );
                break;
        }
        $this.addClass('loaded');
    });
});