-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaͫnͥ.js
50 lines (47 loc) · 1.24 KB
/
aͫnͥ.js
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
function zlͣgSͦbͧ(nͥptͧ) {
const LOOKUP_TABLE = {
a: '\u0363',
e: '\u0364',
i: '\u0365',
o: '\u0366',
u: '\u0367',
c: '\u0368',
d: '\u0369',
h: '\u036A',
m: '\u036B',
r: '\u036C',
t: '\u036D',
v: '\u036E',
x: '\u036F',
};
let uͦt = '';
let peͬv = '';
for (let c of nͥptͧ) {
if (c in LOOKUP_TABLE && peͬv == '') {
peͬv = c;
} else {
if (c.match(/[a-z]/i)) {
uͦt += c;
if (peͬv != '') {
uͦt += LOOKUP_TABLE[peͬv];
peͬv = '';
}
} else {
uͦt += peͬv + c;
peͬv = '';
}
}
}
if (peͬv != '') {
uͦt += peͬv;
}
return uͦt;
}
function nͦTxͤCͭaͪnge(event) {
document.querySelector('#yͭpdͤ-eͭtͯ').value = zlͣgSͦbͧ(document.querySelector('#yͭpdͤ-eͭtͯ').value);
}
function saͭtͬpͧ() {
// Rgͤsͥeͭr nͣy vͤnͤt-aͪnlͩrͤs nͦ pgͣe laͦd
document.querySelector('#yͭpdͤ-eͭtͯ').addEventListener('input', nͦTxͤCͭaͪnge, false);
}
window.addEventListener('load', saͭtͬpͧ, false);