-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
65 lines (58 loc) · 2.57 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
<html>
<head>
<title>HOME</title>
<link rel="stylesheet" href="resources/css/main.css">
<script src="resources/js/jquery-3.0.0.min.js"></script>
<script src="resources/json/hospitals.json"></script>
<script src="resources/json/experiment_paper.json"></script>
<link rel="shortcut icon" href="resources/images/favicon.ico" type="image/x-icon">
</head>
<body>
<div id="div-home">
<button id='btn_start' onclick="onStart()">let's start</button>
<button id='btn_start' onclick="onReset()">reset data</button>
</div>
<script>
function onReset(){
if(confirm("are you sure to delete saved data?")){
localStorage.clear();
}
}
$('#btn_start').hide();
function onStart(){
window.open('map.html','_self');
}
function setup(){
if(localStorage.getItem("hospital_list")==null){
var hospital = hospital_data;
localStorage.setItem("hospital_list",JSON.stringify(hospital));
console.log("saved hospital_data");
}else{
var hospital = hospital_data;
var saved_hospital = JSON.parse(localStorage.getItem("hospital_list"));
var blChange = false;
for(var i=0; i<saved_hospital.length; i++){
if(saved_hospital[i].name!=hospital[i].name||
saved_hospital[i].location.lat!=hospital[i].location.lat||
saved_hospital[i].location.long!=hospital[i].location.long||
saved_hospital[i].contact!=hospital[i].contact
){
blChange = true;
break;
}
}
if(blChange){
localStorage.setItem("hospital_list",JSON.stringify(hospital));
}
}
if(localStorage.getItem("experiment_paper")==null){
var experiment_paper = experiment_paper_structure;
localStorage.setItem("experiment_paper",JSON.stringify(experiment_paper));
console.log("saved hospital_data");
}
$('#btn_start').show();
}
setup();
</script>
</body>
</html>