mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Add comments
This commit is contained in:
parent
60d106fc52
commit
fae6d0d0cf
1 changed files with 4 additions and 0 deletions
|
@ -569,6 +569,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
|||
openNotice: skipInfo.openNotice
|
||||
});
|
||||
|
||||
// These are segments that start at the exact same time but need seperate notices
|
||||
for (const extra of skipInfo.extraIndexes) {
|
||||
const extraSkip = skipInfo.array[extra];
|
||||
if (shouldSkip(extraSkip)) {
|
||||
|
@ -1222,10 +1223,13 @@ function getNextSkipIndex(currentTime: number, includeIntersectingSegments: bool
|
|||
getStartTimes(sponsorTimes, includeIntersectingSegments, includeNonIntersectingSegments);
|
||||
const { scheduledTimes: sponsorStartTimesAfterCurrentTime } = getStartTimes(sponsorTimes, includeIntersectingSegments, includeNonIntersectingSegments, currentTime, true, true);
|
||||
|
||||
// This is an array in-case multiple segments have the exact same start time
|
||||
const minSponsorTimeIndexes = GenericUtils.indexesOf(sponsorStartTimes, Math.min(...sponsorStartTimesAfterCurrentTime));
|
||||
// Find auto skipping segments if possible, sort by duration otherwise
|
||||
const minSponsorTimeIndex = minSponsorTimeIndexes.sort(
|
||||
(a, b) => ((autoSkipSorter(submittedArray[a]) - autoSkipSorter(submittedArray[b]))
|
||||
|| (submittedArray[a].segment[1] - submittedArray[a].segment[0]) - (submittedArray[b].segment[1] - submittedArray[b].segment[0])))[0] ?? -1;
|
||||
// Store extra indexes for the non-auto skipping segments if others occur at the exact same start time
|
||||
const extraIndexes = minSponsorTimeIndexes.filter((i) => i === minSponsorTimeIndex || autoSkipSorter(submittedArray[i]) !== 0);
|
||||
|
||||
const endTimeIndex = getLatestEndTimeIndex(submittedArray, minSponsorTimeIndex);
|
||||
|
|
Loading…
Reference in a new issue