From fb7d93b9bb81b7c38875550f8fff89251085a314 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 28 Oct 2020 17:12:49 +0000 Subject: [PATCH 1/3] added dead key indicator --- public/css/style.scss | 23 +++++++++++++++++++++++ public/js/script.js | 10 ++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/public/css/style.scss b/public/css/style.scss index 94ccf01f0..48cf7b4c2 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -1518,6 +1518,16 @@ key { user-select: none; padding-bottom: 1em; + letter{ + border-bottom-style: solid; + border-bottom-width: .05em; + border-bottom-color: transparent; + &.dead{ + border-bottom-width: .05em; + border-bottom-color: var(--sub-color); + } + } + /* a little hack for right-to-left languages */ &.rightToLeftTest { flex-direction: row-reverse; @@ -1540,6 +1550,10 @@ key { .word { color: var(--text-color); + & letter.dead{ + border-bottom-color: var(--sub-color) !important; + } + & letter.correct { color: var(--sub-color); } @@ -1557,6 +1571,11 @@ key { &.colorfulMode { .word { + + & letter.dead{ + border-bottom-color: var(--main-color) !important; + } + & letter.correct { color: var(--main-color); } @@ -1584,6 +1603,10 @@ key { .word { color: var(--main-color); + & letter.dead{ + border-bottom-color: var(--sub-color) !important; + } + & letter.correct { color: var(--sub-color); } diff --git a/public/js/script.js b/public/js/script.js index 6fff3d13a..17aef6bf3 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1623,7 +1623,7 @@ function countChars() { } function calculateStats() { - let testSeconds = roundTo2((testEnd - testStart) / 1000); + let testSeconds = (testEnd - testStart) / 1000; // if (config.mode == "words" && config.difficulty == "normal") { // if (inputHistory.length != wordsList.length) return; @@ -4518,7 +4518,6 @@ $(document).keydown(function (event) { "Meta", "Alt", "AltGraph", - "Dead", "CapsLock", "Backspace", "Enter", @@ -4542,6 +4541,13 @@ $(document).keydown(function (event) { } else { if (!testActive) return; } + + if (event.key === "Dead") { + playClickSound(); + $(document.querySelector("#words .word.active").querySelectorAll("letter")[currentInput.length]).toggleClass('dead'); + return; + } + let thisCharCorrect; let nextCharInWord = wordsList[currentWordIndex].substring( From 441fd788b7df2f600050d9f632a36e5e465084b1 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 28 Oct 2020 17:14:54 +0000 Subject: [PATCH 2/3] blind mode not showing errors on the keymap --- public/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/script.js b/public/js/script.js index 17aef6bf3..8d4166ca5 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1362,7 +1362,7 @@ function flashPressedKeymapKey(key, correct) { } try { - if (correct) { + if (correct || config.blindMode) { $(key) .stop(true, true) .css({ From 64bdb265ddaf5c11566121977c5b3a52f9cd6c41 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 28 Oct 2020 17:31:58 +0000 Subject: [PATCH 3/3] fixed os key appearing as text --- public/js/script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/js/script.js b/public/js/script.js index 8d4166ca5..eb36c9bce 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -4528,6 +4528,7 @@ $(document).keydown(function (event) { "ArrowLeft", "ArrowRight", "ArrowDown", + "OS", undefined ].includes(event.key) ) return;