mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 15:37:12 +03:00
Fix local saved time tracking.
Also made it track when the notice is closed.
This commit is contained in:
@@ -975,30 +975,30 @@ function skipToTime(v: HTMLVideoElement, skipTime: number[], skippingSegments: S
|
|||||||
if (!Config.config.dontShowNotice || !autoSkip) {
|
if (!Config.config.dontShowNotice || !autoSkip) {
|
||||||
let skipNotice = new SkipNotice(skippingSegments, autoSkip, skipNoticeContentContainer);
|
let skipNotice = new SkipNotice(skippingSegments, autoSkip, skipNoticeContentContainer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//send telemetry that a this sponsor was skipped
|
//send telemetry that a this sponsor was skipped
|
||||||
if (Config.config.trackViewCount && autoSkip) {
|
if (Config.config.trackViewCount && autoSkip) {
|
||||||
let alreadySkipped = false;
|
let alreadySkipped = false;
|
||||||
let isPreviewSegment = false;
|
let isPreviewSegment = false;
|
||||||
|
|
||||||
for (const segment of skippingSegments) {
|
for (const segment of skippingSegments) {
|
||||||
let index = sponsorTimes.indexOf(segment);
|
let index = sponsorTimes.indexOf(segment);
|
||||||
if (index !== -1 && !sponsorSkipped[index]) {
|
if (index !== -1 && !sponsorSkipped[index]) {
|
||||||
utils.asyncRequestToServer("POST", "/api/viewedVideoSponsorTime?UUID=" + segment.UUID);
|
utils.asyncRequestToServer("POST", "/api/viewedVideoSponsorTime?UUID=" + segment.UUID);
|
||||||
|
|
||||||
sponsorSkipped[index] = true;
|
sponsorSkipped[index] = true;
|
||||||
} else if (sponsorSkipped[index]) {
|
} else if (sponsorSkipped[index]) {
|
||||||
alreadySkipped = true;
|
alreadySkipped = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (index !== -1) isPreviewSegment = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Count this as a skip
|
|
||||||
if (!alreadySkipped && !isPreviewSegment) {
|
|
||||||
Config.config.minutesSaved = Config.config.minutesSaved + (skipTime[1] - skipTime[0]) / 60;
|
|
||||||
Config.config.skipCount = Config.config.skipCount + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index === -1) isPreviewSegment = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count this as a skip
|
||||||
|
if (!alreadySkipped && !isPreviewSegment) {
|
||||||
|
Config.config.minutesSaved = Config.config.minutesSaved + (skipTime[1] - skipTime[0]) / 60;
|
||||||
|
Config.config.skipCount = Config.config.skipCount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user