Old Red YouTube Progress Bar

Restores the old solid red YouTube progress bars (video player, thumbnail overlay, hover preview progress bar and top loading bar) and ensures the style is applied dynamically even on page loads or DOM changes.

当前为 2024-10-23 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Old Red YouTube Progress Bar
// @namespace    https://greasyfork.org/en/users/1384870
// @version      1.1
// @description  Restores the old solid red YouTube progress bars (video player, thumbnail overlay, hover preview progress bar and top loading bar) and ensures the style is applied dynamically even on page loads or DOM changes.
// @author       Rastrisr
// @match        *://*.youtube.com/*
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to restore the old red YouTube progress bars
    function applyOldRedProgressBar() {
        // Check if the style element already exists
        let styleElement = document.getElementById('oldRedProgressBarStyle');
        if (!styleElement) {
            styleElement = document.createElement('style');
            styleElement.id = 'oldRedProgressBarStyle';
            document.head.appendChild(styleElement);
        }
        // Update or set the styles in the style element
        styleElement.innerHTML = `
        .ytp-play-progress {
            background: #FF0000 !important; /* Old solid red color for the video player progress bar */
        }
        #progress.ytd-thumbnail-overlay-resume-playback-renderer {
            background: #FF0000 !important; /* Old solid red color for the thumbnail overlay progress bar */
        }
        #progress.yt-page-navigation-progress {
            background: #FF0000 !important; /* Old solid red color for the top loading bar */
        }
        .YtProgressBarLineProgressBarPlayed {
            background: #FF0000 !important; /* Old Solid red color for the hover preview progress bar */
        }
        `;
    }

    // MutationObserver to ensure the red progress bar style is reapplied dynamically
    function observeForChanges() {
        const observer = new MutationObserver(() => {
            applyOldRedProgressBar();
        });

        observer.observe(document.body, { childList: true, subtree: true });
    }

    // Initial application of the old red progress bars and setting up the observer
    setTimeout(() => {
        applyOldRedProgressBar();
        observeForChanges();
    }, 2000);

})();