diff --git a/src/content.ts b/src/content.ts index 9952a9dd..0fc8e462 100644 --- a/src/content.ts +++ b/src/content.ts @@ -98,6 +98,7 @@ addHotkeyListener(); /** Segments created by the user which have not yet been submitted. */ let sponsorTimesSubmitting: SponsorTime[] = []; +let loadedPreloadedSegment = false; //becomes true when isInfoFound is called //this is used to close the popup on YouTube when the other popup opens @@ -2023,8 +2024,12 @@ function showTimeWithoutSkips(skippedDuration: number): void { } function checkForPreloadedSegment() { + if (loadedPreloadedSegment) return; + + loadedPreloadedSegment = true; const hashParams = getHashParams(); + let pushed = false; const segments = hashParams.segments; if (Array.isArray(segments)) { for (const segment of segments) { @@ -2037,8 +2042,14 @@ function checkForPreloadedSegment() { actionType: segment.actionType ? segment.actionType : ActionType.Skip, source: SponsorSourceType.Local }); + + pushed = true; } } } } + + if (pushed) { + Config.config.segmentTimes.set(sponsorVideoID, sponsorTimesSubmitting); + } } \ No newline at end of file