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.

当前为 2015-12-05 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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);