YouTube HQ Linker

By JoeSimmons Last update Sep 22, 2010 — Installed 1,091 times.

There are 6 previous versions of this script.

// ==UserScript==
// @name           YouTube HQ Linker
// @namespace      http://userscripts.org/users/23652
// @description    Shows an HQ link by the description of a video
// @include        http://*.youtube.com/watch?v=*
// @include        http://youtube.com/watch?v=*
// ==/UserScript==

function main() {
var cat = document.getElementById("watch-panel"),
	fixed_loc = location.href.replace(/(\&fmt=\d+)|(\#)/g, ''),
	link6 = document.createElement("a"),
	link18 = document.createElement("a"),
	link22 = document.createElement("a"),
	link37 = document.createElement("a"),
	holderDiv = document.createElement("div");
link6.textContent = "360p Link";
link6.href = fixed_loc;
link6.setAttribute("style", "margin-right: 14px;");

link18.textContent = "480p Link";
link18.href = fixed_loc + "&fmt=18";
link18.setAttribute("style", "margin-right: 14px;");

link22.textContent = "720p Link";
link22.href = fixed_loc + "&fmt=22";
link22.setAttribute("style", "margin-right: 14px;");

link37.textContent = "1080p Link";
link37.href = fixed_loc + "&fmt=37";

holderDiv.appendChild(link6);
holderDiv.appendChild(link18);
holderDiv.appendChild(link22);
holderDiv.appendChild(link37);

cat.insertBefore(holderDiv, cat.firstChild);
}

window.addEventListener('load', main, false);