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 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);