Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2024
3,610
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.55 KB | Source Code | 1 0
  1. // ==UserScript==
  2. // @name         YouTube red seekbar
  3. // @namespace    http://tampermonkey.net/
  4. // @version      2024-10-18
  5. // @description  sets seekbar color back to just red.
  6. // @author       You
  7. // @match        https://www.youtube.com/*
  8. // @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. const colorHex = "#f03";
  13.  
  14. // doesn't work with shorts
  15. (function() {
  16.     'use strict';
  17.  
  18.     window.addEventListener("yt-navigate-finish", e => {
  19.         setSeekBarColor();
  20.         // this event unfortunately fires before chapters are loaded, so this is simple workaround.
  21.         setTimeout(() => {
  22.             setSeekBarColor();
  23.         }, 1000);
  24.     });
  25.  
  26.     setTimeout(() => {
  27.         setSeekBarColor();
  28.     }, 1000);
  29. })();
  30.  
  31. function setSeekBarColor() {
  32.     const seekBarElements = document.getElementsByClassName("ytp-play-progress ytp-swatch-background-color");
  33.     const thumbnailElements = document.getElementsByClassName("style-scope ytd-thumbnail-overlay-resume-playback-renderer");
  34.     const scrubberButtonElements = document.getElementsByClassName("ytp-scrubber-button ytp-swatch-background-color");
  35.  
  36.     for (let i = 0; i < seekBarElements.length; i++) {
  37.         seekBarElements[i].style.background = colorHex;
  38.     }
  39.  
  40.     for (let i = 0; i < thumbnailElements.length; i++) {
  41.         thumbnailElements[i].style.background = colorHex;
  42.     }
  43.  
  44.     for (let i = 0; i < scrubberButtonElements.length; i++) {
  45.         scrubberButtonElements[i].style.background = colorHex;
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement