mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 15:07:02 +03:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user