last words that were uncompleted in time mode will now no longer affect raw and incorrect chars

This commit is contained in:
Jack 2020-07-25 16:27:57 +01:00
parent 77d670853d
commit da887db497

View file

@ -899,6 +899,10 @@ function countChars() {
let spaces = 0;
let correctspaces = 0;
for (let i = 0; i < inputHistory.length; i++) {
if (inputHistory[i] === currentInput) {
//last word that was not finished
continue;
}
if (inputHistory[i] == wordsList[i]) {
//the word is correct
correctWordChars += wordsList[i].length;
@ -2054,8 +2058,12 @@ async function loadWordsHistory() {
wordEl +=
'<letter class="correct">' + wordsList[index][c] + "</letter>";
} else {
wordEl +=
'<letter class="incorrect">' + wordsList[index][c] + "</letter>";
if (input === currentInput) {
wordEl += "<letter>" + wordsList[index][c] + "</letter>";
} else {
wordEl +=
'<letter class="incorrect">' + wordsList[index][c] + "</letter>";
}
}
} else {
wordEl += '<letter class="incorrect extra">' + input[c] + "</letter>";
@ -2837,10 +2845,7 @@ $(document).keydown((event) => {
currentKeypressCount++;
} else {
if (config.stopOnError) {
if (
config.difficulty == "expert" ||
config.difficulty == "master"
) {
if (config.difficulty == "expert" || config.difficulty == "master") {
showResult(true);
if (!afkDetected) {
let testNow = Date.now();