forked from suujia/GeneSight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
203 lines (165 loc) · 6.06 KB
/
index.html
File metadata and controls
203 lines (165 loc) · 6.06 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
<!DOCTYPE html>
<html>
<title> GeneCheck </title>
<head>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/Users/huiminchen/hackhlth18/user.html">Scan for Ingredients</a>
</div>
<ul class="nav navbar-nav">
<li><a href="http://www.ugrad.cs.ubc.ca/~s4i0b/SquishyBoots/index.html">Scan for Ingredients</a></li>
</ul>
<ul class="nav navbar-nav">
<li><a href="http://www.ugrad.cs.ubc.ca/~s4i0b/SquishyBoots/index.html">Scan for Ingredients</a></li>
</ul>
<ul class="nav navbar-nav">
<li><a href="http://www.ugrad.cs.ubc.ca/~s4i0b/SquishyBoots/index.html">User Profile</a></li>
</ul>
<div style = 'float:right;'>
<ul class="nav navbar-nav">
<li><a href="http://www.ugrad.cs.ubc.ca/~s4i0b/SquishyBoots/index.html">Log Out</a></li>
</ul>
</div>
</div>
</nav>
<!-- <body background="pix/bg1.jpg"> -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<h1>Welcome to GeneCheck!</h1>
<style>
body {
background-color: lightblue;
}
</style>
</head>
<script>
function identifyDrug()
{
setTimeout(function() {
alert('Drug is tylenol, super strength');
setTimeout(function() {
alert('Searching for potentially harmful interactions between this drug and your genetic information');
setTimeout(function() {alert('No potential harm detected');}, 1000);
}, 500);
}, 3000);
}
function search(userId)
{
alert("test search");
var medName = document.getElementById("medicationName").value;
setMedName(medName);
alert("search:" +medName+ " for: "+userId);
var file = "./data/Gene-to-Drug-Sensitivity-Relationships.csv";
$.ajax({
url: file,
dataType: 'text',
}).done(searchInData);
}
var medNameToSearch = "";
function setMedName(medName)
{
medNameToSearch = medName;
alert("setMedName: "+medNameToSearch);
}
function searchInData(data)
{
//alert(data);
var allRows = data.split(/\r?\n|\r/);
var rowNum = 0;
while(rowNum < allRows.length)
{
//alert(allRows.length);
var rowCells = allRows[rowNum].split(',');
var url="";
//alert("rowCells[2] = "+rowCells[2]+ " ----- medNameToSearch = "+medNameToSearch);
var found = (rowCells[2] == medNameToSearch);
alert(found);
if(rowCells[2].toUpperCase() == medNameToSearch.toUpperCase())
{
alert("searchInData found med");
url = "./fail.html";
window.location.replace(url);
break;
}
if(rowNum == allRows.length - 1)
{
url = "./success.html";
window.location.replace(url);
break;
}
rowNum=rowNum+1;
}
}
// Register Service Worker.
if ('serviceWorker' in navigator) {
// Path is relative to the origin, not project root.
navigator.serviceWorker.register('/pwa-photobooth/sw.js')
.then(function(reg) {
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.catch(function(error) {
console.error('Registration failed with ' + error);
});
}
</script>
<script src="assets/js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ToxScreen. Drug safety personalized to your genetic information.</title>
<link rel="stylesheet" href="assets/css/styles.css">
<!-- Meta tag for changing browser colors. -->
<meta id="theme-color" name="theme-color" content="#37474F">
<!-- Meta tag for App-like behaviour in iOS -->
<meta name=”apple-mobile-web-app-capable” content=”yes”>
<!-- Web Manifest -->
<link rel="manifest" href="manifest.json">
</head>
<body>
<div>
<form>
Medication:<br>
<input type="text" id="medicationName"><br>
</form>
<button type="button" onclick="search('123456')">Search</button> <!-- hardcoded userId -->
</div>
<div class="container">
<div class="app">
<a href="#" id="start-camera" class="visible">Touch here to start the app.</a>
<video muted id="camera-stream"></video>
<img id="snap">
<p id="error-message"></p>
<div class="controls">
<a href="#" id="delete-photo" title="Delete Photo" class="disabled"><i class="material-icons">delete</i></a>
<a href="#" id="take-photo" title="Take Photo"><i class="material-icons">camera_alt</i></a>
<a href="#" id="download-photo" download="selfie.png" title="Save Photo" class="disabled" onclick="identifyDrug();"><i class="material-icons">file_download</i></a>
</div>
<!-- Hidden canvas element. Used for taking snapshot of video. -->
<canvas></canvas>
</div>
</div>
<p>Scan your product now</p>
<button type="button" onclick="myFunction(product)">Click to check!</button>
<p id="demo">Click to check your drug sensitivities</p>
/* camera detection checks whether product is on sensitivity list*/
<script>
function myFunction(product) {
if (data.includes(product)){
document.getElementById("demo").innerHTML = "Your sensitivite to this, don't use this product!";
}
else {
document.getElementById("demo").innerHTML = "This product does not contain ingredients from your given drug sensitivity list!";
}
}
</script>
</body>
</html>