diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/pageUtils.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/pageUtils.ts b/src/utils/pageUtils.ts index 69c9d7f4..4727ecc5 100644 --- a/src/utils/pageUtils.ts +++ b/src/utils/pageUtils.ts @@ -1,5 +1,6 @@ import { ActionType, Category, SponsorSourceType, SponsorTime, VideoID } from "../types"; import { getFormattedTimeToSeconds } from "../../maze-utils/src/formating"; +import Config from "../config"; export function getControls(): HTMLElement { const controlsSelectors = [ @@ -55,10 +56,15 @@ export function getHashParams(): Record<string, unknown> { return {}; } +export function hasAutogeneratedChapters(): boolean { + return !!document.querySelector("ytd-engagement-panel-section-list-renderer ytd-macro-markers-list-renderer #menu"); +} + export function getExistingChapters(currentVideoID: VideoID, duration: number): SponsorTime[] { const chaptersBox = document.querySelector("ytd-macro-markers-list-renderer"); const title = chaptersBox?.closest("ytd-engagement-panel-section-list-renderer")?.querySelector("#title-text.ytd-engagement-panel-title-header-renderer"); if (title?.textContent?.includes("Key moment")) return []; + if (!Config.config.showAutogeneratedChapters && hasAutogeneratedChapters()) return []; const chapters: SponsorTime[] = []; // .ytp-timed-markers-container indicates that key-moments are present, which should not be divided |