Created
August 18, 2015 15:25
-
-
Save thehowl/a4200f0eb2e877c86055 to your computer and use it in GitHub Desktop.
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 Flash youtube videos to HTML5 | |
// @namespace http://howl.moe/ | |
// @version 0.1 | |
// @description fuck flash with a fucking huge cactus. It goddamn sucks and should die in a fire. | |
// @author Howl | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== | |
var re = /^https?:\/\/(?:www.)?youtube.com\/v\/([^?&]+).*$/i; | |
var a = document.getElementsByTagName("object"); | |
for (var b = 0; b < a.length; b++) { | |
for (var c = 0; c < a[b].children.length; c++) { | |
if (a[b].children[c].tagName == "EMBED") { | |
if (re.test(a[b].children[c].src)) { | |
vid = re.exec(a[b].children[c].src)[1]; | |
frame = document.createElement("iframe"); | |
frame.src = "https://www.youtube.com/embed/" + vid; | |
frame.width = (a[b].width != "" ? a[b].width : 600); | |
frame.height = (a[b].height != "" ? a[b].height : 600); | |
frame.frameBorder = 0; | |
frame.allowFullscreen = true; | |
a[b].parentNode.replaceChild(frame, a[b]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment