mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 13:44:29 +08:00
disabled keyboard restart on long tests
This commit is contained in:
parent
6330c7669b
commit
9af91950e4
1 changed files with 38 additions and 12 deletions
|
|
@ -2976,13 +2976,26 @@ $(window).on("popstate", (e) => {
|
|||
|
||||
$(document).on("keypress", "#restartTestButton", (event) => {
|
||||
if (event.keyCode == 13) {
|
||||
if (testActive && !afkDetected) {
|
||||
let testNow = Date.now();
|
||||
let testSeconds = roundTo2((testNow - testStart) / 1000);
|
||||
incompleteTestSeconds += testSeconds;
|
||||
restartCount++;
|
||||
if (
|
||||
(config.mode === "words" && config.words < 1000) ||
|
||||
(config.mode === "time" && config.time < 3600) ||
|
||||
(config.mode === "custom" &&
|
||||
customTextIsRandom &&
|
||||
customTextWordCount < 1000) ||
|
||||
(config.mode === "custom" &&
|
||||
!customTextIsRandom &&
|
||||
customText.length < 1000)
|
||||
) {
|
||||
if (testActive && !afkDetected) {
|
||||
let testNow = Date.now();
|
||||
let testSeconds = roundTo2((testNow - testStart) / 1000);
|
||||
incompleteTestSeconds += testSeconds;
|
||||
restartCount++;
|
||||
}
|
||||
restartTest();
|
||||
} else {
|
||||
showNotification("Quick restart disabled for long tests", 3000);
|
||||
}
|
||||
restartTest();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -3235,13 +3248,26 @@ $(document).keydown((event) => {
|
|||
if (config.quickTab) {
|
||||
event.preventDefault();
|
||||
if ($(".pageTest").hasClass("active")) {
|
||||
if (testActive && !afkDetected) {
|
||||
let testNow = Date.now();
|
||||
let testSeconds = roundTo2((testNow - testStart) / 1000);
|
||||
incompleteTestSeconds += testSeconds;
|
||||
restartCount++;
|
||||
if (
|
||||
(config.mode === "words" && config.words < 1000) ||
|
||||
(config.mode === "time" && config.time < 3600) ||
|
||||
(config.mode === "custom" &&
|
||||
customTextIsRandom &&
|
||||
customTextWordCount < 1000) ||
|
||||
(config.mode === "custom" &&
|
||||
!customTextIsRandom &&
|
||||
customText.length < 1000)
|
||||
) {
|
||||
if (testActive && !afkDetected) {
|
||||
let testNow = Date.now();
|
||||
let testSeconds = roundTo2((testNow - testStart) / 1000);
|
||||
incompleteTestSeconds += testSeconds;
|
||||
restartCount++;
|
||||
}
|
||||
restartTest();
|
||||
} else {
|
||||
showNotification("Quick restart disabled for long tests", 3000);
|
||||
}
|
||||
restartTest();
|
||||
} else {
|
||||
changePage("test");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue