diff options
author | Ajay <[email protected]> | 2024-12-08 20:02:32 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2024-12-08 20:02:32 -0500 |
commit | 15976777ed95699df46251f792d19f07a32ecb30 (patch) | |
tree | cc14f2d0441ad301f0a80f73275d6219ce913198 /src/content.ts | |
parent | 9ad636fdadc5709d7205e81d12ae80334ed08a3a (diff) | |
download | SponsorBlock-15976777ed95699df46251f792d19f07a32ecb30.tar.gz SponsorBlock-15976777ed95699df46251f792d19f07a32ecb30.zip |
Add option to hide autogenerated chapters by YouTube
Diffstat (limited to 'src/content.ts')
-rw-r--r-- | src/content.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/content.ts b/src/content.ts index 050618f4..2639df8c 100644 --- a/src/content.ts +++ b/src/content.ts @@ -25,7 +25,7 @@ import SubmissionNotice from "./render/SubmissionNotice"; import { Message, MessageResponse, VoteResponse } from "./messageTypes"; import { SkipButtonControlBar } from "./js-components/skipButtonControlBar"; import { getStartTimeFromUrl } from "./utils/urlParser"; -import { getControls, getExistingChapters, getHashParams, isPlayingPlaylist, isVisible } from "./utils/pageUtils"; +import { getControls, getExistingChapters, getHashParams, hasAutogeneratedChapters, isPlayingPlaylist, isVisible } from "./utils/pageUtils"; import { CategoryPill } from "./render/CategoryPill"; import { AnimationUtils } from "../maze-utils/src/animationUtils"; import { GenericUtils } from "./utils/genericUtils"; @@ -1287,7 +1287,13 @@ function importExistingChapters(wait: boolean) { existingChaptersImported = true; updatePreviewBar(); } - }).catch(() => { importingChaptersWaiting = false; }); // eslint-disable-line @typescript-eslint/no-empty-function + }).catch(() => { importingChaptersWaiting = false; }); + + if (!Config.config.showAutogeneratedChapters) { + waitFor(() => hasAutogeneratedChapters(), wait ? 15000 : 0, 400).then(() => { + updateActiveSegment(getCurrentTime()); + }).catch(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function + } } } } |