aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/render/SkipNotice.tsx
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-01-17 14:25:45 -0500
committerAjay Ramachandran <[email protected]>2021-01-17 14:25:45 -0500
commite269b1aec605ae5afb55572cb9a0177529862209 (patch)
treee96855685ea6c0b433d7045e0ce2d1d49fa71f4f /src/render/SkipNotice.tsx
parentff0dc6e5706ffae19502b192061189c6e0c2199f (diff)
downloadSponsorBlock-e269b1aec605ae5afb55572cb9a0177529862209.tar.gz
SponsorBlock-e269b1aec605ae5afb55572cb9a0177529862209.zip
Add skip keybind
https://github.com/ajayyy/SponsorBlock/issues/299
Diffstat (limited to 'src/render/SkipNotice.tsx')
-rw-r--r--src/render/SkipNotice.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/render/SkipNotice.tsx b/src/render/SkipNotice.tsx
index ac66cae4..526d2d1c 100644
--- a/src/render/SkipNotice.tsx
+++ b/src/render/SkipNotice.tsx
@@ -1,7 +1,7 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
-import SkipNoticeComponent from "../components/SkipNoticeComponent";
+import SkipNoticeComponent, { SkipNoticeAction } from "../components/SkipNoticeComponent";
import { SponsorTime, ContentContainer } from "../types";
class SkipNotice {
@@ -15,6 +15,8 @@ class SkipNotice {
skipNoticeRef: React.MutableRefObject<SkipNoticeComponent>;
constructor(segments: SponsorTime[], autoSkip = false, contentContainer: ContentContainer) {
+ this.skipNoticeRef = React.createRef();
+
this.segments = segments;
this.autoSkip = autoSkip;
this.contentContainer = contentContainer;
@@ -67,6 +69,13 @@ class SkipNotice {
ReactDOM.unmountComponentAtNode(this.noticeElement);
this.noticeElement.remove();
+
+ const skipNotices = this.contentContainer().skipNotices;
+ skipNotices.splice(skipNotices.indexOf(this), 1);
+ }
+
+ toggleSkip(): void {
+ this.skipNoticeRef.current.prepAction(SkipNoticeAction.Unskip);
}
}