Restores the old solid red YouTube progress bars (video player, thumbnail overlay, and top loading bar) and ensures the style is applied dynamically even on page loads or DOM changes.
当前为
// ==UserScript==
// @name Old Red YouTube Progress Bar
// @namespace https://greasyfork.org/en/users/1384870
// @version 1.0
// @description Restores the old solid red YouTube progress bars (video player, thumbnail overlay, 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() {
let styleElement = document.createElement('style');
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 */
}
`;
document.head.appendChild(styleElement);
}
// MutationObserver to ensure the red progress bar style is reapplied dynamically
function observeForChanges() {
const observer = new MutationObserver(() => {
applyOldRedProgressBar(); // Reapply the old red progress bars when DOM changes are detected
});
observer.observe(document.body, { childList: true, subtree: true });
}
// Initial application of the old red progress bars and setting up the observer
setTimeout(() => {
applyOldRedProgressBar();
observeForChanges(); // Start observing for DOM changes
}, 2000);
})();