forked from letterly/letterly.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrusyn.html
More file actions
140 lines (136 loc) · 4.65 KB
/
Copy pathrusyn.html
File metadata and controls
140 lines (136 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<html>
<head>
<title>Rusyn Transliterator</title>
<style>
h1,h2{
text-align: center;
}
textarea{
margin-left: 5%;
margin-right: 5%;
width: 39%;
font-size: 24px;
height: 200px;
resize: none;
}
*{
font-family: 'Verdana';
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function(){
var typingTimer
var doneTypingInterval = 1000
var $cyrillic = document.getElementById("cyrillic")
var $latin = document.getElementById("latin")
$cyrillic.addEventListener('keyup', cyrillicFunction)
$latin.addEventListener('keyup', latinFunction)
function cyrillicFunction () {
cyrillic = $cyrillic.value
for(e of Object.keys(cyrillicKey)){
var myRegExp = new RegExp(e, 'g')
cyrillic = cyrillic.replace(myRegExp, cyrillicKey[e])
}
$latin.value = cyrillic
}
function latinFunction () {
latinText = $latin.value
for(e of Object.keys(latinKey)){
var myRegExp = new RegExp(e, 'g')
latinText = latinText.replace(myRegExp, latinKey[e])
}
$cyrillic.value = latinText
}
latinKey = {
"ňa": "ня",
"ľ": "ль",
"ň": "нь",
"ť": "ть",
šč: "щ",
'j': "й",
ch: "х",
ja: "я",
je: "є",
ji: "ї",
jo: "ë",
ju: "ю",
"\\'": "ь",
a: "а",
b: "б",
d: "д",
e: "е",
f: "ф",
g: "ґ",
h: "г",
i: "і",
k: "к",
l: "л",
m: "м",
n: "н",
o: "о",
p: "п",
r: "р",
s: "с",
t: "т",
c: "ц",
u: "у",
v: "в",
y: "и",
z: "з",
č: "ч",
š: "ш",
ŷ: "ы",
ž: "ж",
}
cyrillicKey = {
"ня": "ňa",
"ль": "ľ",
"нь": "ň",
"ть": "ť",
"а": "a",
"б": "b",
"в": "v",
"г": "h",
"ґ": "g",
"д": "d",
"е": "e",
"є": "je",
"ë": "jo",
"ж": "ž",
"з": "z",
"і": "i",
"ї": "ji",
"и": "y",
"к": "k",
"л": "l",
"м": "m",
"н": "n",
"о": "o",
"п": "p",
"р": "r",
"с": "s",
"т": "t",
"у": "u",
"ф": "f",
"х": "ch",
"ц": "c",
"ч": "č",
"ш": "š",
"щ": "šč",
"й": "j",
"ы": "ŷ",
"ю": "ju",
"я": "ja",
//"ь": "'",
}
for(f of Object.entries(latinKey)) latinKey[f[0].charAt(0).toUpperCase() + f[0].slice(1)] = f[1].charAt(0).toUpperCase() + f[1].slice(1)
for(f of Object.entries(cyrillicKey)) cyrillicKey[f[0].charAt(0).toUpperCase() + f[0].slice(1)] = f[1].charAt(0).toUpperCase() + f[1].slice(1)
}, false);
</script>
</head>
<body>
<h1>Rusyn Transliterator</h1>
<textarea id="cyrillic" placeholder="enter Rusyn Cyrillic text"></textarea>
<textarea id="latin" placeholder="or enter Rusyn in Latin letters here"></textarea>
</body>
</html>