// ==UserScript==
// @name           Youtube fmt 18 hack
// @namespace      userscripts.org
// @description    Changes the video to the higher resolution version
// @version        0.2
// @include        http://youtube.com/watch?*
// @include        http://www.youtube.com/watch?*
// @include        http://*.youtube.com/watch?*
// ==/UserScript==

if (!/.*fmt=18.*/.test(document.URL))
  window.location.replace(document.URL + '&fmt=18');

// Update by Pazzo on Aug 16, 2008:
// Remunge all the links on the page to high-quality as well.
var links = document.getElementsByTagName("a");

for (var i = 0; i < links.length; ++i) {
  if (/\/watch\?.*/i.test(links[i].href) && !(/.*fmt=18.*/i.test(links[i].href)))
    links[i].href = links[i].href + '&fmt=18';
}

