mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 01:01:55 +01:00
Fix skips not being counted and crash on old browser
This commit is contained in:
parent
0d0171530c
commit
1f967b3f69
1 changed files with 3 additions and 3 deletions
|
@ -1059,7 +1059,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
|||
const includedTimes: ScheduledTime[] = [];
|
||||
const startTimeIndexes: number[] = [];
|
||||
|
||||
const possibleTimes = sponsorTimes.flatMap((sponsorTime) => {
|
||||
const possibleTimes = sponsorTimes.map((sponsorTime) => {
|
||||
const results = [{
|
||||
...sponsorTime,
|
||||
scheduledTime: sponsorTime.segment[0]
|
||||
|
@ -1074,7 +1074,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
|||
}
|
||||
|
||||
return results;
|
||||
})
|
||||
}).reduce((a, b) => a.concat(b), []);
|
||||
|
||||
for (let i = 0; i < possibleTimes.length; i++) {
|
||||
if ((minimum === undefined
|
||||
|
@ -1112,7 +1112,7 @@ function sendTelemetryAndCount(skippingSegments: SponsorTime[], secondsSkipped:
|
|||
|
||||
let counted = false;
|
||||
for (const segment of skippingSegments) {
|
||||
const index = sponsorTimes.indexOf(segment);
|
||||
const index = sponsorTimes.findIndex((s) => s.segment === segment.segment);
|
||||
if (index !== -1 && !sponsorSkipped[index]) {
|
||||
sponsorSkipped[index] = true;
|
||||
if (!counted) {
|
||||
|
|
Loading…
Reference in a new issue