From eeea57336d1a604bd79d0b6838d336d4ec8d5f2d Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 26 Aug 2020 22:24:05 +0100 Subject: [PATCH] mini timer style fixes --- public/index.html | 2 +- public/js/script.js | 39 ++++++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/public/index.html b/public/index.html index be495ee1b..cf1733a77 100644 --- a/public/index.html +++ b/public/index.html @@ -976,7 +976,7 @@
input history
60
-
1:00
+
60
diff --git a/public/js/script.js b/public/js/script.js index 14448be20..365500f23 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -859,15 +859,17 @@ function showTimer() { 250 ); } else if (config.timerStyle === "mini") { - $("#miniTimerAndLiveWpm .time") - .stop(true, true) - .removeClass("hidden") - .animate( - { - opacity: op, - }, - 250 - ); + if (op > 0) { + $("#miniTimerAndLiveWpm .time") + .stop(true, true) + .removeClass("hidden") + .animate( + { + opacity: op, + }, + 250 + ); + } } } @@ -878,12 +880,17 @@ function hideTimer() { }, 125 ); - $("#miniTimerAndLiveWpm .time").stop(true, true).animate( - { - opacity: 0, - }, - 125 - ); + $("#miniTimerAndLiveWpm .time") + .stop(true, true) + .animate( + { + opacity: 0, + }, + 125, + () => { + $("#miniTimerAndLiveWpm .time").addClass("hidden"); + } + ); $("#timerNumber").stop(true, true).animate( { opacity: 0, @@ -2333,6 +2340,8 @@ function restartTest(withSameWordset = false) { } else { hideKeymap(); } + document.querySelector("#miniTimerAndLiveWpm .wpm").innerHTML = "0"; + document.querySelector("#liveWpm").innerHTML = "0"; if (activeFunBox === "layoutfluid") { changeLayout("qwerty");