Add seperate keybind for skip to highlight

Fixes #1187
This commit is contained in:
Ajay 2023-09-23 15:40:11 -04:00
parent 1557af5d2a
commit ee3ce8aa46
6 changed files with 24 additions and 6 deletions

@ -1 +1 @@
Subproject commit 2eb140ad3200e58aa6b2a8e73bc8ca951a4cefb4
Subproject commit a984d114839441953d5d4ecf5005cac9f19caaa7

@ -1 +1 @@
Subproject commit d1edc0e7e3533fd47a2c4d7aae79770c3a0b82fc
Subproject commit f85b7b926e33a41a47c91a5ae1d5e1415fc1ef6c

View file

@ -414,6 +414,11 @@
<div class="inline"></div>
</div>
<div data-type="keybind-change" data-sync="skipToHighlightKeybind">
<label class="optionLabel">__MSG_setSkipToHighlightShortcut__:</label>
<div class="inline"></div>
</div>
<div data-type="keybind-change" data-sync="startSponsorKeybind">
<label class="optionLabel">__MSG_setStartSponsorShortcut__:</label>
<div class="inline"></div>

View file

@ -86,6 +86,7 @@ interface SBConfig {
};
skipKeybind: Keybind;
skipToHighlightKeybind: Keybind;
startSponsorKeybind: Keybind;
submitKeybind: Keybind;
nextChapterKeybind: Keybind;
@ -328,6 +329,7 @@ const syncDefaults = {
* TODO: Find a way to skip having to update these checks. Maybe storing keybinds in a Map?
*/
skipKeybind: { key: "Enter" },
skipToHighlightKeybind: { key: "Enter", ctrl: true },
startSponsorKeybind: { key: ";" },
submitKeybind: { key: "'" },
nextChapterKeybind: { key: "ArrowRight", ctrl: true },

View file

@ -2432,14 +2432,23 @@ function hotkeyListener(e: KeyboardEvent): void {
};
const skipKey = Config.config.skipKeybind;
const skipToHighlightKey = Config.config.skipToHighlightKeybind;
const startSponsorKey = Config.config.startSponsorKeybind;
const submitKey = Config.config.submitKeybind;
const nextChapterKey = Config.config.nextChapterKeybind;
const previousChapterKey = Config.config.previousChapterKeybind;
if (keybindEquals(key, skipKey)) {
if (activeSkipKeybindElement)
if (activeSkipKeybindElement) {
activeSkipKeybindElement.toggleSkip.call(activeSkipKeybindElement);
}
return;
} else if (keybindEquals(key, skipToHighlightKey)) {
if (skipButtonControlBar) {
skipButtonControlBar.toggleSkip.call(skipButtonControlBar);
}
return;
} else if (keybindEquals(key, startSponsorKey)) {
startOrEndTimingNewSegment();

View file

@ -147,8 +147,10 @@ export class SkipButtonControlBar {
}
toggleSkip(): void {
this.skip(this.segment);
this.disableText();
if (this.segment && this.enabled) {
this.skip(this.segment);
this.disableText();
}
}
disableText(): void {
@ -182,7 +184,7 @@ export class SkipButtonControlBar {
}
private getTitle(): string {
return getSkippingText([this.segment], false) + (this.showKeybindHint ? " (" + keybindToString(Config.config.skipKeybind) + ")" : "");
return getSkippingText([this.segment], false) + (this.showKeybindHint ? " (" + keybindToString(Config.config.skipToHighlightKeybind) + ")" : "");
}
private getChapterPrefix(): HTMLElement {