From 2b811c5ab40ec1bf156341171bb88846deafab01 Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 23 Feb 2022 01:12:19 -0500 Subject: [PATCH] Include unsubmitted in active segment label --- src/content.ts | 4 ++-- src/js-components/previewBar.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/content.ts b/src/content.ts index c00ff582..b59ea0e1 100644 --- a/src/content.ts +++ b/src/content.ts @@ -459,7 +459,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?: if (!video) return; if (currentTime === undefined || currentTime === null) currentTime = video.currentTime; - previewBar?.updateChapterText(sponsorTimes, currentTime); + previewBar?.updateChapterText(sponsorTimes, sponsorTimesSubmitting, currentTime); if (video.paused) return; if (videoMuted && !inMuteSegment(currentTime)) { @@ -666,7 +666,7 @@ function setupVideoListeners() { startSponsorSchedule(); } else { - previewBar?.updateChapterText(sponsorTimes, video.currentTime); + previewBar?.updateChapterText(sponsorTimes, sponsorTimesSubmitting, video.currentTime); } }); video.addEventListener('ratechange', () => startSponsorSchedule()); diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index d73eeb36..8a1699b1 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -552,9 +552,10 @@ class PreviewBar { } } - updateChapterText(segments: SponsorTime[], currentTime: number): void { + updateChapterText(segments: SponsorTime[], submittingSegments: SponsorTime[], currentTime: number): void { if (!segments) return; + if (submittingSegments?.length > 0) segments = segments.concat(submittingSegments); const activeSegments = segments.filter((segment) => { return segment.segment[0] <= currentTime && segment.segment[1] > currentTime; });