Youtube Hide Paused Gradient by Sapioit

Removes the annoying gradients visible when pausing a video.

目前为 2022-08-30 提交的版本。查看 最新版本

// ==UserScript==
// @name        Youtube Hide Paused Gradient by Sapioit
// @namespace   Sapioit
// @copyright   Sapioit, 2020 - Present
// @author      sapioitgmail.com
// @license     GPL-2.0-only; http://www.gnu.org/licenses/gpl-2.0.txt
// @include     https://www.youtube.com/*
// @include     https://youtu.be/*
// @description Removes the annoying gradients visible when pausing a video.
// @version     1.3.3.5
// @grant       GM_addStyle
// @grant       GM_registerMenuCommand
// @grant       GM_setValue
// @grant       GM_getValue
// ==/UserScript==


if (typeof document.getElementsByClassName("ytp-gradient-top")[0] != "undefined") {
    document.getElementsByClassName("ytp-gradient-top")[0].style.display = 'none';
}
if (typeof document.getElementsByClassName("ytp-gradient-top")[0] != "undefined") {
    document.getElementsByClassName("ytp-gradient-top")[0].style.opacity = '0';
}
if (typeof document.getElementsByClassName("ytp-gradient-bottom")[0] != "undefined") {
    document.getElementsByClassName("ytp-gradient-bottom")[0].style.display = 'none';
}
if (typeof document.getElementsByClassName("ytp-gradient-bottom")[0] != "undefined") {
    document.getElementsByClassName("ytp-gradient-bottom")[0].style.opacity = '0';
}

/*
document.getElementsByClassName("ytp-gradient-top")[0].style.display = 'none';
document.getElementsByClassName("ytp-gradient-top")[0].style.opacity = '0';
document.getElementsByClassName("ytp-gradient-bottom")[0].style.display = 'none';
document.getElementsByClassName("ytp-gradient-bottom")[0].style.opacity = '0';
*/

GM_addStyle('.ytp-gradient-top { display: none !important; opacity: 0 !important; }');
GM_addStyle('.ytp-gradient-top { width: none !important; opacity: 0 !important; }');

GM_addStyle('button div.ytp-autonav-toggle-button-container { display: none !important;}');
GM_addStyle('[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
//GM_addStyle('.ytp-button[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
GM_addStyle('--ytd-engagement-panel-section-list-rendere { display: none !important;}');
GM_addStyle('.ytp-time-display > span { padding: 3px; background: rgba(0, 0, 0, 0.5); }');
//GM_addStyle('.ytd-thumbnail-overlay-time-status-renderen { transition-duration: 0s; }');


window.onload = function(){setTimeout(function () {
    GM_addStyle('button div.ytp-autonav-toggle-button-container { display: none !important;}');
    GM_addStyle('[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
    GM_addStyle('--ytd-engagement-panel-section-list-rendere { display: none !important;}');
    GM_addStyle('#video-title.ytd-compact-video-renderer { overflow: none !important;}');
    //GM_addStyle('.ytd-thumbnail-overlay-time-status-renderen { transition-duration: 0s; }');
}, 5*1000)}; //loads after 5 seconds

function yourFunction(){
    GM_addStyle('button div.ytp-autonav-toggle-button-container { display: none !important;}');
    GM_addStyle('[data-tooltip-target-id="ytp-autonav-toggle-button"] { display: none !important;}');
    GM_addStyle('--ytd-engagement-panel-section-list-rendere { display: none !important;}');
    setTimeout(yourFunction, 30*1000); //loads every 30 seconds
}
yourFunction();

function add_hover_tooltips() {
    /*var video_titles = document.getElementsByTagName("h3").getElementsByClassName("ytd-compact-video-renderer").getElementsByTagName("span");*/
    /*var video_titles = document.querySelector("span.ytd-compact-video-renderer");*/
    //var video_titles = document.getElementsByTagName("span").getElementsByClassName("ytd-compact-video-renderer");

    /*var video_titles = document.querySelectorAll("span.ytd-compact-video-renderer");*/
    var video_titles = document.querySelectorAll("span.ytd-compact-video-renderer, #video-title");
    for(var i=0; i<video_titles.length; i++){
        console.log(video_titles[i]);
        var current_title = video_titles[i].getAttribute("title");
        video_titles[i].setAttribute("alt", current_title);
        video_titles[i].setAttribute("data-title", current_title);
        video_titles[i].setAttribute("data-tooltip", current_title);
    }
    /*
    video_titles = document.querySelectorAll("#video-title");
    for(i=0; i<video_titles.length; i++){
        console.log(video_titles[i]);
        current_title = video_titles[i].getAttribute("title");
        video_titles[i].setAttribute("alt", current_title);
        video_titles[i].setAttribute("data-title", current_title);
        video_titles[i].setAttribute("data-tooltip", current_title);
    }
    */
}

window.onloadstart = function(){setTimeout(function () {
    add_hover_tooltips();
}, 0.001*1000)}; //loads after 0.001 seconds

window.onload = function(){setTimeout(function () {
    add_hover_tooltips();
}, 3*1000)}; //loads after 3 seconds

window.onload = function(){setTimeout(function () {
    add_hover_tooltips();
}, 10*1000)}; //loads after 10 seconds


GM_addStyle("span[data-tooltip]:before { z-index:301; content: attr(data-tooltip);  position: absolute;  opacity: 0;  padding: 10px;  background: black;  color: white;}    span[data-tooltip]:hover:before {  opacity: 1;} ");
GM_addStyle(".yt-simple-endpoint[title]:before { z-index:301; content: attr(title);  position: absolute;  opacity: 0;  padding: 10px;  background: black;  color: white;}    .yt-simple-endpoint[title]:hover:before {  opacity: 1 !important;} ");


// <ytd-engagement-panel-section-list-renderer class="style-scope ytd-watch-flexy" visibility="ENGAGEMENT_PANEL_VISIBILITY_EXPANDED">GM_addStyle(a);