mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Count skips for chapters when viewed
This commit is contained in:
parent
8cc3843ada
commit
03cd1b535b
2 changed files with 11 additions and 3 deletions
|
@ -1577,7 +1577,9 @@ function sendTelemetryAndCount(skippingSegments: SponsorTime[], secondsSkipped:
|
||||||
sponsorSkipped[index] = true;
|
sponsorSkipped[index] = true;
|
||||||
if (!counted) {
|
if (!counted) {
|
||||||
Config.config.minutesSaved = Config.config.minutesSaved + secondsSkipped / 60;
|
Config.config.minutesSaved = Config.config.minutesSaved + secondsSkipped / 60;
|
||||||
Config.config.skipCount = Config.config.skipCount + 1;
|
if (segment.actionType !== ActionType.Chapter) {
|
||||||
|
Config.config.skipCount = Config.config.skipCount + 1;
|
||||||
|
}
|
||||||
counted = true;
|
counted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2286,11 +2288,16 @@ function windowListenerHandler(event: MessageEvent): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateActiveSegment(currentTime: number): void {
|
function updateActiveSegment(currentTime: number): void {
|
||||||
previewBar?.updateChapterText(sponsorTimes, sponsorTimesSubmitting, currentTime);
|
const activeSegments = previewBar?.updateChapterText(sponsorTimes, sponsorTimesSubmitting, currentTime);
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
message: "time",
|
message: "time",
|
||||||
time: currentTime
|
time: currentTime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const chapterSegments = activeSegments?.filter((segment) => segment.actionType === ActionType.Chapter);
|
||||||
|
if (chapterSegments?.length > 0) {
|
||||||
|
sendTelemetryAndCount(chapterSegments, 0, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextChapter(): void {
|
function nextChapter(): void {
|
||||||
|
|
|
@ -719,7 +719,7 @@ class PreviewBar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChapterText(segments: SponsorTime[], submittingSegments: SponsorTime[], currentTime: number): void {
|
updateChapterText(segments: SponsorTime[], submittingSegments: SponsorTime[], currentTime: number): SponsorTime[] {
|
||||||
if (!Config.config.showSegmentNameInChapterBar
|
if (!Config.config.showSegmentNameInChapterBar
|
||||||
|| ((!segments || segments.length <= 0) && submittingSegments?.length <= 0)) {
|
|| ((!segments || segments.length <= 0) && submittingSegments?.length <= 0)) {
|
||||||
const chaptersContainer = this.getChaptersContainer();
|
const chaptersContainer = this.getChaptersContainer();
|
||||||
|
@ -740,6 +740,7 @@ class PreviewBar {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setActiveSegments(activeSegments);
|
this.setActiveSegments(activeSegments);
|
||||||
|
return activeSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue