From 54038ea427d1682c5d4b115ceae27a37b901109d Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 29 Jun 2020 21:16:01 +0100 Subject: [PATCH] quick tab mode can now jump to the test page --- public/index.html | 2 +- public/js/script.js | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/public/index.html b/public/index.html index a96945d23..622a74572 100644 --- a/public/index.html +++ b/public/index.html @@ -292,7 +292,7 @@

quick tab mode

-
Press tab to quickly restart the test. This function disables tab navigation on some parts of the website.
+
Press tab to quickly restart the test, or to quickly jump to the test page. This function disables tab navigation on the website.
on
off
diff --git a/public/js/script.js b/public/js/script.js index 132709416..036236528 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1832,15 +1832,19 @@ $(document).keydown((event) => { //tab if (event["keyCode"] == 9) { - if (config.quickTab && $(".pageTest").hasClass("active")) { + if (config.quickTab) { event.preventDefault(); - if (testActive && !afkDetected) { - let testNow = Date.now(); - let testSeconds = roundTo2((testNow - testStart) / 1000); - incompleteTestSeconds += testSeconds; - restartCount++; + if($(".pageTest").hasClass("active")){ + if (testActive && !afkDetected) { + let testNow = Date.now(); + let testSeconds = roundTo2((testNow - testStart) / 1000); + incompleteTestSeconds += testSeconds; + restartCount++; + } + restartTest(); + }else{ + changePage('test'); } - restartTest(); } }