From 2e2cc9119812009f30aa7cf00b217b004b801bf0 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 28 Jan 2021 19:08:21 +0000 Subject: [PATCH] fixed interchangable quotes --- src/js/script.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index fb9dbafb9..7dfa98cfc 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -1156,7 +1156,7 @@ function updateWordElement(showError) { charCorrect = true; } } - } catch (e) {} + } catch {} let currentLetter = currentWord[i]; let tabChar = ""; @@ -5426,16 +5426,24 @@ function handleAlpha(event) { } } - if (event.key === "'" || event.key === "’") { - if (nextCharInWord == "'" || nextCharInWord == "’") { - thisCharCorrect = true; - } + if (event.key === "’" && nextCharInWord == "'") { + event.key = "'"; + thisCharCorrect = true; } - if (event.key === '"' || event.key === "”") { - if (nextCharInWord == '"' || nextCharInWord == "”") { - thisCharCorrect = true; - } + if (event.key === "'" && nextCharInWord == "’") { + event.key = "’"; + thisCharCorrect = true; + } + + if (event.key === "”" && nextCharInWord == '"') { + event.key = '"'; + thisCharCorrect = true; + } + + if (event.key === '"' && nextCharInWord == "”") { + event.key = "”"; + thisCharCorrect = true; } if (!thisCharCorrect) {