// ==UserScript==
// @name YouTube html5 unembedder
// @namespace http://jasonwoof.com/
// @description Replace YouTube html5 embedds with links
// @include *
// @exclude http://youtube.com/*
// @exclude http://www.youtube.com/*
// ==/UserScript==
// Copyright Jason Woofenden 2012. Use as you wish (CC0)
(function() {
var replace = function(old, replacement) {
old.parentNode.appendChild(replacement);
old.parentNode.removeChild(old);
}
var iframes = document.getElementsByTagName('iframe');
for (var i = iframes.length - 1; i >= 0; --i) {
var iframe = iframes[i];
var match = iframe.src.match(/^http:\/\/www.youtube.com\/embed\/([^?]*)/)
if (match) {
var div = document.createElement('div');
div.innerHTML = 'YouTube: ' + match[1] + '';
replace(iframe, div);
}
}
}());