mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 22:17:21 +03:00
Fix skips not being counted and crash on old browser
This commit is contained in:
@@ -1059,7 +1059,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
|||||||
const includedTimes: ScheduledTime[] = [];
|
const includedTimes: ScheduledTime[] = [];
|
||||||
const startTimeIndexes: number[] = [];
|
const startTimeIndexes: number[] = [];
|
||||||
|
|
||||||
const possibleTimes = sponsorTimes.flatMap((sponsorTime) => {
|
const possibleTimes = sponsorTimes.map((sponsorTime) => {
|
||||||
const results = [{
|
const results = [{
|
||||||
...sponsorTime,
|
...sponsorTime,
|
||||||
scheduledTime: sponsorTime.segment[0]
|
scheduledTime: sponsorTime.segment[0]
|
||||||
@@ -1074,7 +1074,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
})
|
}).reduce((a, b) => a.concat(b), []);
|
||||||
|
|
||||||
for (let i = 0; i < possibleTimes.length; i++) {
|
for (let i = 0; i < possibleTimes.length; i++) {
|
||||||
if ((minimum === undefined
|
if ((minimum === undefined
|
||||||
@@ -1112,7 +1112,7 @@ function sendTelemetryAndCount(skippingSegments: SponsorTime[], secondsSkipped:
|
|||||||
|
|
||||||
let counted = false;
|
let counted = false;
|
||||||
for (const segment of skippingSegments) {
|
for (const segment of skippingSegments) {
|
||||||
const index = sponsorTimes.indexOf(segment);
|
const index = sponsorTimes.findIndex((s) => s.segment === segment.segment);
|
||||||
if (index !== -1 && !sponsorSkipped[index]) {
|
if (index !== -1 && !sponsorSkipped[index]) {
|
||||||
sponsorSkipped[index] = true;
|
sponsorSkipped[index] = true;
|
||||||
if (!counted) {
|
if (!counted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user