From fb7d93b9bb81b7c38875550f8fff89251085a314 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 28 Oct 2020 17:12:49 +0000 Subject: [PATCH] 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(