diff --git a/public/_locales b/public/_locales index 7f2d4e63..baf39106 160000 --- a/public/_locales +++ b/public/_locales @@ -1 +1 @@ -Subproject commit 7f2d4e63dc53facfeed96aae1086c2bc3329b519 +Subproject commit baf39106e0471e89dd85c17871017dc38b991343 diff --git a/public/options/options.html b/public/options/options.html index 01a3b345..146b7956 100644 --- a/public/options/options.html +++ b/public/options/options.html @@ -448,6 +448,11 @@
+
+ +
+
+
diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index 81f43753..c6369e2e 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -8,6 +8,7 @@ import SelectorComponent, { SelectorOption } from "./SelectorComponent"; import { DEFAULT_CATEGORY } from "../utils/categoryUtils"; import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/src/formating"; import { asyncRequestToServer } from "../utils/requests"; +import { defaultPreviewTime } from "../utils/constants"; export interface SponsorTimeEditProps { index: number; @@ -671,7 +672,7 @@ class SponsorTimeEditComponent extends React.Component this.lastSegmentCount) { this.lastSegmentCount = currentSegmentCount; - const scrollElement = this.noticeRef.current.getElement().current.querySelector("#sponsorSkipNoticeMiddleRowSubmissionNotice"); - scrollElement.scrollTo({ - top: scrollElement.scrollHeight + 1000 - }); + this.scrollToBottom(); } } + scrollToBottom() { + const scrollElement = this.noticeRef.current.getElement().current.querySelector("#sponsorSkipNoticeMiddleRowSubmissionNotice"); + scrollElement.scrollTo({ + top: scrollElement.scrollHeight + 1000 + }); + } + render(): React.ReactElement { const sortButton = 0) { submissionNotice = new SubmissionNotice(skipNoticeContentContainer, sendSubmitMessage); } +} +function previewRecentSegment() { + if (sponsorTimesSubmitting !== undefined && sponsorTimesSubmitting.length > 0) { + previewTime(sponsorTimesSubmitting[sponsorTimesSubmitting.length - 1].segment[0] - defaultPreviewTime); + + if (submissionNotice) { + submissionNotice.scrollToBottom(); + } + } } function submitSegments() { @@ -2444,6 +2454,7 @@ function hotkeyListener(e: KeyboardEvent): void { const closeSkipNoticeKey = Config.config.closeSkipNoticeKeybind; const startSponsorKey = Config.config.startSponsorKeybind; const submitKey = Config.config.actuallySubmitKeybind; + const previewKey = Config.config.previewKeybind; const openSubmissionMenuKey = Config.config.submitKeybind; const nextChapterKey = Config.config.nextChapterKeybind; const previousChapterKey = Config.config.previousChapterKeybind; @@ -2475,6 +2486,9 @@ function hotkeyListener(e: KeyboardEvent): void { } else if (keybindEquals(key, openSubmissionMenuKey)) { openSubmissionMenu(); return; + } else if (keybindEquals(key, previewKey)) { + previewRecentSegment(); + return; } else if (keybindEquals(key, nextChapterKey)) { if (sponsorTimes.length > 0) e.stopPropagation(); nextChapter(); diff --git a/src/render/SubmissionNotice.tsx b/src/render/SubmissionNotice.tsx index 671dde6b..5e9fbfbd 100644 --- a/src/render/SubmissionNotice.tsx +++ b/src/render/SubmissionNotice.tsx @@ -56,6 +56,10 @@ class SubmissionNotice { submit(): void { this.noticeRef.current?.submit?.(); } + + scrollToBottom(): void { + this.noticeRef.current?.scrollToBottom?.(); + } } export default SubmissionNotice; \ No newline at end of file diff --git a/src/utils/constants.ts b/src/utils/constants.ts index dd44676a..afceb710 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -157,4 +157,6 @@ export function getGuidelineInfo(category: Category): TextBox[] { text: chrome.i18n.getMessage(`generic_guideline2`) }]; } -} \ No newline at end of file +} + +export const defaultPreviewTime = 2; \ No newline at end of file