-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnstranscripts.html
607 lines (533 loc) · 22.5 KB
/
snstranscripts.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://getbootstrap.com/docs/5.3/assets/css/docs.css" rel="stylesheet">
<title>SNS trascrizioni</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"
integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm"
crossorigin="anonymous"></script>
</head>
<style>
.main-div {
margin-top: 5px;
margin-bottom: 5px;
}
.curationSpanStyle {
border: solid;
border-width: 1px;
border-color: aliceblue;
color: aliceblue;
text-align: center;
font-size: 10px;
vertical-align: middle;
}
</style>
<!-- static html content -->
<body id="body">
<!-- curation info modal -->
<div class="modal fade" id="curation-info-modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div id="curation-info-modal-header" class="modal-header">
<h6 id="info-modal" class="modal-title"></h6>
<button type="button" class="btn btn-close bg-light text-light" data-bs-dismiss="modal" aria-label="Chiudi"></button>
</div>
</div>
</div>
</div>
<!-- successful save text modal -->
<div class="modal fade" id="success-modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div id="success-modal-header" class="modal-header bg-success bg-gradient border border-success text-light">
<h5 class="modal-title">Trascrizione salvata con successo!</h5>
<button type="button" class="btn-close bg-light text-light" data-bs-dismiss="modal" aria-label="Chiudi"></button>
</div>
</div>
</div>
</div>
<!-- empty search warning modal -->
<div class="modal fade" id="search-warning-modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-warning text-light">
<h5 class="modal-title">Attenzione!</h5>
<button type="button" class="btn-close bg-light text-light" data-bs-dismiss="modal" aria-label="Chiudi"></button>
</div>
<div class="modal-body">
<p id="search-warning-message">Nessun video trovato con i criteri dati."</p>
</div>
<div class="modal-footer">
<button id="" type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Chiudi</button>
</div>
</div>
</div>
</div>
<!-- warning modal -->
<div class="modal fade" id="warning-modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-warning text-light">
<h5 class="modal-title">Attenzione!</h5>
<button type="button" class="btn-close bg-light text-light" data-bs-dismiss="modal" aria-label="Chiudi"></button>
</div>
<div class="modal-body">
<p id="warning-message">Alcuni testi sono in fase di modifica.<br>Le modifiche non salvate verranno perse.<br><br>Continuare?</p>
</div>
<div class="modal-footer">
<button id="warning-modal-no-btn" type="button" class="btn btn-secondary btn"
data-bs-dismiss="modal">No</button>
<button id="warning-modal-yes-btn" type="button" class="btn btn-primary btn"
data-bs-dismiss="modal">Sì</button>
</div>
</div>
</div>
</div>
<!-- error modal -->
<div class="modal fade" id="error-modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-danger text-light">
<h5 class="modal-title">ERRORE!</h5>
<button type="button" class="btn-close bg-light text-light" data-bs-dismiss="modal" aria-label="Chiudi"></button>
</div>
<div class="modal-body">
<p id="error-message"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-sm" data-bs-dismiss="modal">Chiudi</button>
</div>
</div>
</div>
</div>
<!-- name insertion modal -->
<div class="modal fade" id="curator-modal" tabindex="-1" aria-labelledby="nameModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="nameModalLabel">Chi ha curato questa trascrizione?</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="curator-input" required>Nome/i*</span>
</div>
<input id="curator-input-text" type="text" class="form-control" aria-label="Default"
aria-describedby="curator-input" required>
</div>
<span><i>* campo obbligatorio</i></span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annulla</button>
<button type="button" id="curator-modal-ok-btn" class="btn btn-primary">Ok</button>
</div>
</div>
</div>
</div>
<!-- password insertion modal -->
<div class="modal fade" id="pwd-modal" tabindex="-1" aria-labelledby="pwdModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="pwdModalLabel">Inserisci la password necessaria per la modifica dei
contenuti.</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="pwd-input">Password*</span>
</div>
<input id="pwd-input-text" type="password" class="form-control" aria-label="Default"
aria-describedby="pwd-input" required>
</div>
<span><i>* campo obbligatorio</i></span>
</div>
<!-- Footer with buttons -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annulla</button>
<button type="button" id="pwdModalOkBtn" class="btn btn-primary">Ok</button>
</div>
</div>
</div>
</div>
<!-- create main div for button row -->
<div id="main-div" class="sticky-top mt-2 mb-2 ml-0 mr-0">
<div class="container main-div bg-white">
<div class="row justify-content-md-center">
<button class="btn btn-sm btn-outline-dark rounded-pill col-2" onclick='window.location.reload();'><i
class='bi bi-arrow-repeat'></i></button>
<button id="openAllBtn" class="btn btn-sm btn-outline-success rounded-pill col-3 p-0">Apri tutti</button>
<button id="closeAllBtn" class="btn btn-sm btn-outline-success rounded-pill p-0 col-3">Chiudi
tutti</button>
<button class="btn btn-sm btn-outline-dark rounded-pill col-2" onclick='window.scrollTo(0, 0)'><i
class='bi bi-arrow-up'></i></button>
<button class="btn btn-sm btn-outline-dark rounded-pill col-2"
onclick='window.scrollTo(0, document.body.scrollHeight)'><i class='bi bi-arrow-down '></i></button>
</div>
<div class="input-group mt-2">
<input id="search-input" type="text" class="form-control" placeholder="Testo da cercare"
aria-label="search-text" aria-describedby="basic-addon2">
<div class="input-group-append">
<button id="search-button" class="btn btn-outline-secondary" type="button"><i
class="bi bi-search"></i></button>
<button id="restore-button" class="btn btn-outline-secondary" type="button"><i
class="bi bi-eraser-fill"></i></button>
</div>
</div>
</div>
</div>
<div class="" id="all-collapse-div"></div>
<div id="spinner" class="d-flex justify-content-center" style="margin-top: 30px;">
<div class="spinner-grow text-primary" role="status">
</div>
</div>
</body>
<script>
let lastClickedModifyId = "";
localStorage.setItem('pwd', "");
let curationInfo = "";
let sessionId = (Math.random() + ' ').substring(2, 10) + (Math.random() + ' ').substring(2, 10);
localStorage.setItem("sessionId", sessionId);
let fadeInTime = 700;
if (window.location.href.includes("https://lbologna.github.io")) {
mainurl = "https://lucaleonardobologna.it";
} else if (window.location.href.includes("http://127.0.0.1:")) {
mainurl = "http://127.0.0.1:5000";
}
let transcriptUrl = mainurl + "/snstranscripts/";
let saveUrl = mainurl + "/savesnstranscripts/";
let checkUrl = mainurl + "/checkpwd/";
let modifyColorStyle = "background-color:rgb(240,240,245); color:rgb(0,0,90)";
let currentSaveBtnId = "";
let snsTranscript
let jsonSnSTranscript;
let snsVideoInfo;
let snsVideoJson;
$('document').ready(execute);
$("#curator-modal-ok-btn").on("click", save);
$("#openAllBtn").on("click", openAll);
$("#closeAllBtn").on("click", closeAll);
$("#pwdModalOkBtn").on("click", pwdCheck);
$("#search-button").on("click", search);
$("#restore-button").on("click", reload);
$("#warning-modal-yes-btn").on("click", reload);
async function execute() {
showSpinner();
snsTranscript = await fetch(transcriptUrl);
jsonSnSTranscript = await snsTranscript.json();
snsVideoInfo = await fetch(mainurl + "/getsnsjson/");
snsVideoJson = await snsVideoInfo.json();
await populate(snsVideoJson, jsonSnSTranscript);
hideSpinner();
}
// hide spinner icon
function showSpinner() {
$('#main-div').hide();
$('#all-collapse-div').hide();
$("#spinner").addClass("d-block");
}
// hide spinner icon
function hideSpinner() {
$("#main-div").fadeIn(fadeInTime);
$("#all-collapse-div").fadeIn(fadeInTime);
$("#spinner").addClass("d-none");
}
function populate(snsVideoJson, jsonSnSTranscript, searchText = []) {
$("#all-collapse-div")[0].innerHTML = "";
let video_id_ts_list = []
if (searchText.length != 0) {
video_id_ts_list = searchText;
} else {
video_id_ts_list = jsonSnSTranscript["video_id_ts_list"];
}
let counter = video_id_ts_list.length;
video_id_ts_list.forEach(element => {
// collapsible div
let collapseDiv = document.createElement("div");
collapseDiv.classList.add("container")
collapseDiv.setAttribute("id", "collapse-div")
collapseDiv.setAttribute("style", "margin-top:8px; margin-bottom:12px; border-bottom:solid; border-bottom-width:2px; border-bottom-color:rgb(220, 220, 250)")
// collapsible button row
let collapseBtnDiv = document.createElement("div");
collapseBtnDiv.classList.add("row");
// link buttons row
let clickBtnsDiv = document.createElement("div");
clickBtnsDiv.setAttribute("style", "margin-top:2px; margin-bottom:2px");
clickBtnsDiv.classList.add("row");
// collapsible main button
let caButton = document.createElement("a");
caButton.setAttribute("id", "cbt_" + element);
caButton.setAttribute("data-bs-toggle", "collapse")
caButton.setAttribute("href", "#".concat(element))
caButton.setAttribute("role", "button")
caButton.setAttribute("aria-expanded", "false")
caButton.setAttribute("aria-controls", element)
caButton.innerHTML = snsVideoJson[element]["title"] + " (" + snsVideoJson[element]["videoPublishedAt"].substr(0, 10) + " | ~" + jsonSnSTranscript[element]["duration"] + " min.) - #" + counter.toString();
if (jsonSnSTranscript[element]["text"].toLowerCase() == "nessuna trascrizione"){
caButton.classList.add("btn", "btn-secondary", "btn-block", "col-12")
} else {
caButton.classList.add("btn", "btn-primary", "btn-block", "col-12")
}
collapseBtnDiv.appendChild(caButton);
counter -= 1;
// text parent div
let contentDiv = document.createElement("div");
contentDiv.classList.add("collapse", "my-collapse-div")
contentDiv.setAttribute("id", element)
// text div
let textDiv = document.createElement("div");
textDiv.classList.add("card", "card-body")
textDiv.setAttribute("id", "txt_" + element)
textDiv.setAttribute("style", modifyColorStyle);
textDiv.innerHTML = jsonSnSTranscript[element]["text"]
// modify button
let modifyButton = document.createElement("button");
let modifyButtonId = "mod_" + element;
modifyButton.setAttribute("id", modifyButtonId)
modifyButton.setAttribute("type", "button");
modifyButton.innerHTML = "Modifica";
modifyButton.classList.add("btn", "btn-outline-secondary", "btn-sm", "col-4");
// save button
let saveButton = document.createElement("button");
let saveButtonId = "save_" + element;
saveButton.setAttribute("id", saveButtonId);
saveButton.setAttribute("type", "button")
saveButton.innerHTML = "Salva";
saveButton.classList.add("btn", "btn-outline-danger", "btn-sm", "col-4");
saveButton.setAttribute("disabled", "");
// video url button
let videoButton = document.createElement("button"); // video url paragraph
let videoUrl = "https://www.youtube.com/watch?v=" + element
videoButton.classList.add("btn", "btn-outline-info", "btn-sm", "col-3");
videoButton.innerHTML = "Video";
videoButton.setAttribute("onclick", "window.open('" + videoUrl + "'),'_blank'");
// curation url button
let curationButton = document.createElement("button"); // video url paragraph
curationButton.classList.add("col-1", "btn", "btn-sm", "curationSpanStyle");
curationButton.setAttribute("type", "button");
curationButton.setAttribute("id", "curinfo_" + element);
curationButton.addEventListener("click", showCurationInfo);
let curator = jsonSnSTranscript[element]["modified_by"].trim();
let curationText = "";
if (curator == "") {
curationText = "Trascrizione non curata"
fillCurationBtn(curationButton, curationText, "NC")
} else {
curationText = "Trascrizione curata da:<br>" + jsonSnSTranscript[element]["modified_by"];
fillCurationBtn(curationButton, curationText, "C");
}
clickBtnsDiv.appendChild(modifyButton);
clickBtnsDiv.appendChild(saveButton);
clickBtnsDiv.appendChild(videoButton);
clickBtnsDiv.appendChild(curationButton);
contentDiv.appendChild(textDiv)
collapseDiv.appendChild(collapseBtnDiv)
collapseDiv.appendChild(clickBtnsDiv)
collapseDiv.appendChild(contentDiv)
document.getElementById("all-collapse-div").appendChild(collapseDiv)
$("#" + modifyButtonId).on("click", pwdCheck);
$("#" + saveButtonId).on("click", showCuratorModal);
//document.getElementById(modifyButtonId).onclick = modifyCheck;
//document.getElementById(saveButtonId).onclick = showCuratorModal;
})
}
// reload page and clear search box
async function reload() {
if (this.id == "restore-button") {
let allOpenedDivs = document.querySelectorAll(".editable");
if (allOpenedDivs.length != 0) {
$("#warning-modal").modal("show");
} else {
$("#search-input").val("");
$("#curator-input").val("");
await populate(snsVideoJson, jsonSnSTranscript);
}
} else {
$("#search-input").val("");
$("#curator-input").val("");
await populate(snsVideoJson, jsonSnSTranscript);
}
}
function getIndicesOf(searchStr, str, caseSensitive) {
var searchStrLen = searchStr.length;
if (searchStrLen == 0) {
return [];
}
var startIndex = 0, index, indices = [];
if (!caseSensitive) {
str = str.toLowerCase();
searchStr = searchStr.toLowerCase();
}
while ((index = str.indexOf(searchStr, startIndex)) > -1) {
indices.push(index);
startIndex = index + searchStrLen;
}
return indices;
}
// search input text in content
function search() {
let searchText = $("#search-input").val();
let searchTsList = [];
let video_id_ts_list = jsonSnSTranscript["video_id_ts_list"]
let counter = 0;
video_id_ts_list.forEach(element => {
let crrText = jsonSnSTranscript[element]["text"];
let crrTitle = snsVideoJson[element]["title"];
if (crrText.toLowerCase().includes(searchText.toLowerCase()) || crrTitle.toLowerCase().includes(searchText.toLowerCase())) {
searchTsList.push(element);
}
});
if (searchTsList.length == 0) {
$("#search-warning-message")[0].innerHTML = "Nessun video trovato con la chiave di ricerca data.";
$("#search-warning-modal").modal("show");
populate(snsVideoJson, jsonSnSTranscript);
} else {
populate(snsVideoJson, jsonSnSTranscript, searchText = searchTsList);
}
}
// fill content of curation buttons
function fillCurationBtn(element, text, status) {
if (status == "NC") {
element.classList.remove("bg-success");
element.classList.add("bg-secondary");
} else {
element.classList.remove("bg-secondary");
element.classList.add("bg-success");
}
element.setAttribute("title", text);
element.innerHTML = status;
}
// check password
async function pwdCheck() {
let pwd = document.getElementById('pwd-input-text').value;
const request = new Request(checkUrl, {
headers: {
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({ "pwd": pwd, "sessionId": sessionId }),
});
// read response
const checkResponse = await fetch(request);
const checkResponseJson = await checkResponse.json();
//let names = document.getElementById('curator-input-text').value;
if (this.id.substring(0, 4) == "mod_") {
lastClickedModifyId = this.id;
if (checkResponseJson["responseStatus"] == "ok") {
enableModifyContentDiv(lastClickedModifyId);
return
} else {
$('#pwd-modal').modal('show');
}
} else { // request comes from password modal
if (checkResponseJson["responseStatus"] == "ok") {
$('#pwd-modal').modal('hide'); // hide password insertion modal
// activate corresponding "Salva" button
enableModifyContentDiv(lastClickedModifyId);
} else {
$('#pwd-modal').modal('hide');
$('#error-modal').modal('show');
$('#error-message')[0].innerHTML = "Password errata o assente!";
}
}
}
// enable text div for modification
function enableModifyContentDiv(currentElId) {
let key = extractElementId(currentElId);
let textDivId = "#txt_" + key;
let contentDivId = "#" + key;
let currentSaveBtnId = "#save_" + key;
$(contentDivId).addClass("show");
$(textDivId).css({ "background-color": "white", "color": "black" });
$(textDivId).attr("contenteditable", true);
$(textDivId).addClass("editable");
$(currentSaveBtnId).attr("disabled", false);
}
// check password before saving
function showCuratorModal() {
currentSaveBtnId = this.id;
$('#curator-modal').modal('show');
}
// save new content to transcripts file
async function save() {
let curatorName = $("#curator-input-text").val();
if (curatorName.trim() == "") {
$("#curator-modal").modal('hide');
$('#error-modal').modal('show');
$('#error-message')[0].innerHTML = "Il campo 'Nome/i' è obbligatorio!";
} else {
let key = extractElementId(currentSaveBtnId);
let textDivId = "#txt_" + key;
$("#save_" + key).attr("disabled", true);
$(textDivId).attr("style", modifyColorStyle);
$(textDivId).attr("contenteditable", false);
$(textDivId).removeClass("editable");
let crrCurationButton = $("#curinfo_" + key)[0]
fillCurationBtn(crrCurationButton, "Trascrizione curata da:<br>" + curatorName, "C")
const request = new Request(saveUrl, {
headers: {
"Content-Type": "application/json",
},
method: "POST",
body: JSON.stringify({ "id": key, "text": $(textDivId)[0].innerHTML, "curator": curatorName }),
});
const checkResponse = await fetch(request);
const checkResponseJson = await checkResponse.json();
$("#curator-modal").modal('hide');
$('#success-modal').modal('show');
setTimeout(() => $('#success-modal').modal('hide'), 2200);
}
}
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
// open all text panels
async function openAll() {
showSpinner();
let allDivs = document.querySelectorAll(".my-collapse-div");
allDivs.forEach(item => { item.classList.add("show")});
hideSpinner();
}
// close all text panels
function closeAll() {
let allDivs = document.querySelectorAll(".my-collapse-div");
allDivs.forEach(item => { item.classList.remove("show") })
}
// show modal with curators name(s)
function showCurationInfo() {
document.getElementById("info-modal").innerHTML = this.title;
let status = this.innerHTML;
if (status == "C") {
$('#curation-info-modal-header').removeClass("bg-secondary text-light");
$('#curation-info-modal-header').addClass("bg-success text-light");
$('#curation-info-modal-header').removeClass("border-secondary");
$('#curation-info-modal-header').addClass("border-success");
} else {
$('#curation-info-modal-header').removeClass("bg-success text-light");
$('#curation-info-modal-header').addClass("bg-secondary text-light");
$('#curation-info-modal-header').addClass("border-secondary");
$('#curation-info-modal-header').removeClass("border-success");
}
$('#curation-info-modal').modal('show');
setTimeout(() => $('#curation-info-modal').modal('hide'), 2200);
}
// extract main element id
function extractElementId(currentId) {
let key = ""
let idx = currentId.indexOf("_");
key = currentId.substr(idx + 1);
return key
}
</script>
</html>