Skip to content

Instantly share code, notes, and snippets.

@thehowl
Created August 18, 2015 15:25
Show Gist options
  • Save thehowl/a4200f0eb2e877c86055 to your computer and use it in GitHub Desktop.
Save thehowl/a4200f0eb2e877c86055 to your computer and use it in GitHub Desktop.
// ==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