mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 13:07:05 +03:00
Better key moments check by not importing when no 0 second chapter
This commit is contained in:
@@ -71,8 +71,7 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
|
|||||||
|
|
||||||
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
|
||||||
if (chaptersBox && !(getControls()?.parentElement?.parentElement
|
if (chaptersBox) {
|
||||||
?.querySelector(".ytp-timed-markers-container")?.childElementCount > 0)) {
|
|
||||||
let lastSegment: SponsorTime = null;
|
let lastSegment: SponsorTime = null;
|
||||||
const links = chaptersBox.querySelectorAll("ytd-macro-markers-list-item-renderer > a");
|
const links = chaptersBox.querySelectorAll("ytd-macro-markers-list-item-renderer > a");
|
||||||
for (const link of links) {
|
for (const link of links) {
|
||||||
@@ -104,6 +103,11 @@ 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