aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAjay <[email protected]>2023-12-22 11:48:21 -0500
committerAjay <[email protected]>2023-12-22 11:48:21 -0500
commit8496e32cfefddda85605c02ad8e241e559c12041 (patch)
tree463802ea02c9c16591ab7bfe38ae5d6ab773bb78 /src
parent157216148c4d57a8dd19c3556f4343741b7f5534 (diff)
downloadSponsorBlock-8496e32cfefddda85605c02ad8e241e559c12041.tar.gz
SponsorBlock-8496e32cfefddda85605c02ad8e241e559c12041.zip
Add keybind for closing skip notices
Fixes #1915
Diffstat (limited to 'src')
-rw-r--r--src/components/options/KeybindDialogComponent.tsx7
-rw-r--r--src/config.ts2
-rw-r--r--src/content.ts7
3 files changed, 13 insertions, 3 deletions
diff --git a/src/components/options/KeybindDialogComponent.tsx b/src/components/options/KeybindDialogComponent.tsx
index f67c82b5..2fdd728d 100644
--- a/src/components/options/KeybindDialogComponent.tsx
+++ b/src/components/options/KeybindDialogComponent.tsx
@@ -141,10 +141,11 @@ class KeybindDialogComponent extends React.Component<KeybindDialogProps, Keybind
return {message: chrome.i18n.getMessage("youtubeKeybindWarning"), blocking: false};
}
- if (this.props.option != "skipKeybind" && this.equals(Config.config['skipKeybind']) ||
- this.props.option != "submitKeybind" && this.equals(Config.config['submitKeybind']) ||
+ if (this.props.option !== "skipKeybind" && this.equals(Config.config['skipKeybind']) ||
+ this.props.option !== "submitKeybind" && this.equals(Config.config['submitKeybind']) ||
this.props.option !== "actuallySubmitKeybind" && this.equals(Config.config['actuallySubmitKeybind']) ||
- this.props.option != "startSponsorKeybind" && this.equals(Config.config['startSponsorKeybind']))
+ this.props.option !== "closeSkipNoticeKeybind" && this.equals(Config.config['closeSkipNoticeKeybind']) ||
+ this.props.option !== "startSponsorKeybind" && this.equals(Config.config['startSponsorKeybind']))
return {message: chrome.i18n.getMessage("keyAlreadyUsed"), blocking: true};
return null;
diff --git a/src/config.ts b/src/config.ts
index 69b3382a..14387a89 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -95,6 +95,7 @@ interface SBConfig {
actuallySubmitKeybind: Keybind;
nextChapterKeybind: Keybind;
previousChapterKeybind: Keybind;
+ closeSkipNoticeKeybind: Keybind;
// What categories should be skipped
categorySelections: CategorySelection[];
@@ -345,6 +346,7 @@ const syncDefaults = {
actuallySubmitKeybind: { key: "'", ctrl: true },
nextChapterKeybind: { key: "ArrowRight", ctrl: true },
previousChapterKeybind: { key: "ArrowLeft", ctrl: true },
+ closeSkipNoticeKeybind: { key: "Backspace" },
categorySelections: [{
name: "sponsor" as Category,
diff --git a/src/content.ts b/src/content.ts
index 1c6fbb88..bda3b4b7 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -2458,6 +2458,7 @@ function hotkeyListener(e: KeyboardEvent): void {
const skipKey = Config.config.skipKeybind;
const skipToHighlightKey = Config.config.skipToHighlightKeybind;
+ const closeSkipNoticeKey = Config.config.closeSkipNoticeKeybind;
const startSponsorKey = Config.config.startSponsorKeybind;
const submitKey = Config.config.actuallySubmitKeybind;
const openSubmissionMenuKey = Config.config.submitKeybind;
@@ -2476,6 +2477,12 @@ function hotkeyListener(e: KeyboardEvent): void {
}
return;
+ } else if (keybindEquals(key, closeSkipNoticeKey)) {
+ for (let i = 0; i < skipNotices.length; i++) {
+ skipNotices.pop().close();
+ }
+
+ return;
} else if (keybindEquals(key, startSponsorKey)) {
startOrEndTimingNewSegment();
return;