fix vars names

This commit is contained in:
Alexander Popov 2021-11-12 22:12:07 +03:00
parent 544dded23f
commit f85522b8a6
Signed by: iiiypuk
GPG Key ID: 398FC73478D97286

View File

@ -1,5 +1,7 @@
function layoutReplace() function layoutReplace()
{ {
'use strict';
keys = { keys = {
"q":"й", "w":"ц", "e":"у", "r":"к", "t":"е", "y":"н", "u":"г", "q":"й", "w":"ц", "e":"у", "r":"к", "t":"е", "y":"н", "u":"г",
"i":"ш", "o":"щ", "p":"з", "[":"х", "]":"ъ", "a":"ф", "s":"ы", "i":"ш", "o":"щ", "p":"з", "[":"х", "]":"ъ", "a":"ф", "s":"ы",
@ -8,16 +10,16 @@ function layoutReplace()
"n":"т", "m":"ь", ",":"б", ".":"ю", "/":"." "n":"т", "m":"ь", ",":"б", ".":"ю", "/":"."
}; };
var dat = document.getElementById("one").value let inputText = document.getElementById("one").value;
var res = document.getElementById("two") let outputText = document.getElementById("two");
let text = null 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(); return x == x.toLowerCase() ? keys[ x ] : keys[ x.toLowerCase() ].toUpperCase();
}); });
res.value = text outputText.value = text;
} }