Added keybinds to vote on the last segment

Added keybinds to vote on the last segment

fixed Upvote/Downvote keybind message variable names to match others in that options section
This commit is contained in:
gosha305
2025-02-10 01:28:22 +01:00
parent 19efcb5a98
commit c9c02e91ff
4 changed files with 27 additions and 1 deletions

View File

@@ -2575,6 +2575,8 @@ function hotkeyListener(e: KeyboardEvent): void {
const openSubmissionMenuKey = Config.config.submitKeybind;
const nextChapterKey = Config.config.nextChapterKeybind;
const previousChapterKey = Config.config.previousChapterKeybind;
const upvoteKey = Config.config.upvoteKeybind;
const downvoteKey = Config.config.downvoteKeybind;
if (keybindEquals(key, skipKey)) {
if (activeSkipKeybindElement) {
@@ -2618,6 +2620,14 @@ function hotkeyListener(e: KeyboardEvent): void {
if (sponsorTimes.length > 0) e.stopPropagation();
previousChapter();
return;
} else if (keybindEquals(key, upvoteKey)) {
const lastSegment = [...sponsorTimes].reverse()?.find((s) => s.segment[0]<=getCurrentTime());
if (lastSegment) vote(1,lastSegment.UUID, undefined, skipNotices?.find((skipNotice) => skipNotice.segments.some((segment) => segment.UUID === lastSegment.UUID))?.skipNoticeRef.current);
return;
} else if (keybindEquals(key, downvoteKey)) {
const lastSegment = [...sponsorTimes].reverse()?.find((s) => s.segment[0]<=getCurrentTime());
if (lastSegment) vote(0,lastSegment.UUID, undefined, skipNotices?.find((skipNotice) => skipNotice.segments.some((segment) => segment.UUID === lastSegment.UUID))?.skipNoticeRef.current);
return;
}
}