forked from shivendrasaurav/corona-rakshak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
321 lines (264 loc) · 13.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel='manifest' href='./manifest.webmanifest'>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="./icons/icon.ico"/>
<link rel="apple-touch-icon" href="./icons/icon.png"/>
<meta name="theme-color" content="#8CBCFC">
<link href="https://fluentdesignforweb.github.io/normalize.css" type="text/css" rel="stylesheet">
<link href="https://fluentdesignforweb.github.io/fluent.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap" rel="stylesheet">
<link href="./styles/style.css" type="text/css" rel="stylesheet">
<title>Corona Rakshak - Quiz</title>
</head>
<body onload="checkCookie(); setStats(); checkinstall();">
<div id="quiz_body" style="display: none;" class="noscroll_bar" onscroll="scrolldown();">
<div class="column large6 medium8 small12 fullview center" id="start">
<div class="question page_container">
<p style="font-size: 36px;">Hi, Go through these questions and answer them, so we can help you to get personalized Tips related to Covid-19</p>
<br>
</div>
<div class="options page_container">
<a href="#q1" class="button pro_but">Proceed</a>
</div>
</div>
<div class="column large6 medium8 small12 fullview center" id="q1">
<div class="question page_container">
What's Your Name
</div>
<div class="options page_container">
<input type="text" name="name" id="name" required><br>
<label>Enter your name</label><br><br>
<a href="#q2" class="button pro_but" onclick="setUname();">Proceed</a>
</div>
</div>
<div class="column large6 medium8 small12 fullview center" id="q2">
<div class="question page_container ta_center">
What age group do you belong to?
</div>
<div class="options page_container">
<a href="#q3" class="button pro_but center" onclick="addpoint(1);">0-20</a>
<a href="#q3" class="button pro_but center" onclick="addpoint(0)">21-40</a>
<a href="#q3" class="button pro_but center" onclick="addpoint(1)">41-60</a>
<a href="#q3" class="button pro_but center" onclick="addpoint(2)">61-80</a>
<a href="#q3" class="button pro_but center" onclick="addpoint(3)">Even Older</a>
</div>
</div>
<div class="column large6 medium8 small12 fullview center" id="q3">
<div class="question page_container ta_center">
Do you have any travel history in past 20~30 days, Domestic or International?
</div>
<div class="options page_container">
<a href="#q4" class="button pro_but center" onclick="addpoint(2)">Yes</a>
<a href="#q4" class="button pro_but center" onclick="addpoint(0)">No</a>
</div>
</div>
<div class="column large6 medium8 small12 fullview center" id="q4">
<div class="question page_container ta_center">
Are you experiencing any of these Symptoms? Click on as many as applicable.
</div>
<div class="options page_container">
<a href="#q4" class="button pro_but center" onclick="addpoint(2)">Fever</a>
<a href="#q4" class="button pro_but center" onclick="addpoint(1)">Dry Cough</a>
<a href="#q4" class="button pro_but center" onclick="addpoint(1)">Cold</a>
<a href="#q4" class="button pro_but center" onclick="addpoint(1)">Tiredness</a>
<a href="#q4" class="button pro_but center" onclick="addpoint(2)">Difficulty in Breathing</a>
<a href="#q4" class="button pro_but center" onclick="addpoint(1)">Body Aches</a>
<a href="#q5" class="button pro_but center" onclick="addpoint(0)">None</a>
<br><br>
<a href="#q5" class="button pro_but center">Goto Next Question</a>
</div>
</div>
<div class="column large6 medium8 small12 fullview center" id="q5">
<div class="question page_container ta_center">
Did you have any major health issue in the past?
</div>
<div class="options page_container">
<a href="#q6" class="button pro_but center" onclick="addpoint(1)">Yes</a>
<a href="#q6" class="button pro_but center" onclick="addpoint(0)">No</a>
</div>
</div>
<div class="column large6 medium8 small12 fullview center" id="q6">
<div class="question page_container ta_center">
Have you violated quarantine in last 7 days?
</div>
<div class="options page_container">
<a href="#fin" class="button pro_but center" onclick="addpoint(1)">Yes</a>
<a href="#fin" class="button pro_but center" onclick="addpoint(0)">No</a>
</div>
</div>
<div class="column large6 medium8 small12 fullview center" id="fin">
<div class="question page_container ta_center">
<p style="font-size: 36px;">Thank You for answering these questions, Let's move forward now</p>
<br>
</div>
<div class="options page_container">
<a href="#fin" class="button pro_but center" onclick="cook();">Complete</a><br /><br />
<p id="err_msg" class="primary_red" style="display: none;"></p>
<p id="nm_err_msg" class="primary_red" style="display: none;"></p>
</div>
</div>
</div>
<div id="home_body" style="display: none;" class="noscroll_bar">
<div class="column large6 medium8 small12 fullview center">
<div class="page_container">
<div class="large12 medium12 small12 panel zi2" id="rl_back">
<h5>Hi, <span id="user_nm"></span></h5>
<h6>You're <span id="user_rl"></span></h6>
</div>
<a class="panel column large12 medium12 small12 zi2" href="./tips/tips_totallysafe.html" id="t_safe" style="display: none; background: #06A77D; color: #1e1e1e;">
<p>Get helpful information and tips</p>
</a>
<a class="panel column large12 medium12 small12 zi2" href="./tips/tips_safe.html" id="safe" style="display: none; background: #28B85B; color: #1e1e1e;">
<p>Get helpful information and tips</p>
</a>
<a class="panel column large12 medium12 small12 zi2" href="./tips/tips_suspects.html" id="susp" style="display: none; background: #CCC908; color: #1e1e1e;">
<p>Get helpful information and tips</p>
</a>
<a class="panel column large12 medium12 small12 zi2" href="./tips/tips_probable.html" id="prob" style="display: none; background: #FF9900; color: #1e1e1e;">
<p>Get helpful information and tips</p>
</a>
<a class="panel column large12 medium12 small12 zi2" href="./tips/tips_infected.html" id="inf" style="display: none; background: #CC2936; color: #1e1e1e;">
<p>Get helpful information and tips</p>
</a>
<div class="large12 medium12 small12">
<br />
<a href="#" class="button home_but center" onclick="resetCookies();">Retake Safety Quiz</a>
<br />
<a href="zones.html" class="button home_but center" onclick="">Live Zone Status</a>
<br />
<a href="stats.html" class="button home_but center" onclick="">National Stats</a>
<br /><br />
<button class="tab large3 small12 medium6 ta_center center zi2">
You've interacted with
<p id="d_int" class="ta_center stat hdg">20</p>
People
</button>
<br />
<a href="#scores_body" class="button home_but center" onclick="showscores(); getDevices();">Social Distancing Score</a>
<br />
</div>
</div>
</div>
</div>
<div id="scores_body" style="display: none;" class="noscroll_bar">
<div class="column large6 medium8 small12 fullview center">
<div class="page_container">
<div class="large12 medium12 small12">
<br /><br />
<span id="message"></span>
<button class="tab large3 small12 medium6 ta_center center zi2">
You've interacted with
<p id="d_tot" class="ta_center stat hdg">20</p>
People
</button>
<br />
<button class="tab large3 small12 medium6 ta_center center zi2">
You broke Social Distancing
<p id="d_int1" class="ta_center stat hdg">20</p>
Times
</button>
<br /><br />
<button class="tab large6 small12 medium12 ta_center center zi2" id="sdgrade">
<label class="ta_center stat" id="percent">11%</label>
<p id="grade" class="ta_center stat hdg">F</p>
Social Distance Grade
</button>
<br />
<a href="#home_body" class="button home_but center" onclick="getDevices();">Search for Nearby Devices</a>
<br />
<a href="#home_body" class="button home_but center" onclick="hidescores();">Goto Home</a>
</div>
</div>
</div>
</div>
<div class="modal_container" id="install_button_surface">
<div class="modal_content zi2">
<div class="page_container">
<div class="columns large12 medium12 small12">
<br><br>
<img src="./icons/icon.png" class="circular icon_large">
<p class="app_name right"><b>Corona Rakshak</b></p>
<hr><br><br>
</div>
<div class="columns large12 medium12 small12">
<p class="app_name">Corona Rakshak</p>
<p class="app_desc">
Corona Rakshak is an App which can be used check whether Social Distancing is being maintained by detecting nearby devices using technologies such as Bluetooth and Geolocation.
This is a Decentralized Application with more emphasis on User's Privacy.
</p>
<button class="left large primary_blue" onclick="install(); closeinstaller();">Install</button>
<button class="left primary_red can" onclick="closeinstaller();">Cancel</button>
</div>
</div>
</div>
</div>
<input id="points" type="number" value="0" style="display: none;">
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="./scripts/indexScript.js"></script>
<script src="./scripts/bluetoothScripts.js"></script>
<script src="./scripts/SmoothScroll.js"></script>
<script>
let deferredPrompt = null;
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent Chrome 67 and earlier from automatically showing the prompt
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
});
async function install() {
if (deferredPrompt) {
deferredPrompt.prompt();
console.log(deferredPrompt)
deferredPrompt.userChoice.then(function(choiceResult){
if (choiceResult.outcome === 'accepted') {
console.log('Your PWA has been installed');
} else {
console.log('User chose to not install your PWA');
}
deferredPrompt = null;
});
}
closeinstaller();
}
function showinstaller(){
window.location.replace("./homescreen.html");
}
function closeinstaller(){
document.getElementById("install_button_surface").style.display="none";
document.getElementById("home_body").style.filter="saturate(100%) blur(0px)";
}
</script>
<script>
function checkinstall(){
if (window.matchMedia('(display-mode: standalone)').matches) {
closeinstaller();
console.log('display-mode is standalone');
}
else
showinstaller();
}
</script>
<script>
// This is the "Offline copy of pages" service worker
// Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
// Check compatibility for the browser we're running this in
if ("serviceWorker" in navigator) {
if (navigator.serviceWorker.controller) {
console.log("Active service worker found, no need to register");
} else {
// Register the service worker
navigator.serviceWorker
.register("pwabuilder-sw.js", {
scope: "./"
})
.then(function (reg) {
console.log("Service worker has been registered for scope: " + reg.scope);
});
}
}
</script>