-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
613 lines (493 loc) · 20 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Chinese tones practice (beta)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<body class="container">
<h1 class="fs-4 mt-3">Chinese tones practice (beta)</h1>
<div class="card mt-3 ps-3 pe-3 container">
<h5 class="fs-5 fw-bold mt-4 mb-1">Play a Chinese syllable:</h5>
<p class="mt-1 mb-3">
<button id="btn-playnew" class="btn btn-primary btn-lg mt-2 fs-6" type="button">Play New <span id="btn-playnew-spinner" class="collapse spinner-border spinner-border-sm" role="status" aria-hidden="true"></span></button>
<input id="btn-repeat" type="button" class="btn btn-secondary btn-lg mt-2 fs-6" value="Repeat">
<input id="btn-solution" type="button" class="btn btn-success btn-lg mt-2 fs-6" data-bs-toggle="collapse" data-bs-target="#solution" aria-expanded="false" aria-controls="answer" value="See Solution">
</p>
<h5 class="fs-5 fw-bold mt-4 mb-2">Choose your answer:</h5>
<div id="user-answers">
<input id="btn-select1" type="button" class="btn btn-info btn-lg mt-2 me-2 fs-4" value="1 -" data-tonenumber="1">
<input id="btn-select2" type="button" class="btn btn-info btn-lg mt-2 me-2 fs-4" value="2 /" data-tonenumber="2">
<input id="btn-select3" type="button" class="btn btn-info btn-lg mt-2 me-2 fs-4" value="3 v" data-tonenumber="3">
<input id="btn-select4" type="button" class="btn btn-info btn-lg mt-2 me-2 fs-4" value="4 \" data-tonenumber="4">
</div>
<div id="status" class="mt-4 mb-1 fw-bold"></div>
<div id="solution" class="collapse mb-3 mt-4 p-2 card text-dark bg-light border-dark">
<h5 class="fs-5 fw-bold">Solution:</h5>
<p id="solution-text">
<span id="tone-details"></span>
</p>
<h6 class="fs-6 fw-bold">Listen to the same syllable by different voices:</h6>
<div id="alternative-tones">
<input id="btn-alternative1" type="button" class="btn btn-outline-secondary" value="Play Alternative 1">
<input id="btn-alternative2" type="button" class="btn btn-outline-secondary" value="Play Alternative 2">
<input id="btn-alternative3" type="button" class="btn btn-outline-secondary" value="Play Alternative 3">
<input id="btn-alternative4" type="button" class="btn btn-outline-secondary" value="Play Alternative 4">
<input id="btn-alternative5" type="button" class="btn btn-outline-secondary" value="Play Alternative 5">
</div>
</div>
<div id="session-score" class="mt-2 mb-3"></div>
</div>
<div class="mt-5 pt-5">
<h5 class="fs-5 fw-bold">Description:</h5>
<p>This web application is for a free practice of <a href="https://en.wikipedia.org/wiki/Tone_(linguistics)#Asia">four Chinese tones</a> recognition.
<br>It uses high quality audio from <a href="https://tone.lib.msu.edu/">Tone Perfect Database</a>.</p>
<h2 class="fs-5 fw-bold">Instructions:</h2>
<ol>
<li>Press <tt>Play New</tt> or <kbd>P</kbd> key or <kbd>8</kbd> key to play random Chinese syllable.</li>
<li>Press <tt>Repeat Last</tt> or <kbd>R</kbd> key or <kbd>5</kbd> key to repeat audio.</li>
<li>Press one of fours <tt>answer buttons</tt> or key <kbd>1</kbd>, <kbd>2</kbd>, <kbd>3</kbd>, <kbd>4</kbd> to guess the answer.</li>
<!--li>Press <tt>Show Solution</tt> or <kbd>A</kbd> key or <kbd>6</kbd> key to show correct answer (there is a link for details about curren sound).</li-->
<li>Repeat with next sound.</li>
</ol>
<h5 class="fs-5 fw-bold">Credits:</h5>
<p>Martin Hassman</a>, programming.<br>
Catherine Ryu, Mandarin Tone Perception & Production Team, and Michigan State University Libraries. <a href="https://tone.lib.msu.edu/">Tone Perfect: Multimodal Database for Mandarin Chinese</a>.
</p>
<h5 class="fs-5 fw-bold">Related projects:</h5>
<ul>
<li><a href="https://matthewscholefield.github.io/mandarin-sound-table/">Mandarin sound table</a></li>
<li><a href="https://recursivecorruption.github.io/kuai/">Kuai</a></li>
</ul>
<h5 class="fs-5 fw-bold">About author:</h5>
<p>My name is <a href="https://www.linkedin.com/in/hassman/">Martin Hassman</a>, I'm an IT professional from the Czech Republic.
I love learning laguanges and developing applications that help with learning (eg. <a href="https://github.com/met/subfilter/wiki">Subfilter for Netflix</a>).
I'm volunteer at <a href="https://cesko.digital/en.html">Cesko.Digital</a>.</p>
</div>
<footer class="text-center fst-italic pt-4">
<p><a href="https://github.com/met/chinese-tones-practice">Source code</a> available (MIT License).</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" type="text/javascript" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<script>
"use strict";
let appData = { pinyinsToId: undefined, syllableToPinyins: undefined, pinyins: undefined, syllables: undefined, loaded: false };
let appState = { lastPlayed: null, // lastPlayed = {syllable, tone, pinyin, id }
lastAudio: null, solved: false, guesses: 0,
session: { rounds:0, answers: [ // appState.session.answers is an array of user's answers, divided into 4 arrays by success rate
[], // answers solved by 1st guess
[], // answers solved by 2nd guess etc.
[],
[]
], guesses:0, goodGuesses:0},
};
function loadAppData(appData) {
let promise1 = fetch("pinyins.json")
.then(response => {
if (response.ok) { return response.json() }
else { return Promise.reject({msg:"Data not loaded", response}) }
}).then(data => data);
let promise2 = fetch("syllableToPinyins.json")
.then(response => {
if (response.ok) { return response.json() }
else { return Promise.reject({msg:"Data not loaded", response}) }
}).then(data => data);
Promise.all([promise1, promise2]).then((values) => {
//console.debug("Promise.all", values)
appData.pinyinsToId = values[0];
appData.syllableToPinyins = values[1];
appData.pinyins = processPinyinsToId(appData.pinyinsToId);
appData.syllables = processSyllableToPinyins(appData.syllableToPinyins);
appData.loaded = true;
});
}
// Check data validity, return sorted array of pinyins
function processPinyinsToId(pinyinsToId) {
let pinyins = [];
for (let pinyin in pinyinsToId) {
pinyins.push(pinyin);
let item = pinyinsToId[pinyin]
if (item.length < 6) { // TODO there are many of them, I need to find missing sounds and complete dataset
//console.log(pinyin, item.length);
}
if (item.length > 6) {
console.error(pinyin, item.length);
}
}
console.debug("Pinyins loaded", pinyins.length);
if (pinyins.length != 1640) { // Expected 1640 (= 410 syllables * 4 tones)
console.warn("Unexpected number of pinyins", pinyins.length);
}
pinyins.sort();
return pinyins;
}
// Check data validity, return sorted array of syllables
function processSyllableToPinyins(syllableToPinyins) {
let syllables = [];
for (let syllable in syllableToPinyins) {
syllables.push(syllable);
let pinyinsFromSyllable = syllableToPinyins[syllable];
if (pinyinsFromSyllable.length != 4) {
console.error(syllable, pinyinsFromSyllable.length, pinyinsFromSyllable);
}
}
console.debug("Syllables loaded:", syllables.length);
if (syllables.length != 410) { // expecting 410 syllables (410 syllables * 4 tones * 6 voices = 9840 sounds)
console.warn("Unexpected number of syllables", syllables.length);
}
syllables.sort();
return syllables;
}
// pinyin = string
// tone = 1, 2, 3 or 4
// voice = FV1, FV2, FV3, FV4, MV1, MV2 or MV3
// Eg. playVoice("a", 1, "mv1") = play a1 with MV1 = a1_MV1_MP3.mp3
function playVoice(pinyin, tone, voice, callback) {
if (pinyin && tone && voice) {
pinyin = String(pinyin).toLowerCase();
tone = parseInt(tone);
voice = String(voice).toUpperCase();
if (pinyin.match(/^[a-z]{1,6}$/) && voice.match(/^[MF]V[1-3]$/) && tone >= 1 && tone <= 4 ) {
let filename = pinyin + String(tone) + "_" + voice + "_MP3.mp3";
console.debug("Play", filename);
return playFile(filename, callback);
}
}
}
// Eg. playFile("a1_FV1_MP3.mp3"), playFile("zhuang1_FV2_MP3.mp3")
function playFile(filename, callback) {
if (filename && String(filename)) {
filename = String(filename);
if (filename.match(/^[a-z]{1,6}[1-4]_[MF]V[1-3]_MP3\.mp3$/)) {
let url = "tone_perfect/mp3/" + filename;
return playURL(url, callback);
}
}
}
// Eg. playId(1584)
function playId(id, callback) {
if (id && parseInt(id)) {
id = parseInt(id);
if (id > 1000 && id < 12000) {
const url = `https://tone.lib.msu.edu/tone/${id}/PROXY_MP3/view`;
console.debug("Play", id);
return playURL(url, callback);
}
}
}
// Return reference to audio element.
// When playing started, call callback if defined
// Eg. playURL("https://tone.lib.msu.edu/tone/1584/datastream/PROXY_MP3")
function playURL(url, callback) {
if (url) {
console.debug("Play", url);
let audio = new Audio(url);
audio.play().then(e => {
if (callback) {callback();}
});
return audio;
}
}
function playRandom() {
let p = chooseRandomPinyin();
console.debug(p);
return playId(p.id);
}
function chooseRandomPinyin() {
let syllables = appData.syllables;
let randomSyllable = syllables[Math.floor(Math.random() * syllables.length)];
let syllableToPinyins = appData.syllableToPinyins;
let randomToneIndex = Math.floor(Math.random() * syllableToPinyins[randomSyllable].length); // toneindex is zero-based. tone == toneindex+1
let randomPinyin = syllableToPinyins[randomSyllable][randomToneIndex];
let pinyinsToId = appData.pinyinsToId;
//console.log(randomPinyin);
//console.log(pinyinsToId[randomPinyin]);
// We have random pinyin, choose random voice
if (pinyinsToId[randomPinyin]) {
let randomVoiceSet = pinyinsToId[randomPinyin];
let randomVoiceIndex = Math.floor(Math.random() * randomVoiceSet.length);
let randomId = randomVoiceSet[randomVoiceIndex];
//console.log(randomId);
// Sanitize syllable and pinyin strings in case there were some malicious data in JSON files, randomId is sanitizes by conversion Number(randomId)
return {"syllable": sanitizePinyin(randomSyllable), "tone": indexToTone(randomToneIndex), "pinyin": sanitizePinyin(randomPinyin), "id": Number(randomId)};
}
else {
console.warn("Cannot find pinyin in pinyinsToId:", randomPinyin);
return null;
}
}
// Find alternative voices to the voice with `voiceId` for `pinyin` in `pinyinsToId`
function getAlternativeVoiceIds(pinyinsToId, pinyin, voiceId) {
if (pinyinsToId[pinyin]) {
let allVoicesIds = pinyinsToId[pinyin];
let alternativeVoicesIds = allVoicesIds.filter( altVoiceId => altVoiceId != voiceId); // exclude current voiceId
// Sanitize, exclude all non-integer values
alternativeVoicesIds = alternativeVoicesIds.filter( item => parseInt(item) == item );
return alternativeVoicesIds;
}
}
// Simple sanitizer. Remove bad characters from pinyins
function sanitizePinyin(text) {
if (typeof(text) == "number") {
text = String(text);
}
// Remove all: &<>"'
// These shoudn't be used in syllables and pinyins by any chance
return text.replaceAll("&", "").replaceAll("<", "").replaceAll(">", "").replaceAll('"', "").replaceAll("'", "");
}
// Simple HTML text sanitizer, escape suspicious characters
// and remove removeChar if defined
function sanitize(text, removeChar) {
if (typeof(text) == "number") {
text = String(text);
}
if (removeChar) {
text = text.replaceAll(removeChar, "");
}
return text.replaceAll("&", "&").replaceAll("<", "<");
}
// syllableToPinyins.json has strange order of tones
// Here convert order (array index) to tone number
function indexToTone(index) {
return [4,2,1,3][index];
}
function playNew() {
if (!appData || !appData.loaded) {
console.log("Can't play, no appData.");
return;
}
let p = chooseRandomPinyin();
appState.lastPlayed = p;
let alternativeVoicesIds = getAlternativeVoiceIds(appData.pinyinsToId, p.pinyin, p.id);
// Show spinning wheel during audio download
showSpinningWheel();
disableAnswers();
let audio = playId(p.id, function() {
hideSpinningWheel();
resetAnswers();
setSolution(p, alternativeVoicesIds);
document.getElementById("btn-repeat").disabled = false;
document.getElementById("btn-solution").disabled = false;
});
appState.lastAudio = audio;
}
function playLastAgain() {
if (appState.lastPlayed) {
if (appState.lastAudio) {
let audio = appState.lastAudio;
audio.play();
}
else {
playId(appState.lastPlayed.id)
}
}
}
function showSpinningWheel() {
let loadingEl = document.getElementById("btn-playnew-spinner");
loadingEl.classList.remove("collapse");
}
function hideSpinningWheel() {
let loadingEl = document.getElementById("btn-playnew-spinner");
loadingEl.classList.add("collapse");
}
function getAnswerButtons() {
let btnSelect1 = document.getElementById("btn-select1");
let btnSelect2 = document.getElementById("btn-select2");
let btnSelect3 = document.getElementById("btn-select3");
let btnSelect4 = document.getElementById("btn-select4");
return [btnSelect1, btnSelect2, btnSelect3, btnSelect4];
}
function disableAnswers() {
let buttons = getAnswerButtons();
buttons.forEach(element => {
element.disabled = true;
});
}
// prepare answer buttons for the next round
function resetAnswers() {
let solutionEl = document.getElementById("solution");
let statusEl = document.getElementById("status");
let buttons = getAnswerButtons();
solutionEl.classList.remove("show"); // Hide solution
statusEl.innerHTML = "";
buttons.forEach( element => {
element.disabled = false;
element.dataset.guessed = false;
element.classList.add("btn-info");
element.classList.remove("btn-danger");
element.classList.remove("btn-success");
});
appState.solved = false;
appState.guesses = 0;
}
function setSolution(current, alternatives) {
let toneDetailsEl = document.getElementById("tone-details");
let alternativeTonesEl = document.getElementById("alternative-tones");
toneDetailsEl.innerHTML = `<b>${current.pinyin} ${current.tone}</b> - [<a href="https://tone.lib.msu.edu/tone/${current.id}" target="_blank" title="Tone Perfect: ${current.syllable}${current.tone} ${current.id}">tone details</a>]`;
for (let i=0; i < 5; i++) {
let btn = document.getElementById("btn-alternative" + String(i+1));
if (btn) {
if (alternatives[i]) {
btn.classList.remove("collapse");
btn.dataset.playid = alternatives[i];
btn.title = `Tone Perfect: ${current.syllable}${current.tone} ${alternatives[i]}`;
}
else {
btn.classList.add("collapse");
btn.dataset.playid = 0;
}
}
}
}
function updateScore(scoreID, session) {
let scoreEl = document.getElementById(scoreID);
let ordinalNumbers = ["1st", "2nd", "3rd", "4th"];
let scoreText = `<b>Session progress:</b><br> ${appState.session.rounds} syllables solved, ${appState.session.goodGuesses} good guesses out of ${appState.session.guesses} (${Math.round((appState.session.goodGuesses / appState.session.guesses)*100)} %)<br>`;
// Generate list of solved pinyins
for (let i = 0; i < session.answers.length; i ++) {
scoreText += `Solved on ${ordinalNumbers[i]} guess: `;
let pinyins = [];
for (let pinyin of session.answers[i]) {
pinyins.push(`<a href="https://tone.lib.msu.edu/tone/${pinyin.id}" target="_blank" title="Tone Perfect: ${pinyin.syllable}${pinyin.tone} ${pinyin.id}">${pinyin.pinyin} ${pinyin.tone}</a>`);
}
scoreText += pinyins.join(", ") + "<br>";
}
scoreText += `<b>Guessed on the first try:</b><br>`;
// Calculate success rate for all tones
let tonesGuessed1st = [0,0,0,0];
let tonesAll = [0,0,0,0];
// count tones guessed on the 1st try
for (let pinyin of session.answers[0]) {
tonesGuessed1st[pinyin.tone-1]++;
}
// count all tones on given session
for (let i = 0; i < tonesAll.length; i++) {
for (let pinyin of session.answers[i]) {
tonesAll[pinyin.tone-1]++;
}
}
for (let i = 0; i < tonesAll.length; i++) {
let rating;
if (tonesAll[i] != 0) {
scoreText += `Tone ${i+1}: ${Math.round(tonesGuessed1st[i]/tonesAll[i]*100)} %<br>`;
}
}
scoreEl.innerHTML = scoreText;
}
// Select answer 1-4
function selectAnswer(index) {
if (appState.solved || !appState.lastPlayed) {
return; // already solved or didn't play tone yet
}
let solutionEl = document.getElementById("solution");
let statusEl = document.getElementById("status");
let buttons = getAnswerButtons();
if (buttons[index-1].dataset.guessed == "true") {
return; // already used this answer in this round
}
appState.guesses++;
appState.session.guesses++;
buttons[index-1].dataset.guessed = true;
// Correct answer
if (index === appState.lastPlayed.tone) {
buttons[index-1].classList.add("btn-success");
buttons[index-1].classList.remove("btn-info");
solutionEl.classList.add("show"); // Show solution
appState.session.goodGuesses++;
if (appState.guesses > 1) {
if (appState.guesses < 4) {
statusEl.innerHTML = "Correct! 😀 " + appState.guesses + " guesses. Try another one!";
}
else {
// Too bad
statusEl.innerHTML = "Correct! But " + appState.guesses + " guesses. 😞 Better luck next time!";
}
}
else {
statusEl.innerHTML = "Correct! 😀 Try another one!";
}
appState.session.rounds++;
appState.session.answers[appState.guesses-1].push(appState.lastPlayed);
appState.solved = true;
}
// Incorrect answer
else {
buttons[index-1].classList.add("btn-danger");
buttons[index-1].classList.remove("btn-info");
statusEl.innerHTML = "Wrong. Guess again! 😞";
}
updateScore("session-score", appState.session);
playLastAgain();
}
function initUI() {
["btn-repeat", "btn-solution", "btn-select1", "btn-select2", "btn-select3", "btn-select4"].forEach(elementName => {
document.getElementById(elementName).disabled = true;
});
document.getElementById("btn-playnew").onclick = function(event) {
playNew();
return false;
};
document.getElementById("btn-repeat").onclick = function(event) {
playLastAgain();
return false;
};
["btn-alternative1", "btn-alternative2", "btn-alternative3", "btn-alternative4", "btn-alternative5"].forEach(elementName => {
let btn = document.getElementById(elementName);
btn.onclick = function(event) {
if (event.target && event.target.dataset && event.target.dataset.playid) {
let voiceid = parseInt(event.target.dataset.playid);
playId(voiceid);
}
else {
console.warn("Cannot find alternative playid during click event.");
}
return false;
}
});
getAnswerButtons().forEach( element => {
element.onclick = function(event) {
//console.log(event);
if (event.target && event.target.dataset && event.target.dataset.tonenumber) {
let tonenumber = event.target.dataset.tonenumber;
tonenumber = parseInt(tonenumber);
if (tonenumber == NaN) {
console.warn("Tonenumber must be number", event.target.dataset.tonenumber);
}
else {
selectAnswer(tonenumber);
}
}
else {
console.warn("Cannot find tone-number during click event.");
}
return false;
}
});
document.addEventListener("keydown", function(event) {
let keyName = event.key;
let keyCode = event.code;
//console.log("KEYDOWN", event.key, event.keyCode, event.code);
if (keyCode === "Digit8" || keyCode === "Numpad8" || (keyCode === "KeyP" && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey)) {
playNew();
}
else if (keyCode === "Digit5" || keyCode === "Numpad5" || (keyCode === "KeyR" && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey)) {
playLastAgain();
}
else if (keyCode === "Digit6" || keyCode === "Numpad6" || (keyCode === "KeyA" && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey)) {
document.getElementById("btn-solution").click();
}
else if (keyCode === "Digit1" || keyCode === "Numpad1") {
document.getElementById("btn-select1").click();
}
else if (keyCode === "Digit2" || keyCode === "Numpad2") {
document.getElementById("btn-select2").click();
}
else if (keyCode === "Digit3" || keyCode === "Numpad3") {
document.getElementById("btn-select3").click();
}
else if (keyCode === "Digit4" || keyCode === "Numpad4") {
document.getElementById("btn-select4").click();
}
}, false);
}
loadAppData(appData);
initUI();
</script>