chola/docs/js/app.js

23 lines
728 B
JavaScript
Raw Permalink Normal View History

2021-01-28 22:51:26 +03:00
function layoutReplace()
{
2021-11-12 22:12:07 +03:00
'use strict';
2021-11-18 01:13:18 +03:00
let keys = {
2021-01-28 22:51:26 +03:00
"q":"й", "w":"ц", "e":"у", "r":"к", "t":"е", "y":"н", "u":"г",
"i":"ш", "o":"щ", "p":"з", "[":"х", "]":"ъ", "a":"ф", "s":"ы",
"d":"в", "f":"а", "g":"п", "h":"р", "j":"о", "k":"л", "l":"д",
";":"ж", "'":"э", "z":"я", "x":"ч", "c":"с", "v":"м", "b":"и",
"n":"т", "m":"ь", ",":"б", ".":"ю", "/":"."
};
2021-11-12 22:12:07 +03:00
let inputText = document.getElementById("one").value;
let outputText = document.getElementById("two");
let text = null;
2021-01-28 22:51:26 +03:00
2021-11-12 22:12:07 +03:00
text = inputText.replace(/[A-z/,.;\'\]\[]/g, function(x) {
2021-01-28 22:51:26 +03:00
return x == x.toLowerCase() ? keys[ x ] : keys[ x.toLowerCase() ].toUpperCase();
});
2021-11-12 22:12:07 +03:00
outputText.value = text;
2021-01-28 22:51:26 +03:00
}