Last active
March 15, 2018 16:53
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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