Fixed endIndex not being used while skipping and made end index finding function recursive

This commit is contained in:
Ajay Ramachandran
2020-04-06 00:45:28 -04:00
parent d1d4dcdc9c
commit 963fb58321

View File

@@ -485,7 +485,7 @@ function startSponsorSchedule(currentTime?: number): void {
// TODO: Remove this bug catching if statement when the bug is found // TODO: Remove this bug catching if statement when the bug is found
let currentVideoID = getYouTubeVideoID(document.URL); let currentVideoID = getYouTubeVideoID(document.URL);
if (currentVideoID == sponsorVideoID) { if (currentVideoID == sponsorVideoID) {
skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice); skipToTime(video, skipInfo.endIndex, skipInfo.array, skipInfo.openNotice);
// TODO: Know the autoSkip settings for ALL items being skipped // TODO: Know the autoSkip settings for ALL items being skipped
if (utils.getCategorySelection(currentSkip.category)) { if (utils.getCategorySelection(currentSkip.category)) {
@@ -911,6 +911,11 @@ function getLatestEndTimeIndex(sponsorTimes: SponsorTime[], index: number, hideH
} }
} }
// Keep going if required
if (latestEndTimeIndex !== index) {
latestEndTimeIndex = getLatestEndTimeIndex(sponsorTimes, latestEndTimeIndex, hideHiddenSponsors);
}
return latestEndTimeIndex; return latestEndTimeIndex;
} }