Skip to content

Commit

Permalink
stop progress bar injection if already exists
Browse files Browse the repository at this point in the history
some accounts that already have YouTube's own progress bar will cause error when trying to inject our own progress bar
  • Loading branch information
ynshung committed Apr 7, 2024
1 parent d2b6cbd commit f32e2e6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/ProgressBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export function modifyProgressBar(enabled: boolean) {

//[id="0"] > div.overlay.style-scope.ytd-reel-video-renderer > ytd-reel-player-overlay-renderer > #overlay
const progressBar = getProgressBarList() as HTMLElement; // ? the progressbar itself

// Some accounts already have YouTube's progress bar, no need to add our own
if (!progressBar) return;
const pbBackground = progressBar.children[0] as HTMLElement; // ? the grey background of the bar
const pbForeground = progressBar.children[1] as HTMLElement; // ? The red part of the progress bar

Expand Down

0 comments on commit f32e2e6

Please sign in to comment.