mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Generated chapters can now start after 0 seconds, so allow importing them
This commit is contained in:
@@ -68,6 +68,8 @@ export function getHashParams(): Record<string, unknown> {
|
|||||||
|
|
||||||
export function getExistingChapters(currentVideoID: VideoID, duration: number): SponsorTime[] {
|
export function getExistingChapters(currentVideoID: VideoID, duration: number): SponsorTime[] {
|
||||||
const chaptersBox = document.querySelector("ytd-macro-markers-list-renderer");
|
const chaptersBox = document.querySelector("ytd-macro-markers-list-renderer");
|
||||||
|
const title = document.querySelector("[target-id=engagement-panel-macro-markers-auto-chapters] #title-text");
|
||||||
|
if (title?.textContent?.includes("Key moment")) return [];
|
||||||
|
|
||||||
const chapters: SponsorTime[] = [];
|
const chapters: SponsorTime[] = [];
|
||||||
// .ytp-timed-markers-container indicates that key-moments are present, which should not be divided
|
// .ytp-timed-markers-container indicates that key-moments are present, which should not be divided
|
||||||
@@ -103,11 +105,6 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chapters[0] && chapters[0].segment[0] !== 0) {
|
|
||||||
// This is key moments instead of chapters, don't import as they are not full sections
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return chapters;
|
return chapters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user