YouTube Always Hoverable ProgressBar

Makes progressbar hoverable from the very beginning (also works when paused).

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         YouTube Always Hoverable ProgressBar
// @namespace    https://github.com/Amadeus-AI
// @version      1.0.3
// @description  Makes progressbar hoverable from the very beginning (also works when paused).
// @icon         https://www.youtube.com/s/desktop/3748dff5/img/favicon_48.png
// @author       AmadeusAI
// @match        *://www.youtube.com/*
// @license      MIT
// ==/UserScript==
/*jshint esversion: 6 */

var InstantBar =
{
    css :
`
.ytp-chrome-bottom { opacity: 0 }
.ytp-chrome-top { opacity: 0 }
.ytp-gradient-bottom { opacity: 0 }
.ytp-gradient-top { opacity: 0 }
.html5-video-player:not(.ytp-fullscreen):hover > .ytp-chrome-bottom { opacity: 1 }
.html5-video-player:not(.ytp-fullscreen):hover > .ytp-gradient-bottom { opacity: 1 }
.html5-video-player.ytp-fullscreen > .ytp-chrome-bottom:hover { opacity: 1 }

`,

    apply : function()
    {
        if (typeof GM_addStyle !== "undefined")
        {
            GM_addStyle(InstantBar.css);
        }
        else
        {
            let styleNode = document.createElement("style");
            styleNode.appendChild(document.createTextNode(InstantBar.css));
            (document.querySelector("head") || document.documentElement).appendChild(styleNode);
        }
    },

    start : function()
    {
        // To overwrite youtube's default behavior
        setTimeout(InstantBar.apply, 0);
    }
};

InstantBar.start();