forked from yjlou/2019-nCov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
733 lines (631 loc) · 29.3 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
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
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>COVID-19</title>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-EBZR5PXS5X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-EBZR5PXS5X');
</script>
<!-- end of GA -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"
integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ=="
crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery.i18n/1.0.7/jquery.i18n.min.js"
integrity="sha512-a0tGMh5o0nCoRDiMVaSmiWgB9s/JqfC+PQZHWANTzIhasvm5eH9NkWTmJ4WloaQWLT8fEzRBjvADgFNDf0WusQ=="
crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery.i18n/1.0.7/jquery.i18n.messagestore.min.js"
integrity="sha512-/hv/2tE0W63ywFkKYwtnbYdBwlS+tjEw/TWvGD31awT1bbEliLB0G0akHicAUJVLPSCE6LVEnfdJy0lPkrauvg=="
crossorigin="anonymous"></script>
<!-- fake function to bypass the node.js require() code. Must be defined before the local .js files are imported. -->
<script> function require() { } </script>
<!-- for lib_sthash.js -->
<script src="https://cdn.jsdelivr.net/gh/emn178/js-sha256@master/build/sha256.min.js"></script>
<!-- for parsers.js -->
<script src="https://cdn.jsdelivr.net/gh/NaturalIntelligence/fast-xml-parser@master/lib/parser.min.js"></script>
<!-- local .js files -->
<script src="algos.js"></script>
<script src="i18n.js"></script>
<script src="lib_sthash.js"></script>
<script src="meta.js"></script>
<script src="parsers.js"></script>
<script src="test.js"></script>
<script src="utils.js"></script>
<!-- Materialize: Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
<!-- Let browser know website is optimized for mobile -->
<!-- Kudos: https://github.com/Dogfalo/materialize/issues/4200 -->
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0">
<link rel="icon" type="image/png" sizes="96x96" href="images/favicon-96x96.png">
<script>
// Global variables
var PARAMS; // URL parameters. Type: URLSearchParams
var HTML_LANG; // Language code. Will be set in load_lang().
var PATIENTS = Array();
var HASHES = Array();
var TOTAL_FOUND; // Number of found overlapped points.
function parseUrlParams() {
PARAMS = new URLSearchParams(window.location.search);
}
// Return true if the code is running on staging.
function is_staging() {
return window.location.hostname.match("raw.githack.com") != null;
}
// Return true if the code is running at production.
function is_production() {
return window.location.hostname.match("github.io") != null;
}
function log(message) {
if (is_production()) {
return;
}
const logs = $("#logs");
logs.html(logs.html() + message + '\n');
// scroll to the bottom.
logs.scrollTop(1e10);
}
// Kodus: https://stackoverflow.com/questions/11381673/detecting-a-mobile-browser
function alertMobile() {
let check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
if (check) {
M.toast({html: i18n("HTML_ALERT_MOBILE"),
displayLength: 15*1000, // 15 secs
});
}
}
// Select the tab.
//
// Args:
// tab_id: str. e.g. "step2"
//
function selectTab(tab_id) {
$('.tabs').tabs('select', tab_id);
gtag('event', 'selectTab', {
'event_category': 'Silo',
'event_label': tab_id,
'value': parseInt(tab_id[4])
});
}
// Returns Array of points.
function parseFile(filename, file_text) {
if (filename.endsWith(".kml")) {
return parseKml(file_text);
} else if (filename.endsWith(".json")) {
return parseJson(file_text);
} else {
alert("parseFile(): unsupported filename: " + filename);
}
}
function fetchHttpFile(path) {
var req = new XMLHttpRequest();
req.open("GET", path, false);
req.setRequestHeader("Content-Type", "text/*");
req.send(null);
return req.response;
}
function loadPatientData() {
log($.i18n("LOADING_TRACKING"));
let load_files_elem = $("#loadFiles");
let load_files = [];
if (PARAMS.get("hashes")) {
// The hashed file format:
//
// {
// 'desc': DESCRIPTION,
// 'hashes': [ ... ],
// }
//
// TODO: move to parser.js and integrate with parseFile().
let hashes_path = PARAMS.get("hashes");
let json_obj = JSON.parse(fetchHttpFile(hashes_path));
let desc = json_obj.desc;
let hashes = json_obj.hashes;
for (hash of hashes) {
if (hash in HASHES) {
HASHES[hash].push(desc);
} else {
HASHES[hash] = [desc];
}
}
load_files.push({
desc: desc,
});
} else {
if (PARAMS.get("patient")) {
load_files.push({
desc: PARAMS.get("patient"),
path: PARAMS.get("patient"),
src: PARAMS.get("patient"),
});
} else {
// TODO: Make this a global variable when we put more stuff in root
// metadata.
let metadata = JSON.parse(fetchHttpFile(ROOT_META_PATH));
// Load default data.
for(let patients of metadata['defaultPatientsData']) {
load_files.push(patients);
}
}
for (let file of load_files) {
let points = parseFile(file.path, fetchHttpFile(file.path));
// parse meta file
if (file.meta) {
var meta_file = myJsonParse(fetchHttpFile(file.meta));
} else {
var meta_file = {
bounding_box: {top: 90 * 1e7, right: 180 * 1e7, bottom: -90 * 1e7, left: -180 * 1e7},
num_of_points: points.length,
};
}
file.num_points = meta_file.num_of_points;
log(JSON.stringify(points).split("},{").join("},\n{")); // one line for each record.
patient = {
desc: file.desc,
data_src: file.src,
points: points,
bounding_box: meta_file.bounding_box,
src: file.src,
num_points: file.num_points,
timestamp: meta_file.timestamp,
};
// Have every data point linking back to meta info.
for(point of points) {
point.meta_info = patient;
}
PATIENTS.push(patient);
}
}
function toLocaleDate(date) {
let ret;
try {
ret = date.toLocaleDateString(HTML_LANG, {month: 'short', day: 'numeric'});
} catch(err) {
ret = date.toLocaleDateString(); // Use default format when failed
}
return ret;
}
for (let patient of PATIENTS) {
let add_html = "<LI>";
if (patient.src) { add_html += `<a target='_blank' rel='noreferrer' href='${patient.src}'>`; }
add_html += `${patient.desc} (${patient.num_points}) `;
if (patient.timestamp) add_html += `(${toLocaleDate(new Date(patient.timestamp))})`;
if (patient.src) { add_html += "</a>"; }
add_html += "\n";
load_files_elem.html(load_files_elem.html() + add_html);
}
log($.i18n("DONE_LOADING"));
}
function twoDigits(num) {
return num < 10 ? "0" + num : num;
}
function myLocaleTime(timestamp) {
var date = new Date(timestamp * 1000);
let ret;
try {
ret = date.toLocaleDateString(HTML_LANG, {month: 'short', day: 'numeric'}) + " " +
date.toLocaleTimeString(HTML_LANG, {hour12: false, hour: '2-digit', minute: '2-digit'});
} catch(err) {
// Use default format when failed
ret = date.toLocaleDateString() + " " + date.toLocaleTimeString();;
}
return ret;
}
function createContactInfo(contact) {
const template = document.getElementById('matched-info-template');
const root = template.content.querySelector('#root');
const node = document.importNode(root, true);
node.querySelector('#user-info').innerText = contact.user_desc;
node.querySelector('#case-info').innerText = contact.patient_desc;
node.querySelector('#time-info').innerText = (myLocaleTime(contact.begin) +
" ~ " + myLocaleTime(contact.end));
const link = 'http://maps.google.com/?q=' + contact.lat + "," + contact.lng;
node.querySelector('#HTML_VIEW_IN_GOOGLE_MAPS').href = link;
if (contact.meta_info && contact.meta_info.data_src) {
node.querySelector('#HTML_VIEW_IN_DATA_SOURCE').href = contact.meta_info.data_src;
} else {
// remove the whole element.
node.querySelector('#HTML_VIEW_IN_DATA_SOURCE').outerHTML = '';
}
const container = document.getElementById('fancy-results');
container.appendChild(node);
}
function showContacts(contacts) {
// TODO: de-duplicate contacts
console.log(contacts);
var html = "";
for (let contact of contacts) {
createContactInfo(contact);
}
return html || null;
}
function loadFileContentAsync(file_blob) {
return new Promise((resolve, reject) => {
let reader = new FileReader();
reader.onload = (fp) => {
resolve(fp.target.result);
};
reader.onerror = reject;
reader.readAsText(file_blob, "UTF-8");
});
}
async function processFile(file_blob) {
console.log(file_blob);
var filename = file_blob.name;
const display = $("#results");
if (filename.endsWith(".kml") || filename.endsWith(".json")) {
log($.i18n("ANALYZING", filename));
appendResults($.i18n("ANALYZING", filename));
let file_text = await loadFileContentAsync(file_blob);
let points = parseFile(filename, file_text);
var contacts = Array();
contacts = contacts.concat(checkContact(points, PATIENTS));
contacts = contacts.concat(checkHashes(points, HASHES));
appendResults(showContacts(contacts));
TOTAL_FOUND += contacts.length;
log($.i18n("DONE_ANALYZE",
filename,
contacts.length,
points.length
));
appendResults($.i18n("DONE_ANALYZE",
filename,
contacts.length,
points.length
));
} else {
alert($.i18n("UNSUPPORTED_FILE_TYPE", filename));
}
}
function clearResults() {
TOTAL_FOUND = 0;
$("#results").html(""); // reset result
$("#HTML_EXPLAIN_NOT_FOUND").hide();
$("#HTML_EXPLAIN_FOUND_RESULTS").hide();
$("#fancy-results").html("");
}
// Prepend a string in the beginning of the resutls.
function prependResults(msg) {
if (msg === null) return;
const display = $("#results");
if (!msg.endsWith('\n')) {
msg += '\n';
}
display.html(msg + display.html());
}
function appendResults(msg) {
if (msg === null) return;
const display = $("#results");
if (!msg.endsWith('\n')) {
msg += '\n';
}
display.html(display.html() + msg);
}
function finishResults() {
appendResults($.i18n("FINISH_RESULTS", TOTAL_FOUND));
$("#results").scrollTop(0);
if (TOTAL_FOUND == 0) {
$("#HTML_EXPLAIN_NOT_FOUND").show();
} else {
$("#HTML_EXPLAIN_FOUND_RESULTS").show();
}
M.Toast.dismissAll();
}
// The common code for file type and drap&drop handler.
//
// Args:
// blobs: array of File Blobs.
function processBlobs(blobs) {
selectTab("step4");
clearResults();
const promises = [];
for(let blob of blobs) {
promises.push(processFile(blob));
}
Promise.all(promises).then(
finishResults
).catch(
(e) => console.error(e)
);
}
// If any file is selected for comparison, enable the next step button.
// Otherwise, disable the button.
//
function checkNumFilesSelected() {
let oFiles = document.getElementById("uploadInput").files;
if (oFiles.length == 0) {
$(".btn_check_file").addClass('disabled');
} else {
$(".btn_check_file").removeClass('disabled');
}
}
function onClickLetsCheckButton() {
let oFiles = document.getElementById("uploadInput").files;
if (oFiles.length === 0) return;
// Prompt user this could take longer than they think.
M.toast({html: $.i18n("HTML_CHECKING"),
displayLength: 99999 * 1000, // infinite
});
// Give the mobile phone UI a chance to show the checking message above.
setTimeout(function() {
const blobs = [];
for (let oFile of oFiles) {
blobs.push(oFile);
}
processBlobs(blobs);
}, 200);
}
// Kodus: https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop
//
function dropHandler(ev) {
// Prevent default behavior (Prevent file from being opened)
ev.preventDefault();
const blobs = [];
for (let item of ev.dataTransfer.items) {
if (item.kind === 'file') {
blobs.push(item.getAsFile());
}
}
processBlobs(blobs);
}
function dragOverHandler(ev) {
// Prevent default behavior (Prevent file from being opened)
ev.preventDefault();
}
function downloadOneKml(date) {
let year = date.getFullYear();
let month = date.getMonth(); // starts from 0
let mday = date.getDate();
let download_url = "https://www.google.com/maps/timeline/kml?authuser=0&pb=!1m8!1m3!1i" + year + "!2i" + month + "!3i" + mday +
"!2m3!1i" + year + "!2i" + month + "!3i" + mday;
let anchor = document.createElement('a');
anchor.href = download_url;
anchor.target = "_blank";
anchor.setAttribute('rel', 'noreferrer');
const str_month = `0${month + 1}`.slice(-2);
const str_day = `0${mday}`.slice(-2);
anchor.download = `history-${year}-${str_month}-${str_day}.kml`;
var evt = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: false
});
anchor.dispatchEvent(evt);
(window.URL || window.webkitURL).revokeObjectURL(anchor.href);
}
function downloadKml(period) {
var begin, end;
if (period.startsWith('-')) {
// last N seconds
let now = (+ new Date()) / 1000; // get cuurent timestamp
begin = now - parseInt(period.substr(1));
end = now;
} else {
// period seperated by comma
[begin, end] = period.split(",");
[begin, end] = [parseInt(begin), parseInt(end)];
}
const secs_per_day = 24 * 60 * 60;
let anchors = [];
for (let timestamp = begin; timestamp <= end; timestamp += secs_per_day) {
let date = new Date(timestamp * 1000);
downloadOneKml(date);
}
}
function download_btn_onclick(ev) {
console.log(ev);
ev.preventDefault();
ev.defaultPrevented = false;
var opt = document.getElementById('download_period');
var value = opt.options[opt.selectedIndex].value;
downloadKml(value);
return false;
}
function language_changed() {
let lang = $("#select_lang option:selected").val();
window.location.href = "?hl=" + lang;
return false;
}
$( document ).ready(
function ($) {
parseUrlParams();
load_i18n(function () {
update_i18n_UI();
// Initialize Materialize selects after UI components are updated,
// since Materialize inserts DOM elements based on the state of the
// selects.
M.FormSelect.init(document.querySelectorAll('select'), {});
$('.tabs').tabs();
// Must be run after Materialize init.
apply_RTL_UI();
alertMobile();
if (is_staging()) {
$('#HTML_ALERT_STAGING').show();
}
// Loading patient data can take forever. Give some time for UI to update.
// Delay the loading.
setTimeout(function() {
loadPatientData();
}, 200);
// If there is no hashtag in URL, jump to step 1 tab
if (!window.location.hash) {
selectTab('step1');
}
});
document.getElementById('download_btn').onclick = download_btn_onclick;
// Do not show log field in prod.
if (is_production()) {
document.getElementById('logs_title').style.display = 'none';
}
}
);
</script>
</head>
<body>
<!-- Template won't be shown -->
<template id="matched-info-template">
<!-- A card to show matched info -->
<div id="root" class="card-panel">
<div>
<label id="HTML_LABEL_WHEN" data-i18n="HTML_LABEL_WHEN">When</label> <span id='time-info'></span>
</div>
<div>
<label id="HTML_LABEL_YOU" data-i18n="HTML_LABEL_YOU">You</label> <span id="user-info"></span>
</div>
<div>
<label id="HTML_LABEL_PATIENT" data-i18n="HTML_LABEL_PATIENT">Patient</label> <span id="case-info"></span>
</div>
<div>
<a id="HTML_VIEW_IN_GOOGLE_MAPS" data-i18n="HTML_VIEW_IN_GOOGLE_MAPS" class="btn" target="_blank" rel="noreferrer">View in Google Maps</a>
<a id="HTML_VIEW_IN_DATA_SOURCE" data-i18n="HTML_VIEW_IN_DATA_SOURCE" class="btn" target="_blank" rel="noreferrer">View in Data Source</a>
</div>
</template>
<header>
<div class="container">
<nav>
<div class="nav-wrapper">
<div class="row">
<div class="col s12">
<a href="#" id="HTML_APP_NAME" data-i18n="HTML_APP_NAME" class="brand-logo" style="font-size: 100%;">COVID-19</a>
<ul id="nav-mobile" class="hide-on-med-and-down">
<li>
<form onsubmit="return false;">
<select id="select_lang" onchange="language_changed();">
<option id="HTML_SELECT_LANGUAGE" data-i18n="HTML_SELECT_LANGUAGE" disabled selected>Select Language</option>
<option value="en-US">English</option>
<option value="zh-TW">繁體中文</option>
<option value="ko">한국어</option>
<option value="he">עברית</option>
</select>
</form>
</li>
</ul>
</div>
</div>
</div>
</nav>
</div>
</header>
<main>
<div class="container">
<form name="uploadForm" onsubmit="return false;">
<p id="HTML_ALERT_STAGING" data-i18n="HTML_ALERT_STAGING" class='blinking' style="display: none; background-color: red;">
This is the page for developer to test. If you are not developer, please use <a href='https://yjlou.github.io/2019-nCov'>production page</a> instead.</p>
<p id="HTML_APP_DESCRIPTION" data-i18n="HTML_APP_DESCRIPTION">By comparing with your mobile phone historical location data, this program can tell
you
whether you have contacted the confirmed patient or not.</p>
<p id="HTML_PROCESS_IN_LOCAL" data-i18n="HTML_PROCESS_IN_LOCAL">For your privacy, your data are ONLY processed in local and will NOT be uploaded to any server.</p>
<p id="HTML_LOADED_DATA" data-i18n="HTML_LOADED_DATA">Loaded Data List</p>
<pre id="loadFiles"></pre>
<p id="HTML_WARNING" data-i18n="HTML_WARNING">WARNING! All the matched results are just FYI. If any result is incorrect, please refer to
the information announced by the authority.</p>
<hr>
<div class="row">
<div class="col s12">
<ul class="tabs red lighten-5">
<li class="tab col s3"><a id="HTML_STEP_1" data-i18n="HTML_STEP_1" href="#step1" class="active">Step 1</a></li>
<li class="tab col s3"><a id="HTML_STEP_2" data-i18n="HTML_STEP_2" href="#step2">Step 2</a></li>
<li class="tab col s3"><a id="HTML_STEP_3" data-i18n="HTML_STEP_3" href="#step3">Step 3</a></li>
<li class="tab col s3"><a id="HTML_STEP_4" data-i18n="HTML_STEP_4" href="#step4">Step 4</a></li>
</ul>
</div>
<div id="step1" class="col s12">
<h5 id="HTML_STEP_1_0" data-i18n="HTML_STEP_1_0">Step 1: Confirm your Location History had been opted-in</h5>
<p id="HTML_STEP_1_1" data-i18n="HTML_STEP_1_1">
Go to <a href="https://google.com/maps/timeline" target="_blank" rel="noreferrer">Google Maps Timeline</a>.
If you see red dots on the map (as below screenshot), you have enabled the History Location feature.
Please move to <a href="#" onclick="selectTab('step2')">step 2</a>.
</p>
<img id="IMG_LOCATION_HISTORY_ENABLED" src="images/blank-1.png" class="img-center"/>
<p id="HTML_ENABLE_HISTORY_LOCATION" data-i18n="HTML_ENABLE_HISTORY_LOCATION">If you don't see any red dot on the map, you probably need to enable the feature. Click the 'Gear Icon' on the bottom-right of screen. Then opt-in 'Enable Location History'. This will lead you into a concensus page. Enable this feature.</p>
<img id="IMG_ENABLE_HISTORY_LOCATION" src="images/blank-1.png" class="img-center"/>
<p id="HTML_COME_BACK_AND_CHECK" data-i18n="HTML_COME_BACK_AND_CHECK">Since you just started collecting your location data, there is no data to match. Please come back another day to match again.</p>
<a id="HTML_NEXT_STEP" data-i18n="HTML_NEXT_STEP" class="btn btn_next_step" href="#" onclick="selectTab('step2')">Next Step</a>
</div>
<div id="step2" class="col s12">
<h5 id="HTML_STEP_2_0" data-i18n="HTML_STEP_2_0">Step 2: Select period to download: </h5>
<p>
<span class="input-field inline">
<select id="download_period">
<option id="HTML_LAST_31_DAYS" data-i18n="HTML_LAST_31_DAYS" value="-2678400">last 31 days</option>
<option id="HTML_LAST_14_DAYS" data-i18n="HTML_LAST_14_DAYS" value="-1209600" selected>last 14 days</option>
<option id="HTML_LAST_7_DAYS" data-i18n="HTML_LAST_7_DAYS" value="-604800">last 3 days</option>
<option id="HTML_LAST_3_DAYS" data-i18n="HTML_LAST_3_DAYS" value="-259200">last 3 days</option>
<option id="HTML_ONLY_TODAY" data-i18n="HTML_ONLY_TODAY" value="-0">Today</option>
</select>
</span>
<a id="download_btn" class="btn"><span id="HTML_DONWLOAD" data-i18n="HTML_DONWLOAD">Download</span></a>
<span id="HTML_PUNC_PERIOD" data-i18n="HTML_PUNC_PERIOD">.</span>
</p>
<p id="HTML_EXPECT_DOWNLOADS" data-i18n="HTML_EXPECT_DOWNLOADS">After clicking the Download button, you shall be able to see some files downloaded. Please move forward to <a href=\"#\" onclick=\"selectTab('step3')\">Step 3</a>.</p>
<p id="HTML_ALLOW_POPUP" data-i18n="HTML_ALLOW_POPUP">* If not, remember to allow 'pop-ups' in browser, then click the 'Download' button again.</p>
<a id="HTML_NEXT_STEP" data-i18n="HTML_NEXT_STEP" class="btn btn_next_step" href="#" onclick="selectTab('step3')">Next Step</a>
</div>
<div id="step3" class="col s12">
<h5 id="HTML_STEP_3_0" data-i18n="HTML_STEP_3_0">
Step 3: Open your location history file(s)
</h5>
<p>
<span id="HTML_STEP_3_2" data-i18n="HTML_STEP_3_2">Click here to select KML/JSON file(s)</span>
<input id="uploadInput" type="file"
onchange="checkNumFilesSelected();"
multiple accept=".kml,.json,application/xml,text/xml,application/json"/>
<a id="HTML_NEXT_STEP" data-i18n="HTML_NEXT_STEP" class="btn btn_check_file disabled" href="#" onclick="onClickLetsCheckButton();">Next Step</a>
</p>
<div id="drop_zone" ondrop="dropHandler(event);" ondragover="dragOverHandler(event);">
<label id="HTML_DRAG_DROP_AREA" data-i18n="HTML_DRAG_DROP_AREA" for="uploadInput"
style="background: #e0e0e0; padding: 100px; display: inline-block;">
Or drag-drop KML/JSON file(s) to here.
</label>
</div>
<p>
<li id="HTML_SELECT_MULTIPLE" data-i18n="HTML_SELECT_MULTIPLE">* You can select multiple files to check.</li>
<li id="HTML_SORTED_TYPE" data-i18n="HTML_SORTED_TYPE">* The file explorer could sort files with type. So look around to select all files to check.</li>
<li id="HTML_REMEMBER_CLICK" data-i18n="HTML_REMEMBER_CLICK">* Remember to click the 'Let's Check' button to start matching.</li>
</p>
<a id="HTML_NEXT_STEP" data-i18n="HTML_NEXT_STEP" class="btn btn_next_step btn_check_file disabled" href="#" onclick="onClickLetsCheckButton();">Next Step</a>
</div>
<div id="step4" class="col s12">
<h5 id="HTML_STEP_4_0" data-i18n="HTML_STEP_4_0">
Step 4: See results below.
</h5>
<div id="fancy-results"></div>
<pre id="results"></pre>
<h5 id="HTML_EXPLAIN_FOUND_RESULTS" data-i18n="HTML_EXPLAIN_FOUND_RESULTS" style="display: none;">Above result shows that you probably had been in the hot zone with patient(s) within around 100 meters at the particular time period(s). Please check the official announcement from authority to verify the detailed route.</h5>
<h5 id="HTML_EXPLAIN_NOT_FOUND" data-i18n="HTML_EXPLAIN_NOT_FOUND" style="display: none;">The result shows that you probably haven't been in the hot zone with patient. But we still recommend you to pay attention to authority's announcement and come back to check everyday.</h5>
<hr>
<div id='logs_title'>
<p>Logs</p>
<pre id="logs" style='overflow: scroll; border: 1px solid; height: 24em; resize: vertical;'></pre>
</div>
</div>
</div>
<hr>
</form>
</div>
</main>
<footer>
<div class="container">
<div class="row">
<a id="HTML_FACEBOOK" data-i18n="HTML_FACEBOOK" href="https://fb.me/covid19zhTW" target="_blank" rel="noreferrer">Follow Us On Facebook</a> |
<a id="HTML_SOURCE_CODE" data-i18n="HTML_SOURCE_CODE" href="https://github.com/yjlou/2019-nCov" target="_blank" rel="noreferrer">Source Code</a> |
<a id="HTML_CONTACT_US" data-i18n="HTML_CONTACT_US" href="mailto:[email protected]" target="_blank" rel="noreferrer">Contact us (
)</a> |
<!-- "./readme.html" is used so page like "https://raw.githack.com/yjlou/2019-nCov/master" would still work. -->
<a id="HTML_README" data-i18n="HTML_README" href="./readme.html" target="_blank" rel="noreferrer">Readme</a>
</div>
</div>
</footer>
<!-- Materialize: Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>