-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
202 lines (167 loc) · 5.91 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
<!DOCTYPE html>
<html>
<title> GeneCheck </title>
<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>
<div class="container">
<p align="left"> <nav class="navbar navbar-default">
<div class="container">
<a href="home.html" class="btn btn-default">
<span class="glyphicon glyphicon-triangle-left"></span> </a> </p>
<h2>Fitness</h2>
</div>
</head>
<center>
<br>
</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);
//searchInData("Tylenol");
//setMedName("Tylenol");
searchFromCamera("123456");
}, 500);
}, 2000);
}
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);
}
function searchFromCamera(userId)
{
//alert("test search camera");
//var medName = document.getElementById("medicationName").value;
setMedName("Tylenol");
// alert("search:" +medNameToSearch+ " for: "+userId);
//alert("yes");
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;
var found_med = false;
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);
found_med = true;
break;
}
if(found_med == false)
{
//alert("no find med");
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 class="form-inline">
Search for your workout or take a picture:<br>
<br>
<br>
<input type="text" id="medicationName" type="text" class="form-control" placeholder="Workout"><br>
</form>
<button type="button" onclick="search('123456')" id="fitnessbutton">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>
<a href="druginsights.html">
<button type="button" class "btn btn-default" onclick="myFunction(product)" id="fitnessbutton">Submit</button>
</a>
<br>
<p id="demo">Click to check your workout</p>
<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>
</center>
</body>
</html>