mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Don't load segments from url multiple times
This commit is contained in:
@@ -98,6 +98,7 @@ addHotkeyListener();
|
|||||||
|
|
||||||
/** Segments created by the user which have not yet been submitted. */
|
/** Segments created by the user which have not yet been submitted. */
|
||||||
let sponsorTimesSubmitting: SponsorTime[] = [];
|
let sponsorTimesSubmitting: SponsorTime[] = [];
|
||||||
|
let loadedPreloadedSegment = false;
|
||||||
|
|
||||||
//becomes true when isInfoFound is called
|
//becomes true when isInfoFound is called
|
||||||
//this is used to close the popup on YouTube when the other popup opens
|
//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() {
|
function checkForPreloadedSegment() {
|
||||||
|
if (loadedPreloadedSegment) return;
|
||||||
|
|
||||||
|
loadedPreloadedSegment = true;
|
||||||
const hashParams = getHashParams();
|
const hashParams = getHashParams();
|
||||||
|
|
||||||
|
let pushed = false;
|
||||||
const segments = hashParams.segments;
|
const segments = hashParams.segments;
|
||||||
if (Array.isArray(segments)) {
|
if (Array.isArray(segments)) {
|
||||||
for (const segment of segments) {
|
for (const segment of segments) {
|
||||||
@@ -2037,8 +2042,14 @@ function checkForPreloadedSegment() {
|
|||||||
actionType: segment.actionType ? segment.actionType : ActionType.Skip,
|
actionType: segment.actionType ? segment.actionType : ActionType.Skip,
|
||||||
source: SponsorSourceType.Local
|
source: SponsorSourceType.Local
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pushed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pushed) {
|
||||||
|
Config.config.segmentTimes.set(sponsorVideoID, sponsorTimesSubmitting);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user