Script Summary: Replace all old YouTube embedding code (Flash) with new one (either Flash or HTML5 depending on your choice on YouTube).
Version: 0.0.3
Replace YouTube embedding code on every webpage that use the old way.
The old way always uses Flash (which use an <embed> tag), the new way (which use an <iframe> tag) allows you to choose, so that you can configure to use either Flash or HTML5 depending on your choice on YouTube.
This is not perfect (for now?): The description "replace all old YouTube embedding code" is perhaps a bit over-confident, it is more a goal than a guaranty. If you find a page where this is not the case or where the result doesn't looks like the original version, please report an issue, don't forget the page's URL. But first, check that it works on the YouTube's page of that same video (some content are served only in Flash).
Technical notes:
- This is developed for my personal use under Chromium 17 on Debian. It should work as well on Google Chrome on any operating system (just click "Install" on top, there no need for Greasemonkey in Chrome). From version 0.0.2, I tried to make it work under Firefox 7 with Greasemonkey (tested with Iceweasel 7.0.1 and Greasemonkey 0.9.12), perhaps it will work on other configuration.
-
There is a strange case for which I had to choose to introduce a bad heuristic. If the page designer styles directly an
<object>or an<embed>(usingobjectorembedCSS selector), this selector won't match anymore, as I transform theobject/embedto aniframe. In this case, I choose to extract the size from the currently computed style (thoughgetComputedStyle). For example: this page is designed usingobjectCSS selector. If I hadn't used that trick, it would have been rendered badly. The counterpart of this, is that if the page tries to change the style dynamically, it can't.
Changelog:
- Version 0.0.3: 2011-11-02, added trick for Firefox (this page was not working).
- Version 0.0.2: 2011-11-02, added compatibility with Firefox 7 (tested on Iceweasel 7), should perhaps work with earlier versions.
- Version 0.0.1: 2011-11-01, first release, works at least on Chromium 17, should work on Chrome 17 and perhaps earlier, perhaps even on Safari. Doesn't work on Firefox 7.
(Useless line: Once upon a time, there was garbage here added after this line by the http://userscripts.org/ 's description parser:)</iframe></embed>



