mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 15:37:12 +03:00
Load existing chapters
This commit is contained in:
@@ -15,7 +15,7 @@ import { Message, MessageResponse, VoteResponse } from "./messageTypes";
|
||||
import * as Chat from "./js-components/chat";
|
||||
import { SkipButtonControlBar } from "./js-components/skipButtonControlBar";
|
||||
import { getStartTimeFromUrl } from "./utils/urlParser";
|
||||
import { findValidElement, getControls, getHashParams, isVisible } from "./utils/pageUtils";
|
||||
import { findValidElement, getControls, getExistingChapters, getHashParams, isVisible } from "./utils/pageUtils";
|
||||
import { isSafari, keybindEquals } from "./utils/configUtils";
|
||||
import { CategoryPill } from "./render/CategoryPill";
|
||||
import { AnimationUtils } from "./utils/animationUtils";
|
||||
@@ -806,6 +806,17 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
|
||||
//otherwise the listener can handle it
|
||||
updatePreviewBar();
|
||||
}
|
||||
|
||||
// Add existing chapters if we can
|
||||
if (utils.chaptersEnabled()) {
|
||||
GenericUtils.wait(() => getExistingChapters(sponsorVideoID, video.duration),
|
||||
5000, 100, (c) => c?.length > 0).then((chapters) => {
|
||||
if (chapters?.length > 0) {
|
||||
sponsorTimes = sponsorTimes.concat(...chapters);
|
||||
updatePreviewBar();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (response?.status === 404) {
|
||||
retryFetch();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user