From 08e374ed1e5a0d8e14773a9cc1ef67f1ae55b940 Mon Sep 17 00:00:00 2001 From: Miodec Date: Sun, 3 Jan 2021 22:20:49 +0000 Subject: [PATCH] fixed a bug where you could start typing during the page transition resulting in a never ending test --- src/js/script.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index a5a0d3165..e1c8e0b68 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -263,7 +263,7 @@ function copyResultToClipboard() { $(".pageTest .loginTip").removeClass("hidden"); }) .catch((f) => { - open(URL.createObjectURL(blob)) + open(URL.createObjectURL(blob)); $(".notification").removeClass("hidden"); Misc.showNotification("Error saving image to clipboard", 2000); $(".pageTest .ssWatermark").addClass("hidden"); @@ -271,15 +271,15 @@ function copyResultToClipboard() { if (firebase.auth().currentUser == null) $(".pageTest .loginTip").removeClass("hidden"); }); - } catch(e) { - open(URL.createObjectURL(blob)) - $(".notification").removeClass("hidden"); - Misc.showNotification("Error saving image to clipboard", 2000); - $(".pageTest .ssWatermark").addClass("hidden"); - $(".pageTest .buttons").removeClass("hidden"); - if (firebase.auth().currentUser == null) - $(".pageTest .loginTip").removeClass("hidden"); - } + } catch (e) { + open(URL.createObjectURL(blob)); + $(".notification").removeClass("hidden"); + Misc.showNotification("Error saving image to clipboard", 2000); + $(".pageTest .ssWatermark").addClass("hidden"); + $(".pageTest .buttons").removeClass("hidden"); + if (firebase.auth().currentUser == null) + $(".pageTest .loginTip").removeClass("hidden"); + } }); }); } catch (e) { @@ -724,9 +724,9 @@ function punctuateWord(previousWord, currentWord, index, maxindex) { if ( (index == 0 || - Misc.getLastChar(previousWord) == "." || - Misc.getLastChar(previousWord) == "?" || - Misc.getLastChar(previousWord) == "!") && + Misc.getLastChar(previousWord) == "." || + Misc.getLastChar(previousWord) == "?" || + Misc.getLastChar(previousWord) == "!") && config.language.split("_")[0] != "code" ) { //always capitalise the first word or if there was a dot unless using a code alphabet @@ -2632,6 +2632,9 @@ function showResult(difficultyFailed = false) { } function startTest() { + if (pageTransition) { + return; + } if (!dbConfigLoaded) { configChangedBeforeDb = true; }