forked from letterly/letterly.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvlach.html
154 lines (150 loc) · 3.95 KB
/
vlach.html
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<html>
<head>
<title>Vlach 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 = {
Nj: "Њ",
Dž: "Џ",
A: "А",
Lj: "Љ",
B: "Б",
C: "Ц",
D: "Д",
E: "Е",
F: "Ф",
G: "Г",
H: "Х",
I: "И",
J: "Ј",
K: "К",
L: "Л",
M: "М",
N: "Н",
O: "О",
P: "П",
R: "Р",
S: "C",
T: "Т",
U: "У",
V: "В",
Z: "З",
"nj": "њ",
"dž": "џ",//12456
"lj": "љ",//126
"ă": "ӑ",
"a": "а",
"b": "б",
"ć": "ћ",//146
"č": "ч",//16
"c": "ц",
"d": "д",
"đ": "ђ",//1456
"e": "е",
"f": "ф",
"g": "г",
"h": "х",
"î": "й",//???
"i": "и",
"j": "ј",
"k": "к",
"l": "л",
"m": "м",
"n": "н",
"o": "о",
"p": "п",
"r": "р",
"ś": "ш́",//345
"š": "ш",//156
"s": "c",
"t": "т",
"u": "у",
"v": "в",
"ź": "ж́",//???
"ž": "ж",//2346
"z": "з",
}
cyrillicKey = {
"њ": "nj",
"џ": "dž",
"љ": "lj",
"ӑ": "ă",
"а": "a",
"б": "b",
"ћ": "ć",
"ч": "č",
"ц": "c",
"д": "d",
"ђ": "đ",
"е": "e",
"ф": "f",
"г": "g",
"х": "h",
"й": "î",
"и": "i",
"ј": "j",
"к": "k",
"л": "l",
"м": "m",
"н": "n",
"о": "o",
"п": "p",
"р": "r",
"ш́": "ś",
"ш": "š",
"c": "s",
"т": "t",
"у": "u",
"в": "v",
"ж́": "ź",
"ж": "ž",
"з": "z",
}
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>Vlach Transliterator</h1>
<textarea id="cyrillic" placeholder="enter Vlach Cyrillic text"></textarea>
<textarea id="latin" placeholder="or enter Vlach in Latin letters here"></textarea>
</body>
</html>