From f85522b8a6da4d1a54162bd028a89c94db5158a2 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Fri, 12 Nov 2021 22:12:07 +0300 Subject: [PATCH] fix vars names --- docs/js/app.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/js/app.js b/docs/js/app.js index 766f989..7ab121c 100644 --- a/docs/js/app.js +++ b/docs/js/app.js @@ -1,5 +1,7 @@ function layoutReplace() { + 'use strict'; + keys = { "q":"й", "w":"ц", "e":"у", "r":"к", "t":"е", "y":"н", "u":"г", "i":"ш", "o":"щ", "p":"з", "[":"х", "]":"ъ", "a":"ф", "s":"ы", @@ -8,16 +10,16 @@ function layoutReplace() "n":"т", "m":"ь", ",":"б", ".":"ю", "/":"." }; - var dat = document.getElementById("one").value - var res = document.getElementById("two") - let text = null + let inputText = document.getElementById("one").value; + let outputText = document.getElementById("two"); + let text = null; - console.log(dat) + console.log(inputText); - text = dat.replace(/[A-z/,.;\'\]\[]/g, function(x) { + text = inputText.replace(/[A-z/,.;\'\]\[]/g, function(x) { return x == x.toLowerCase() ? keys[ x ] : keys[ x.toLowerCase() ].toUpperCase(); }); - res.value = text + outputText.value = text; }