Skip to content

Instantly share code, notes, and snippets.

@alagos
Last active March 15, 2018 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alagos/da8ee3ada7795c59189c2a30f5ae847b to your computer and use it in GitHub Desktop.
Save alagos/da8ee3ada7795c59189c2a30f5ae847b to your computer and use it in GitHub Desktop.
Removes the RUDO video player (www.digitalproserver.com/rudo) and replaces it by the corresponding youtube video
// ==UserScript==
// @name RUDO player remover
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Removes the RUDO video player (www.digitalproserver.com/rudo) and replaces it by the corresponding youtube video
// @author Alter Lagos
// @match *://rudo.video/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (window.top !== window.self) {
const scripts = window.self.document.getElementsByTagName('script');
let ytId, match;
let i = 0;
while (ytId == undefined && i < scripts.length) {
match = scripts[i].innerHTML.match(/youtube\.com\/watch\?v=(.*)'/);
if (match !== null) {
ytId = match[1];
}
i++;
}
if (ytId !== undefined) {
const body = window.self.document.body;
var template = document.createElement('template');
template.innerHTML = '<iframe allowfullscreen></iframe>';
var ytIframe = template.content.firstChild;
ytIframe.src = "https://www.youtube.com/embed/" + ytId;
ytIframe.style = 'border: none; height: 100vh; width: 100vw;';
ytIframe.frameborder = "0";
ytIframe.allow = "autoplay; encrypted-media";
body.innerHTML = '';
body.appendChild(ytIframe);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment