-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.htm
More file actions
665 lines (589 loc) · 33.7 KB
/
index.htm
File metadata and controls
665 lines (589 loc) · 33.7 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
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
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
<!DOCTYPE html>
<html lang="en">
<head>
<title>Azure Text to Speech</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
<meta charset="utf-8" />
<style>
mark {
background-color: yellow;
color: black;
padding: 0;
}
#highlightDiv {
overflow: scroll;
height: 200px;
}
</style>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
</head>
<body class="bg-primary bg-blue">
<div class="container bg-white shadow">
<div class="col-12 col-md-10 p-3">
<div id="warning">
<h1 style="font-weight:500;">Speech Speech SDK not found
(microsoft.cognitiveservices.speech.sdk.bundle.js missing).</h1>
</div>
<div id="content">
<p class="display-6">Text to Audio / Text to MP3 Audio File</p>
<div class="accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Change settings such as language, etc...
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne"
data-bs-parent="#accordionExample">
<div class="accordion-body">
<label for="subscriptionKey" class="form-label">Azure Speech Service Subscription
Key</label>
<input type="password" class="form-control" id="subscriptionKey"
placeholder="YourSubscriptionKey">
<label for="regionOptions" class="form-label">Azure Service Region</label>
<!-- see https://aka.ms/csspeech/region for more details-->
<select id="regionOptions" class="form-select mb-1">
<option value="westus" selected="selected">West US</option>
<option value="westus2">West US2</option>
<option value="eastus">East US</option>
<option value="eastus2">East US2</option>
<option value="centralus">Central US</option>
<option value="northcentralus">North Central US</option>
<option value="southcentralus">South Central US</option>
<option value="westcentralus">West Central US</option>
<option value="canadacentral">Canada Central</option>
<option value="brazilsouth">Brazil South</option>
<option value="eastasia">East Asia</option>
<option value="southeastasia">South East Asia</option>
<option value="australiaeast">Australia East</option>
<option value="centralindia">Central India</option>
<option value="japaneast">Japan East</option>
<option value="japanwest">Japan West</option>
<option value="koreacentral">Korea Central</option>
<option value="northeurope">North Europe</option>
<option value="westeurope">West Europe</option>
<option value="francecentral">France Central</option>
<option value="uksouth">UK South</option>
<option value="chinaeast2">China East2 (azure.cn)</option>
</select>
<button id="updateVoiceListButton" class="btn btn-primary">Update Voice
List</button><br />
<label for="voiceOptions" class="form-label">Select Voice</label>
<select id="voiceOptions" class="form-select" disabled>
<option>Please update voice list first.</option>
</select>
</div>
</div>
</div>
<label for="synthesisText" class="form-label">Text to Transcribe</label>
<textarea rows="10" cols="50" class="form-control mb-1" id="synthesisText" autocomplete="off"
autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
<div class="btn-group" role="group" aria-label="Basic example">
<button id="startSynthesisAsyncButton" class="btn btn-primary">▶️ Start synthesis</button>
<button id="pauseButton" class="btn btn-primary">⏹️ Pause</button>
<button id="resumeButton" class="btn btn-primary">▶️ Resume</button>
<button id="downloadButton" class="btn btn-primary" data-bs-toggle="tooltip" data-bs-placement="top"
title="Download MP3 of the audio">🔽 Download</button>
<button type="button" id="stripButton" data-bs-toggle="tooltip" data-bs-placement="top"
title="Attempts to remove Bible verse numbers from text. Configured for Malay and Indonesian" class="btn btn-primary">📝 Strip verse #s</button>
<button type="button" data-bs-toggle="tooltip" data-bs-placement="top"
title="Replace Bible book abbreviations with full name. Configured for Malay and Indonesian" id="replaceAbbreviatedBooksButton"
class="btn btn-primary">📝
Replace book abbrs</button></div>
<br />
<label for="resultsDiv" class="form-label mt-2">Results:</label><br />
<label for="highlightDiv" class="form-label"></label>
<div id="highlightDiv" class="d-inline-block mt-1 mb-1"></div>
<textarea id="resultsDiv" class="form-control" readonly></textarea>
<label for="eventsDiv" class="form-label">Events</label>
<textarea id="eventsDiv" readonly class="form-control"></textarea>
<label for="isSSML" class="invisible">Is SSML</label>
<input type="checkbox" class="invisible" id="isSSML" name="isSSML" value="ssml">
</div>
</div>
<p>Warren Churulich - <a href="https://iamwarren.us">https://iamwarren.us</a></p>
</div>
<!-- Speech SDK reference sdk. -->
<script src="/scripts/microsoft.cognitiveservices.speech.sdk.bundle.js"></script>
<!-- Speech SDK USAGE -->
<script>
// On document load resolve the Speech SDK dependency
function Initialize(onComplete) {
if (!!window.SpeechSDK) {
document.getElementById('content').style.display = 'block';
document.getElementById('warning').style.display = 'none';
onComplete(window.SpeechSDK);
}
}
</script>
<!-- Browser Hooks -->
<script>
// status fields and start button in UI
var resultsDiv, eventsDiv;
var highlightDiv;
var startSynthesisAsyncButton, pauseButton, resumeButton, downloadButton;
var updateVoiceListButton;
// subscription key and region for speech services.
var subscriptionKey, regionOptions;
var authorizationToken;
var voiceOptions, isSsml;
var SpeechSDK;
var synthesisText;
var synthesizer;
var player;
var wordBoundaryList = [];
var voiceList = null;
document.addEventListener("DOMContentLoaded", function () {
startSynthesisAsyncButton = document.getElementById("startSynthesisAsyncButton");
updateVoiceListButton = document.getElementById("updateVoiceListButton");
pauseButton = document.getElementById("pauseButton");
resumeButton = document.getElementById("resumeButton");
downloadButton = document.getElementById("downloadButton");
subscriptionKey = document.getElementById("subscriptionKey");
regionOptions = document.getElementById("regionOptions");
resultsDiv = document.getElementById("resultsDiv");
eventsDiv = document.getElementById("eventsDiv");
voiceOptions = document.getElementById("voiceOptions");
isSsml = document.getElementById("isSSML");
highlightDiv = document.getElementById("highlightDiv");
synthesisText = document.getElementById("synthesisText");
loadLastUsedParameters();
setInterval(function () {
if (player !== undefined) {
const currentTime = player.currentTime;
var wordBoundary;
for (const e of wordBoundaryList) {
if (currentTime * 1000 > e.audioOffset / 10000) {
wordBoundary = e;
} else {
break;
}
}
if (wordBoundary !== undefined) {
highlightDiv.innerHTML = synthesisText.value.substr(0, wordBoundary.textOffset) +
"<mark id='highlighted-word'>" + wordBoundary.text.trim() + "</mark>" +
synthesisText.value.substr(wordBoundary.textOffset + wordBoundary.wordLength);
// Navigate to the highlighted word.
document.getElementById('highlighted-word').scrollIntoView();
} else {
highlightDiv.innerHTML = synthesisText.value;
}
}
}, 150);
updateVoiceListButton.addEventListener("click", function () {
var request = new XMLHttpRequest();
request.open('GET',
'https://' + regionOptions.value + ".tts.speech." +
(regionOptions.value.startsWith("china") ? "azure.cn" : "microsoft.com") +
"/cognitiveservices/voices/list", true);
if (authorizationToken) {
request.setRequestHeader("Authorization", "Bearer " + authorizationToken);
} else {
if (subscriptionKey.value === "" || subscriptionKey.value === "subscription") {
alert("Please enter your Microsoft Cognitive Services Speech subscription key!");
return;
}
request.setRequestHeader("Ocp-Apim-Subscription-Key", subscriptionKey.value);
}
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
const response = this.response;
voiceList = response;
rememberLastUsedParameters();
loadVoiceList(response);
} else {
window.console.log(this);
eventsDiv.innerHTML += "cannot get voice list, code: " + this.status + " detail: " + this.statusText + "\r\n";
}
};
request.send()
});
pauseButton.addEventListener("click", function () {
player.pause();
pauseButton.disabled = true;
resumeButton.disabled = false;
});
resumeButton.addEventListener("click", function () {
player.resume();
pauseButton.disabled = false;
resumeButton.disabled = true;
});
startSynthesisAsyncButton.addEventListener("click", function () {
startSynthesisAsyncButton.disabled = true;
downloadButton.disabled = true;
resultsDiv.innerHTML = "";
eventsDiv.innerHTML = "";
wordBoundaryList = [];
synthesisText = document.getElementById("synthesisText");
// if we got an authorization token, use the token. Otherwise use the provided subscription key
var speechConfig;
if (authorizationToken) {
speechConfig = SpeechSDK.SpeechConfig.fromAuthorizationToken(authorizationToken, regionOptions.value);
} else {
if (subscriptionKey.value === "" || subscriptionKey.value === "subscription") {
alert("Please enter your Microsoft Cognitive Services Speech subscription key!");
return;
}
speechConfig = SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey.value, regionOptions.value);
}
speechConfig.speechSynthesisVoiceName = voiceOptions.value;
speechConfig.sp
player = new SpeechSDK.SpeakerAudioDestination();
player.onAudioEnd = function (_) {
window.console.log("playback finished");
eventsDiv.innerHTML += "playback finished" + "\r\n";
startSynthesisAsyncButton.disabled = false;
downloadButton.disabled = false;
pauseButton.disabled = true;
resumeButton.disabled = true;
wordBoundaryList = [];
};
var audioConfig = SpeechSDK.AudioConfig.fromSpeakerOutput(player);
synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, audioConfig);
// The event synthesizing signals that a synthesized audio chunk is received.
// You will receive one or more synthesizing events as a speech phrase is synthesized.
// You can use this callback to streaming receive the synthesized audio.
synthesizer.synthesizing = function (s, e) {
window.console.log(e);
eventsDiv.innerHTML += "(synthesizing) Reason: " + SpeechSDK.ResultReason[e.result.reason] +
"Audio chunk length: " + e.result.audioData.byteLength + "\r\n";
};
// The synthesis started event signals that the synthesis is started.
synthesizer.synthesisStarted = function (s, e) {
window.console.log(e);
eventsDiv.innerHTML += "(synthesis started)" + "\r\n";
pauseButton.disabled = false;
};
// The event synthesis completed signals that the synthesis is completed.
synthesizer.synthesisCompleted = function (s, e) {
console.log(e);
eventsDiv.innerHTML += "(synthesized) Reason: " + SpeechSDK.ResultReason[e.result.reason] +
" Audio length: " + e.result.audioData.byteLength + "\r\n";
};
// The event signals that the service has stopped processing speech.
// This can happen when an error is encountered.
synthesizer.SynthesisCanceled = function (s, e) {
const cancellationDetails = SpeechSDK.CancellationDetails.fromResult(e.result);
let str = "(cancel) Reason: " + SpeechSDK.CancellationReason[cancellationDetails.reason];
if (cancellationDetails.reason === SpeechSDK.CancellationReason.Error) {
str += ": " + e.result.errorDetails;
}
window.console.log(e);
eventsDiv.innerHTML += str + "\r\n";
startSynthesisAsyncButton.disabled = false;
downloadButton.disabled = false;
pauseButton.disabled = true;
resumeButton.disabled = true;
};
// This event signals that word boundary is received. This indicates the audio boundary of each word.
// The unit of e.audioOffset is tick (1 tick = 100 nanoseconds), divide by 10,000 to convert to milliseconds.
synthesizer.wordBoundary = function (s, e) {
window.console.log(e);
eventsDiv.innerHTML += "(WordBoundary), Text: " + e.text + ", Audio offset: " + e.audioOffset / 10000 + "ms." + "\r\n";
wordBoundaryList.push(e);
};
const complete_cb = function (result) {
if (result.reason === SpeechSDK.ResultReason.SynthesizingAudioCompleted) {
resultsDiv.innerHTML += "synthesis finished";
} else if (result.reason === SpeechSDK.ResultReason.Canceled) {
resultsDiv.innerHTML += "synthesis failed. Error detail: " + result.errorDetails;
}
window.console.log(result);
synthesizer.close();
synthesizer = undefined;
};
const err_cb = function (err) {
startSynthesisAsyncButton.disabled = false;
downloadButton.disabled = false;
phraseDiv.innerHTML += err;
window.console.log(err);
synthesizer.close();
synthesizer = undefined;
};
if (isSsml.checked) {
synthesizer.speakSsmlAsync(synthesisText.value,
complete_cb,
err_cb);
} else {
synthesizer.speakTextAsync(synthesisText.value,
complete_cb,
err_cb);
}
});
downloadButton.addEventListener("click", function () {
downloadButton.innerText = "⌛Download";
startSynthesisAsyncButton.disabled = true;
downloadButton.disabled = true;
resultsDiv.innerHTML = "";
eventsDiv.innerHTML = "";
synthesisText = document.getElementById("synthesisText");
var speechConfig,
audioConfig,
outputStream,
pushStreamCallback,
wavFragments = {},
currentFragment = 0;
// if we got an authorization token, use the token. Otherwise use the provided subscription key
if (authorizationToken) {
speechConfig = SpeechSDK.SpeechConfig.fromAuthorizationToken(authorizationToken, regionOptions.value);
} else {
if (subscriptionKey.value === "" || subscriptionKey.value === "subscription") {
alert("Please enter your Microsoft Cognitive Services Speech subscription key!");
return;
}
speechConfig = SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey.value, regionOptions.value);
speechConfig.speechSynthesisVoiceName = voiceOptions.value;
speechConfig.SpeechSynthesisOutputFormat = SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3;
}
pushStreamCallback = {
write: function (dataBuffer) {
wavFragments[currentFragment] = dataBuffer;
currentFragment += 1;
},
close: function () {
var byteCount = 0,
sentAudio,
a,
url;
for (i = 0; i < currentFragment; i += 1) {
byteCount += wavFragments[i].byteLength;
}
// Output array.
sentAudio = new window.Uint8Array(byteCount);
byteCount = 0;
for (i = 0; i < currentFragment; i += 1) {
sentAudio.set(new window.Uint8Array(wavFragments[i]), byteCount);
byteCount += wavFragments[i].byteLength;
}
a = document.createElement('a');
url = window.URL.createObjectURL(new Blob([sentAudio]));
a.href = url;
a.download = 'synth.mp3';
document.body.appendChild(a);
a.click();
setTimeout(function () {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 0);
}
};
outputStream = SpeechSDK.PushAudioOutputStream.create(pushStreamCallback);
audioConfig = SpeechSDK.AudioConfig.fromStreamOutput(outputStream);
synthesizer = new SpeechSDK.SpeechSynthesizer(speechConfig, audioConfig);
synthesizer.SynthesisCanceled = function (s, e) {
const cancellationDetails = SpeechSDK.CancellationDetails.fromResult(e.result);
let str = "(cancel) Reason: " + SpeechSDK.CancellationReason[cancellationDetails.reason];
if (cancellationDetails.reason === SpeechSDK.CancellationReason.Error) {
str += ": " + e.result.errorDetails;
}
window.console.log(e);
eventsDiv.innerHTML += str + "\r\n";
resultsDiv.innerHTML = str;
startSynthesisAsyncButton.disabled = false;
downloadButton.disabled = false;
pauseButton.disabled = true;
resumeButton.disabled = true;
};
synthesizer.synthesisCompleted = function () {
resultsDiv.innerHTML = "synthesis finished";
synthesizer.close();
startSynthesisAsyncButton.disabled = false;
downloadButton.disabled = false;
downloadButton.innerText = "🔽 Download";
};
if (isSsml.checked) {
synthesizer.speakSsmlAsync(synthesisText.value);
} else {
synthesizer.speakTextAsync(synthesisText.value);
}
});
Initialize(function (speechSdk) {
SpeechSDK = speechSdk;
startSynthesisAsyncButton.disabled = false;
downloadButton.disabled = false;
pauseButton.disabled = true;
resumeButton.disabled = true;
// in case we have a function for getting an authorization token, call it.
if (typeof RequestAuthorizationToken === "function") {
RequestAuthorizationToken();
}
});
function rememberLastUsedParameters() {
if (typeof (Storage) !== "undefined") {
localStorage.azureKey = subscriptionKey.value;
localStorage.regionOptions = regionOptions.value;
// localStorage.language = languageInput.value;
if (voiceList !== null) {
localStorage.voiceList = voiceList;
}
localStorage.selectedVoice = voiceOptions.selectedIndex;
localStorage.synthesisText = synthesisText.value;
}
}
function loadLastUsedParameters() {
if (typeof (Storage) !== "undefined") {
if (localStorage.azureKey) {
subscriptionKey.value = localStorage.azureKey;
}
if (localStorage.regionOptions) {
regionOptions.value = localStorage.regionOptions;
}
if (localStorage.voiceList) {
var response = localStorage.voiceList;
loadVoiceList(response);
if (localStorage.selectedVoice) {
// Try to select the last used value.
voiceOptions.selectedIndex = localStorage.selectedVoice;
}
}
if (localStorage.synthesisText) {
synthesisText.value = localStorage.synthesisText;
}
}
}
// This will make any text input be saved for future use.
subscriptionKey.addEventListener("input", () => {
rememberLastUsedParameters();
});
regionOptions.addEventListener("input", () => {
rememberLastUsedParameters();
});
synthesisText.addEventListener("input", () => {
rememberLastUsedParameters();
});
voiceOptions.addEventListener("change", () => {
rememberLastUsedParameters();
});
stripButton.addEventListener("click", () => {
stripVerseNumbers();
rememberLastUsedParameters();
});
replaceAbbreviatedBooksButton.addEventListener("click", () => {
replaceAbbreviatedBooks();
rememberLastUsedParameters();
});
});
function loadVoiceList(response) {
const neuralSupport = (response.indexOf("AriaNeural") > 0);
const defaultVoice = neuralSupport ? "AriaNeural" : "AriaRUS";
let selectId;
const data = JSON.parse(response);
voiceOptions.innerHTML = "";
data.forEach((voice, index) => {
voiceOptions.innerHTML += "<option value=\"" + voice.Name + "\">" + voice.LocaleName + " " + voice.LocalName + " Gender:" + voice.Gender + " Voice: " + voice.ShortName + "</option>";
if (voice.Name.indexOf("AriaNeural") > 0) {
selectId = index;
}
});
voiceOptions.selectedIndex = selectId;
voiceOptions.disabled = false;
}
// Strip verse number from text. The issue is if there are numbers in the verse such as: Biarpun aku mempunyai 60 orang permaisuri Dan 80 orang gundik
function stripVerseNumbers() {
// Try to remove digits that have a symbol in front of them.
synthesisText.value = synthesisText.value.replace(/([,“”".;?!])\d+/g, "$1");
//textInput.value = textInput.value.replace(/(\.\s)\d+/g, "$1");
// Try to remove digits that have a symbol then a space preceding them.
synthesisText.value = synthesisText.value.replace(/([,“”".;?!]\s)\d+/g, "$1");
eventsDiv.innerHTML += "Stripped verse numbers from the text." + "\r\n";
}
function replaceAbbreviatedBooks() {
let res = synthesisText.value;
myObject = {
Kej: "Kejadian",
Kel: "Keluaran",
Im: "Imamat",
Bil: "Bilangan",
Ul: "Ulangan",
Yos: "Yosua",
Hak: "Hakim-Hakim",
Rut: "Rut",
['1 Sam']: "1 Samuel",
['2 Sam']: "2 Samuel",
['1 Raj']: "1 Raja-Raja",
['2 Raj']: "2 Raja-Raja",
['1 Taw']: "1 Tawarikh",
['2 Taw']: "2 Tawarikh",
Ezr: "Ezra",
Neh: "Nehemia",
Est: "Ester",
Ayb: "Ayub",
Mz: "Mazmur",
Mzm: "Mazmur",
Ams: "Amsal",
Pkh: "Pengkhotbah",
Kid: "Kidung Agung",
Yes: "Yesaya",
Yer: "Yeremia",
Rat: "Ratapan",
Yeh: "Yehezkiel",
Dan: "Daniel",
Hos: "Hosea",
Yl: "Yoel",
Am: "Amos",
Ob: "Obaja",
Yun: "Yunus",
Mi: "Mikha",
Nah: "Nahum",
Hab: "Habakuk",
Zef: "Zefanya",
Hag: "Hagai",
Za: "Zakharia",
Mal: "Maleakhi",
Mat: "Matius",
Mrk: "Markus",
Luk: "Lukas",
Yoh: "Yohanes",
Kis: "Kisah",
Rm: "Roma",
['1 Kor']: "1 Korintus",
['2 Kor']: "2 Korintus",
Gal: "Galatia",
Ef: "Efesus",
Flp: "Filipi",
Kol: "Kolose",
['1 Tes']: "1 Tesalonika",
['2 Tes']: "2 Tesalonika",
['1 Tim']: " 1 Timotius",
['2 Tim']: " 2 Timotius",
Tit: "Titus",
Flm: "Filemon",
Ibr: "Ibrani",
Yak: "Yakobus",
['1 Ptr']: "1 Petrus",
['2 Ptr']: "2 Petrus",
['1 Yoh']: "1 Yohanes",
['2 Yoh']: "2 Yohanes",
['3 Yoh']: "3 Yohanes",
Yud: "Yudas",
Why: "Wahyu"
}
// Replace any abbreviations.
// es7
Object.keys(myObject).forEach(key => {
res = res.replaceAll(`${key}.`, myObject[key]);
console.log(key, myObject[key]) // key , value
})
synthesisText.value = res;
eventsDiv.innerHTML += "Replaced abbreviated books from the text." + "\r\n";
}
// Enable tooltips everywhere
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
</script>
</body>
</html>