From 2502ebeb535f64c9845d2fdf451389bb83ea771b Mon Sep 17 00:00:00 2001 From: amasin76 Date: Tue, 12 Mar 2024 00:36:12 +0000 Subject: [PATCH] Add: hotkey for submit quiz --- src/pages/content/scrollToTask.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/content/scrollToTask.ts b/src/pages/content/scrollToTask.ts index af7ccea..064c3bf 100644 --- a/src/pages/content/scrollToTask.ts +++ b/src/pages/content/scrollToTask.ts @@ -26,10 +26,17 @@ function scrollToTask(): void { resourcesElement && resourcesElement.scrollIntoView(); } } + if (event.ctrlKey && event.key === "k") { - const searchButton: HTMLElement = document.querySelector("#search-button"); + const searchBtn: HTMLButtonElement = document.querySelector("#search-button"); + event.preventDefault(); + searchBtn && searchBtn.click(); + } + + if (event.key === "q") { + const quizSubmitBtn: HTMLButtonElement = document.querySelector(".quiz_questions_results button"); event.preventDefault(); - searchButton && searchButton.click(); + quizSubmitBtn && quizSubmitBtn.click(); } });