Youtube true 720p player

Allows you to watch youtube videos in not distorted (scaled) 720p resolution. Click on the title of the video to redirect you.

Verze ze dne 05. 12. 2015. Zobrazit nejnovější verzi.

// ==UserScript==
// @name Youtube true 720p player
// @description Allows you to watch youtube videos in not distorted (scaled) 720p resolution. Click on the title of the video to redirect you.
// @author Jan harvalík [email protected]
// @version 1.5
// @date 2015-12-05
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @include http://www.youtube.com/*
// @include https://www.youtube.com/*
// @include http://www.youtube.com/user/*
// @include https://www.youtube.com/user/*
// @exclude http://www.youtube.com/embed/*
// @exclude https://www.youtube.com/embed/*
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-end
// @license     MIT License
// @namespace https://greasyfork.org/users/12627
// ==/UserScript==
var script = document.createElement('script');
script.src = "https://code.jquery.com/jquery-2.1.4.min.js";
document.getElementsByTagName('head')[0].appendChild(script);


var lastLocation ="";
window.setInterval(function(){
	if(lastLocation != $(location).attr('href')){
		if($('#progress').length === 0){	// progress bar exists => page is being loaded -> do nothing
		 	lastLocation=$(location).attr('href');
		    
		    
		    $( document ).ready(function() { // might be useless
		    	// for youtube.com/ and youtube.com/feed/subscriptions
				$(".yt-lockup-thumbnail a").each(function( index ) {				

					$(this).attr("href",
						$(this).get(0).href.replace('https://www.youtube.com/watch?v=', 'http://www.googledrive.com/host/0B-gs6HL8vtTZeXd3bHhqZmIwWjg/?v=')
					);

					$(this).attr('target','_blank');
					

					// adds text bellow thumbnails
					$(this).parent().after("<h5 style=\"color:red;\">&#9650; Watch in true 720p player</h5>"); // arrow up

				});

				// for youtube.com/watch
				$("#eow-title").before("&#9658;"); // arrow right
				$("#eow-title").parent().css("color", "red");
				$("#eow-title ").css("cursor","pointer");

				var v=$(location).attr("href").split('v=')[1];
				$("#eow-title").on( "click", function() {

					// Pause the video if playing
			        if($('.ytp-play-button').attr("aria-label") == "Pause"){
						$('.ytp-play-button').click();
			        }

					window.open("http://www.googledrive.com/host/0B-gs6HL8vtTZeXd3bHhqZmIwWjg/?v="+v,"_blank");
				});
			});	
		}	
	}
	
    
}, 100);