aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-08-17 19:37:52 -0400
committerAjay Ramachandran <[email protected]>2021-08-17 19:37:52 -0400
commita13f5d23593012649d24e0565579dc2b60994c86 (patch)
treeac6ac7aa1549b61802e1d02add7e030ae1c0d6e9
parent42beaf698c0e99ba0e8e3522e2ee46238eb5fe56 (diff)
downloadSponsorBlock-a13f5d23593012649d24e0565579dc2b60994c86.tar.gz
SponsorBlock-a13f5d23593012649d24e0565579dc2b60994c86.zip
Show skip notice when clicking poi segment in seek bar
-rw-r--r--src/content.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/content.ts b/src/content.ts
index 3039e730..5e00679c 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -561,6 +561,16 @@ function setupVideoListeners() {
startSponsorSchedule();
}
+
+ if (!Config.config.dontShowNotice) {
+ const currentPoiSegment = sponsorTimes.find((segment) =>
+ utils.getCategoryActionType(segment.category) === CategoryActionType.POI &&
+ video.currentTime - segment.segment[0] > 0 &&
+ video.currentTime - segment.segment[0] < video.duration * 0.006); // Approximate size on preview bar
+ if (currentPoiSegment) {
+ skipToTime(video, currentPoiSegment.segment, [currentPoiSegment], true, true);
+ }
+ }
});
video.addEventListener('ratechange', () => startSponsorSchedule());
// Used by videospeed extension (https://github.com/igrigorik/videospeed/pull/740)
@@ -1039,9 +1049,9 @@ function sendTelemetryAndCount(skippingSegments: SponsorTime[], secondsSkipped:
}
//skip from the start time to the end time for a certain index sponsor time
-function skipToTime(v: HTMLVideoElement, skipTime: number[], skippingSegments: SponsorTime[], openNotice: boolean) {
+function skipToTime(v: HTMLVideoElement, skipTime: number[], skippingSegments: SponsorTime[], openNotice: boolean, forceAutoSkip = false) {
// There will only be one submission if it is manual skip
- const autoSkip: boolean = shouldAutoSkip(skippingSegments[0]);
+ const autoSkip: boolean = forceAutoSkip || shouldAutoSkip(skippingSegments[0]);
if ((autoSkip || sponsorTimesSubmitting.includes(skippingSegments[0])) && v.currentTime !== skipTime[1]) {
// Fix for looped videos not working when skipping to the end #426