// ==UserScript==
// @name           youtube in HD
// @namespace      youtube.com/
// @include        http://youtube.com/watch?v=*
// ==/UserScript==

var fullscreen = false
function removeDivs(id, status) {
	for (div in id) {
		var crap = document.getElementById(id[div])
		//crap.parentNode.removeChild(crap)
		crap.style.display = status ? "none" : ""
		fullscreen = status
	}
}

var divs = [
	"watch-other-vids", "watch-ratings-views",
	"watch-actions-area", "watch-active-sharing",
	"watch-comments-stats", "footer"
]

document.addEventListener("keydown",
	function(evt) {
		if (evt.which == 0x46) { // f
			var vid = document.getElementById("watch-player-div").firstChild
			if (!fullscreen) {
				vid.setAttribute("width", 800)
				vid.setAttribute("height", 500)
				removeDivs(divs, true)
			} else {
				vid.setAttribute("width", 480)
				vid.setAttribute("height", 395)
				removeDivs(divs, false)
			}
		}
	},
	false
)
