Youtube true 720p player

Allows you to watch youtube videos in not distorted (scaled) 720p resolution. Thumbnails are direct links to the player.

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name Youtube true 720p player
// @description Allows you to watch youtube videos in not distorted (scaled) 720p resolution. Thumbnails are direct links to the player.
// @author Jan harvalík [email protected]
// @version 2.0
// @date 2015-12-07
// @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);
//  testing     0B-gs6HL8vtTZc3ZJSE9TNm9GXzg
//  i.html      0B-gs6HL8vtTZeXd3bHhqZmIwWjg
var playerversion = 20; // 2.0
var path = "http://www.googledrive.com/host/" + "0B-gs6HL8vtTZeXd3bHhqZmIwWjg/?playerversion=" + playerversion + "&v=";


window.setInterval(function() {

    // for most of thumbnails
    $('.contains-addto,.thumb-wrapper,.playlist-autoscroll-list').find('a').each(function(index) {

        if (!$(this).hasClass('trueplayer')) { // hasn't been changed

            $(this)
                .addClass('trueplayer')
                .attr("href", $(this).get(0).href.replace('https://www.youtube.com/watch?v=', path))
                .attr('target', '_blank')
                // adds text bellow thumbnails
                .parent().after('<h5 style="color:red;line-height: 120%;">Thumbnail is link to true 720p player</h5>');
        }

    });

    // for youtube.com/watch
    if (!$("#eow-title").hasClass('trueplayer')) { // hasn't been changed

        $("#eow-title")
            .addClass('trueplayer')
            .before("&#9658;") // arrow right
            .parent().css("color", "red")
            .css("cursor", "pointer");

        $("#eow-title").on("click", function() {

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

            //The "player" can't be file inside the computer (security), so google drive is used as server ( https://support.google.com/drive/answer/2881970?hl=en )
            //URL of the file is http://www.googledrive.com/host/0B-gs6HL8vtTZeXd3bHhqZmIwWjg/ 
            var parameters = $(location).attr("href").split('watch?v=')[1];
            window.open(path + parameters, "_blank"); // everything afrer v= (including &list=)
        });
    }

    // for lists (playlists)
    $('.yt-uix-scroller-scroll-unit .video-thumb').each(function(index) {

        if (!$(this).hasClass('trueplayer')) {  // hasn't been changed
            var parameters = $(this).parent('a').attr("href").split('watch?v=')[1];

            $(this)
                .addClass('trueplayer')
                .html('<a target="_blank" href="'+path+ parameters + '">' + $(this).html() + '</a>')
                .after('<h6 style="color:red;line-height: 120%;">Thumbnail is link to true 720p player</h6>');
        }

    });

    $(".yt-uix-scroller-scroll-unit").on("click", function() {
        // Pause the video if playing
        if ($('.ytp-play-button').attr("aria-label") == "Pause") {
            $('.ytp-play-button').click();
        }
    });

}, 300);