-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
70 lines (68 loc) · 2.2 KB
/
index.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
<!DOCTYPE html>
<html lang="kk">
<head>
<meta charset="UTF-8">
<title>Qazaq Latyn</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<style>
textarea {
font-family: 'Roboto', sans-serif;
font-size: 18px;
}
</style>
</head>
<body onload="initialize();">
<label for="input">Кирил:</label><br/>
<textarea id="input"
rows="10"
cols="120"
onkeyup="transform(this.value);">
</textarea>
<br/>
<label for="output">Latyn:</label><br/>
<textarea id="output"
rows="10"
cols="120">
</textarea>
<script type="text/javascript">
let initString = 'Алтын күн аспаны,\n' +
'Алтын дән даласы,\n' +
'Ерліктің дастаны,\n' +
'Еліме қарашы!\n' +
'Ежелден ер деген,\n' +
'Даңқымыз шықты ғой.\n' +
'Намысын бермеген,\n' +
'Қазағым мықты ғой!';
function transform(input) {
const original = [
'а', 'ә', 'б', 'д', 'е', 'ф', 'г', 'ғ', 'х', 'h',
'i', 'и', 'й', 'ж', 'к', 'л', 'м', 'н', 'ң', 'о',
'ө', 'п', 'қ', 'р', 'с', 'т', 'ұ', 'ү', 'в',
'ы', 'у', 'з', 'ш', 'ч',
'А', 'Ә', 'Б', 'Д', 'Е', 'Ф', 'Г', 'Ғ', 'Х',
'I', 'И', 'Ж', 'К', 'Л', 'М', 'Н', 'Ң', 'О',
'Ө', 'П', 'Қ', 'Р', 'С', 'Т', 'Ұ', 'Ү', 'В',
'Ы', 'У', 'З', 'Ш', 'Ч'
];
const converted = [
'a', 'á', 'b', 'd', 'e', 'f', 'g', 'ǵ', 'h', 'h',
'i', 'ı', 'ı', 'j', 'k', 'l', 'm', 'n', 'ń', 'o',
'ó', 'p', 'q', 'r', 's', 't', 'u', 'ú', 'v',
'y', 'ý', 'z', 'sh', 'ch',
'A', 'Á', 'B', 'D', 'E', 'F', 'G', 'Ǵ', 'H',
'I', 'I', 'J', 'K', 'L', 'M', 'N', 'Ń', 'O',
'Ó', 'P', 'Q', 'R', 'S', 'T', 'U', 'Ú', 'V',
'Y', 'Ý', 'Z', 'Sh', 'Ch'
];
for (let i = 0; i < original.length; i++) {
input = input.replace(new RegExp(original[i], 'g'), converted[i]);
}
document.getElementById('output').value = input;
}
function initialize() {
document.getElementById('input').value = initString;
transform(initString);
}
</script>
</body>
</html>