diff options
author | Ajay <[email protected]> | 2022-04-23 00:10:46 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2022-04-23 00:10:46 -0400 |
commit | 0c216792cf1737e13e358411902f4b77dce1725e (patch) | |
tree | 9a067a70e208a005acf8bda818e3c7ffc4550b9c | |
parent | dd447297f9567170e87fe68a8886391e5e0b7546 (diff) | |
download | SponsorBlock-0c216792cf1737e13e358411902f4b77dce1725e.tar.gz SponsorBlock-0c216792cf1737e13e358411902f4b77dce1725e.zip |
Don't show duplicate skip notices
-rw-r--r-- | src/content.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/content.ts b/src/content.ts index d047cb1a..655259ef 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1377,6 +1377,14 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u } function createSkipNotice(skippingSegments: SponsorTime[], autoSkip: boolean, unskipTime: number, startReskip: boolean) { + for (const skipNotice of skipNotices) { + if (skippingSegments.length === skipNotice.segments.length + && skippingSegments.every((segment) => skipNotice.segments.some((s) => s.UUID === segment.UUID))) { + // Skip notice already exists + return; + } + } + const newSkipNotice = new SkipNotice(skippingSegments, autoSkip, skipNoticeContentContainer, unskipTime, startReskip); if (onMobileYouTube || Config.config.skipKeybind == null) newSkipNotice.setShowKeybindHint(false); skipNotices.push(newSkipNotice); |