-
Notifications
You must be signed in to change notification settings - Fork 3
/
starter2.html
295 lines (293 loc) · 11.4 KB
/
starter2.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
<!DOCTYPE html>
<html>
<head>
<title>Sharing Dashboard</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div class= "scroll1">
<div class= "personal">
<div class= "container">
<h2>Personal Data</h2>
<input type="text" id="ty" name="lktext" placeholder="Enter in Your Key Here" size="40"> <button type="button" onclick="gh()">Submit</button>
<h2>OR</h2>
<button type="button" onclick="ga()">Generate a New Key</button>
</div>
</div>
<div class= "personal">
<div class= "container">
<h2>Health Data (Since March 4, 2018):</h2>
<div class="form-group">
<li>Day #:</li>
<input type="text" id="t" name="timestamp" placeholder="Enter in Your Key Here" size="40">
<p id="0s">0</p>
<li>Weight:</li>
<input type="text" id="ta" name="weight" placeholder="Enter in Your Key Here" size="40">
<p id="1s">0</p>
<li>Amount of calories consumed:</li>
<input type="text" id="tb" name="calories_consumed" placeholder="Enter in Your Key Here" size="40">
<p id="2s">0</p>
<li>Amount of calories burned through excersize:</li>
<input type="text" id="tc" name="lktext" placeholder="Enter in Your Key Here" size="40">
<p id="3s">0</p>
<li>Amount of sugar Consumed:</li>
<input type="text" id="td" name="lktext" placeholder="Enter in Your Key Here" size="40">
<p id="4s">0</p>
<li>Amount of cabohydrate Consumed:</li>
<input type="text" id="te" name="lktext" placeholder="Enter in Your Key Here" size="40">
<p id="5s">0</p>
<li>Amount of fat Consumed:</li>
<input type="text" id="tf" name="lktext" placeholder="Enter in Your Key Here" size="40">
<p id="6s">0</p>
<li>Amount of vitamin Consumed:</li>
<input type="text" id="tg" name="lktext" placeholder="Enter in Your Key Here" size="40">
<p id="7s">0</p>
<button type="button" onclick="go()">Submit</button>
</div>
<!-- TODO: make it more dynamic?? -->
<img id="plot" src="static/output/output0.png" style= "object-fit:cover" height="100%" width="100%" >
<img id="plot" src="static/output/output2.png" style= "object-fit:cover" height="100%" width="100%" >
<img id="plot" src="static/output/output3.png" style= "object-fit:cover" height="100%" width="100%" >
</div>
</div>
</div>
<div class= "scroll1">
<div class= "input" id="jk">
<div class= "container">
<div class= "close" onclick="this.parentNode.parentNode.style.display = 'none';" style="margin-top:-10px;"><i class="material-icons">clear</i></div>
<h2 id="one"></h2>
<br><br>
Title: <input type="text" name="title" id="nb1" placeholder="Enter a Title" size="40">
<br><br>
Message:<br><br>
<textarea rows="10" cols="70" id="nb2" name="texta" placeholder="Enter a Message"></textarea>
<br><br>
<button type="button" id="bu" name="button" onclick="j()">Submit</button>
</div>
</div>
<div class= "nav">
<div class= "container">
<div class= "card" onclick="a()">
Workout Regiment: <i class="material-icons" style="font-size:20px">directions_run</i>
</div>
<div class= "card" onclick="b()">
Recipe or Diet Plan: <i class="material-icons" style="font-size:20px">restaurant</i>
</div>
<div class= "card" onclick="c()">
Other Health Advice: <i class="material-icons" style="font-size:20px">tag_faces</i>
</div>
</div>
</div>
<div class= "nav2" id="n2">
<div class= "close" onclick="this.parentNode.style.display = 'none';"><i class="material-icons">clear</i></div>
<h2>Welcome to (Insert Title)</h2>
<p>Welcome to (Insert Title), the first sharing platform for health and fitness data. Here, people can share diets, recipes,
workout regiments, and other health advice, which people can then attempt to follow. Data will then be collected regarding this person's
health condition as they partake in these healthy measures, and it can be determined if they actually are effective. Personally, people can also track
their fat, sugar, carbs, etc., in order to set personal goals for themselves.<br><br>We hope that you will find this platform of use in your journey to become a healthier
individual.</p>
</div>
<div class= "top" id="to">
</div>
</div>
</body>
<style>
.card {
height:40px;
width:200px;
border-radius:20px;
display:inline;
border:solid 2px;
padding-right:23px;
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
cursor:pointer;
animation-name:hover;
animation-duration:2s;
margin-left:14px;
}
.card i {
position:absolute;
}
.nav {
height:50px;
width:700px;
border:solid 2px;
padding-top:30px;
margin-top:30px;
background-color:white;
box-shadow:0 4px 8px 0 rgba(0, 0, 0, 0.5), 0 6px 20px 0 rgba(0, 0, 0, 0.4);
}
.nav2 {
width:660px;
border:solid 2px;
padding-left:20px;
background-color:white;
box-shadow:0 4px 8px 0 rgba(0, 0, 0, 0.5), 0 6px 20px 0 rgba(0, 0, 0, 0.4);
margin-top:30px;
padding-right:20px;
}
.input {
height:400px;
width:682px;
border:solid 2px;
text-align:left;
font-family:Helvetica;
padding-left:20px;
background-color:white;
box-shadow:0 4px 8px 0 rgba(0, 0, 0, 0.5), 0 6px 20px 0 rgba(0, 0, 0, 0.4);
display:none;
}
.input input {
font-size:12px;
outline:none;
}
.input textarea {
font-size:12px;
outline:none;
}
button {
font-size:14px;
}
.close {
position:absolute;
margin-top:10px;
margin-left:650px;
cursor:pointer;
}
body {
background-image:url('pic.jpg');
background-size:1500px 1000px;
font-family:Helvetica;
}
.personal {
padding-left:20px;
padding-right:20px;
padding-top:5px;
padding-bottom:15px;
width:660px;
background-color:white;
border:solid 2px;
float:right;
margin-left:715px;
margin-top:28px;
}
.scroll1 {
position:absolute;
height:840px;
overflow:scroll;
}
.personal p {
}
.bar {
width:1441px;
height:50px;
background-color:black;
margin-top:-19px;
margin-left:-9px;
}
#ty {
font-size:12px;
outline:none;
}
</style>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io()
var category = []
socket.on('starteventa', function (data) {
confirm("Ping")
})
socket.emit('startevent2', 'get_data')
socket.on('startevent3', function (data) {
console.log("pong")
for (var i = 0; i < data.length; i++) {
var sqlone = data[i].title
var sqltwo = data[i].body
var t = document.createElement('DIV')
t.className = "nav2";
var h = document.createElement('H2')
var p = document.createElement('P')
var text2 = document.createTextNode(sqltwo)
p.appendChild(text2)
var text = document.createTextNode(sqlone)
h.appendChild(text)
var h4 = document.createElement('h4')
var text3 = document.createTextNode('By: Anonymous Author')
h4.appendChild(text3)
t.appendChild(h)
t.appendChild(h4)
t.appendChild(p)
document.getElementById('to').insertBefore(t, document.getElementById('to').childNodes[0])
}
})
function j() {
var input1 = document.getElementById('nb1').value+" - "+category[category.length - 1]
var input2 = document.getElementById('nb2').value
socket.emit('startevent1', [input1, input2])
var t = document.createElement('DIV')
t.className = "nav2";
var h = document.createElement('H2')
var p = document.createElement('P')
var text2 = document.createTextNode(input2)
p.appendChild(text2)
var text = document.createTextNode(input1)
h.appendChild(text)
var h4 = document.createElement('h4')
var text3 = document.createTextNode('By: Anonymous Author')
h4.appendChild(text3)
t.appendChild(h)
t.appendChild(h4)
t.appendChild(p)
document.getElementById('to').insertBefore(t, document.getElementById('to').childNodes[0])
document.getElementsByClassName('nav2')[0].scrollIntoView();
document.getElementById('jk').style.display = "none"
document.getElementById('nb1').value = ""
document.getElementById('nb2').value = ""
}
function go() {
document.getElementById('0s').textContent = document.getElementById('t').value
document.getElementById('1s').textContent = document.getElementById('ta').value
confirm((parseInt(document.getElementById('2s').textContent) + parseInt(document.getElementById('tb').value)).toString())
document.getElementById('2s').textContent = (parseInt(document.getElementById('2s').textContent) + parseInt(document.getElementById('tb').value)).toString()
document.getElementById('3s').textContent = (parseInt(document.getElementById('3s').textContent) + parseInt(document.getElementById('tc').value)).toString()
document.getElementById('4s').textContent = (parseInt(document.getElementById('4s').textContent) + parseInt(document.getElementById('td').value)).toString()
document.getElementById('5s').textContent = (parseInt(document.getElementById('5s').textContent) + parseInt(document.getElementById('te').value)).toString()
document.getElementById('6s').textContent = (parseInt(document.getElementById('6s').textContent) + parseInt(document.getElementById('tf').value)).toString()
document.getElementById('7s').textContent = (parseInt(document.getElementById('7s').textContent) + parseInt(document.getElementById('tg').value)).toString()
}
function a() {
document.getElementById('jk').style.display = "block"
document.getElementById('one').innerHTML = "Post: Workout Regiment"
category.push("Workout Regiment")
}
function b() {
document.getElementById('jk').style.display = "block"
document.getElementById('one').innerHTML = "Post: Recipe or Diet Plan"
category.push("Recipe or Diet Plan")
}
function c() {
document.getElementById('jk').style.display = "block"
document.getElementById('one').innerHTML = "Post: Other Health Advice"
category.push("Health Advice")
}
function ga() {
var mathematics = Math.floor((Math.random()*100000) + 1)
socket.emit('sends', mathematics)
}
$(document).ready(function () {
$(".card").mouseenter(function () {
$(this).find("i").css("color", "#536A7A")
$(this).css("box-shadow", "0 4px 8px 0 rgba(0, 0, 0, 0.5), 0 6px 20px 0 rgba(0, 0, 0, 0.4)")
})
$(".card").mouseleave(function () {
$(this).find("i").css("color", "black")
$(this).css("box-shadow", "none")
})
})
</script>
</html>