Advertisement
alien_fx_fiend

YouTube Notch + BG Skinned (/w Enhanced Glow Effect) *FINALVER*

Jan 2nd, 2025
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Start JS 23px notch, buffer/ played colors, 10px height */
  2. // First, inject the CSS
  3. const style = document.createElement('style');
  4. style.textContent = `
  5. .custom-youtube-notch {
  6.     position: absolute;
  7.     width: 23px;
  8.     height: 23px;
  9.     background-color: black;
  10.     border: 2px solid white;
  11.     border-radius: 50%;
  12.     z-index: 999999;
  13.     pointer-events: none;
  14.     /* box-shadow: 0 0 8px indigo; */ /* Add outer glow */
  15.     -moz-box-shadow:0 0 15px #c00!important;
  16.     -webkit-box-shadow:0 0 15px #c00!important;
  17.     box-shadow:0 0 15px #ffffff!important;
  18.     transform: translateX(-50%) translateY(-50%);
  19. }
  20.  
  21. /* Make buffered progress hot pink */
  22. .html5-load-progress, .ytp-load-progress {
  23.     background-color: black !important;
  24. }
  25.  
  26. /* Make played progress rainbow gradient */
  27. .html5-play-progress, .ytp-play-progress {
  28.     background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); /* Rainbow gradient */
  29.     background-color: transparent !important; /* Override any solid background-color */
  30. }
  31.  
  32. /* Style the chapter mark separators using ::before */
  33. .ytp-chapters-container::before,
  34. .ytp-chapter-hover-container::before {
  35.     content: ''; /* Required for pseudo-elements */
  36.     position: absolute;
  37.     top: 0;
  38.     bottom: 0;
  39.     left: 0; /* Position the separator at the left edge */
  40.     width: 4px; /* Adjust the width of the separator */
  41.     background-color: green; /* Adjust the color of the separator */
  42.     z-index: 1; /* Ensure it's above the background */
  43. }
  44.  
  45. /* Remove the border-left from the containers */
  46. .ytp-chapters-container, .ytp-chapter-hover-container {
  47.     z-index: 9999999 !important;
  48.     position: relative;
  49.     left: 0;
  50.     height: 100%;
  51.     /* REMOVE THIS LINE: border-left: 2px solid black !important; */
  52. }
  53.  
  54. /* .ytp-chapters-container, .ytp-chapter-hover-container, .ytp-chapters, .ytp-chapter {
  55. z-index: 9999999 !important;
  56. position: relative !important;
  57. left: 0 !important;
  58. height: 100% !important;
  59. border-left: 4px solid black !important;
  60. opacity: 1.0 !important;
  61. } */
  62.  
  63. /* Make unplayed progress yellow */
  64. .ytp-progress-bar-container {
  65.     background-color: yellow !important;
  66.     opacity: 1.0 !important;
  67.     /*opacity: 1.0 0.6 !important;*/
  68. }
  69.  
  70. /* Make sure the hover preview also matches indigo */
  71. .html5-hover-progress, .ytp-hover-progress {
  72.     background-color: indigo !important;
  73. }
  74.  
  75. /* Ensure proper layering */
  76. .html5-progress-list, .ytp-progress-list {
  77.     z-index: 99998 !important;
  78. }
  79.  
  80. /* Make progress bar thicker */
  81. .html5-progress-bar-container, .ytp-progress-bar-container {
  82.     height: 12px !important;
  83. }
  84.  
  85. .html5-progress-bar, .ytp-progress-bar {
  86.     height: 12px !important;
  87. }
  88.  
  89. .html5-progress-list, .ytp-progress-list {
  90.     height: 12px !important;
  91. }
  92.  
  93. .ytp-progress-bar .ytp-play-progress,
  94. .ytp-progress-bar .ytp-load-progress,
  95. .ytp-progress-bar .ytp-hover-progress {
  96.     height: 12px !important;
  97. }
  98.  
  99. /* Update these styles in your JavaScript */
  100. /* Make played progress rainbow gradient */
  101. .ytp-progress-bar .ytp-play-progress,
  102. .ytp-progress-bar-container .ytp-play-progress,
  103. .ytp-progress-bar .ytp-play-progress.ytp-swatch-background-color {
  104.     background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet) !important; /* Rainbow gradient */
  105.     background-color: transparent !important; /* Override any solid background-color */
  106. }
  107.  
  108. /* Adjust the scrubber container for the thicker bar */
  109. .html5-scrubber-container, .ytp-scrubber-container {
  110.     height: 12px !important;
  111. }
  112.  
  113. /* When hovering, make it even thicker */
  114. .ytp-progress-bar-container:hover {
  115.     height: 15px !important;
  116. }
  117.  
  118. .ytp-progress-bar-container:hover .ytp-progress-bar,
  119. .ytp-progress-bar-container:hover .ytp-progress-list,
  120. .ytp-progress-bar-container:hover .ytp-play-progress,
  121. .ytp-progress-bar-container:hover .ytp-load-progress,
  122. .ytp-progress-bar-container:hover .ytp-hover-progress {
  123.     height: 15px !important;
  124. }
  125. `;
  126. document.head.appendChild(style);
  127.  
  128. function enforceProgressBarColor() {
  129.     const playProgress = document.querySelector('.ytp-play-progress');
  130.     if (playProgress) {
  131.         playProgress.style.setProperty('background', 'linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet)', 'important');
  132.         playProgress.style.setProperty('background-color', 'transparent', 'important');
  133.     }
  134.     /*if (progressBar) {
  135.          progressBar.style.setProperty('background', 'yellow', 'important');
  136.         progressBar.style.setProperty('background-color', 'yellow', 'important');
  137.  
  138. progressBar.style.setProperty('opacity', '1.0', 'important');
  139.     }*/
  140. }
  141.  
  142. // Function to create or update the notch
  143. function updateNotch() {
  144.     let progressBar = document.querySelector('.ytp-progress-bar');
  145.     let player = document.querySelector('.html5-main-video');
  146.     let progressBarContainer = document.querySelector('.ytp-progress-bar-container');
  147.  
  148.     if (!progressBar || !player || !progressBarContainer) return;
  149.  
  150.     // Create notch if it doesn't exist
  151.     let notch = document.querySelector('.custom-youtube-notch');
  152.     if (!notch) {
  153.         notch = document.createElement('div');
  154.         notch.className = 'custom-youtube-notch';
  155.         progressBarContainer.appendChild(notch);
  156.     }
  157.  
  158.     // Calculate position
  159.     let progress = (player.currentTime / player.duration) * 100;
  160.     let progressBarRect = progressBar.getBoundingClientRect();
  161.     let position = (progressBarRect.width * progress) / 100;
  162.  
  163.     // Update notch position
  164.     notch.style.left = `${position}px`;
  165.     notch.style.top = '50%';
  166.     notch.style.display = 'block';
  167. }
  168.  
  169. // Function to start the interval
  170. function startNotchUpdate() {
  171.     // Initial update
  172.     updateNotch();
  173.     //enforceProgressBarColor();
  174.  
  175.     // Set interval for updates
  176.     return setInterval(updateNotch, 1000);
  177. }
  178.  
  179. // Function to initialize and handle page changes
  180. function initialize() {
  181.     let interval;
  182.  
  183.     // Observer for detecting player load
  184.     const observer = new MutationObserver((mutations) => {
  185.         if (document.querySelector('.html5-main-video')) {
  186.             if (!interval) {
  187.                 interval = startNotchUpdate();
  188.             }
  189.         }
  190.     });
  191.  
  192.     // Start observing
  193.     observer.observe(document.body, {
  194.         childList: true,
  195.         subtree: true
  196.     });
  197.  
  198.     // Handle navigation (for YouTube's SPA nature)
  199.     let lastUrl = location.href;
  200.     new MutationObserver(() => {
  201.         const url = location.href;
  202.         if (url !== lastUrl) {
  203.             lastUrl = url;
  204.             clearInterval(interval);
  205.             interval = startNotchUpdate();
  206.         }
  207.     }).observe(document.body, {subtree: true, childList: true});
  208. }
  209.  
  210. // Start the script
  211. initialize();
  212. /* End JS 23px notch, buffer/ played colors, 10px height */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement