Actions

User

User:Lawiki1534virus/common.js

From Screamer Wiki

Revision as of 23:58, 11 May 2019 by imported>Lawiki1534virus (test)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
mw.hook('wikipage.content').add(function($content) {
    $content.find('.bitchuteplayer:not(.loaded)').each(function() {
        var $this = $(this),
            data = $this.data(),
            uri = new mw.Uri('https://www.bitchute.com/embed/'),
            id = String(data.id || '').trim(),
            loop = String(data.loop || '').trim();
 
        if (id === '') {
            console.warn('[BitChute Player] Video ID is not defined.');
            return;
        }
 
        uri.path += id;;
 
        $this.html(
            $('<iframe>', {
                width: String(data.width || '').trim(),
                height: String(data.height || '').trim(),
                src: uri.toString(),
                allowfullscreen: 'true',
                allow: 'fullscreen' + (loop ? '; autoplay' : '')
            })
        ).addClass('loaded');
    });
});