-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
133 lines (104 loc) · 3.34 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
<html>
<head>
<h1>
Pic My Allergy
</h1>
<br><br><br>
<h4>A simple app that tells you if you might be allergic to something in a picture of your food using machine learning</h4>
<hr class="line" />
<div class='invisiblebtn'></div>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/selectize/selectize.js/master/dist/js/standalone/selectize.js"></script>
<link rel="stylesheet" type="text/css" href="selectize.css" />
<link rel="stylesheet" type="text/css" href="main.css" />
</head>
<body>
<form action='allergy'>
<div class="pick">
<h3> Pick your allergies. </h3>
<br>
<p class='errmsg'> {{noallergies}} </p>
<p class='errmsg'>{{badImage}}</p>
<p class='errmsg'> {{atleast1}} </p>
<select id="sel" name="sel" multiple>
{{#each foods}}
<option value="{{this.foods}}">{{this.foods}}</option>
{{/each}}
</select>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<input class='btn' type='submit' id='createandsave' value='Create & Save'>
</div>
<a href="#show">Link1</a>
<a href="#add">Link2</a>
<div class="show" id="show">
<hr class="line" /><br><br><br>
<h3> Here are your allergies. </h3><br><br><br>
<div id="myAllergies">
<ul>
{{#each allergies}}
<li>
{{this.allergies}}
</li>
{{/each}}
</ul>
</div>
</div>
</form>
<form action='reset'>
<input class='btn' type='submit' id='clear' value='Clear'>
</form>
<input class='btn' type='submit' id='nextToAdd' value='Next'>
<br>
<form id="amIAllergic" action='amIAllergic'>
<hr class="line" />
<div class="add" id="add">
<h3>Now enter an image URL. </h3><br>
<input type="url" name="url" id="url"><br><br><br><br>
<img id="imgPreview" /><br><br><br>
</div>
<br><br><br><br><br><br>
<div class="ready">
<br><br><br>
<input class='btn' id='finalBtn' type="submit" value="Am I allergic?">
</div>
<script>
$(document).ready(function(){
$('#url').change(function() {
var cleanURL = $('#url').val();
// if URL contains a query string
if(cleanURL.indexOf('?') > -1) {
var cleanURL = $('#url').val().substring(0, $('#url').val().indexOf("?"));
}
// if valid image URL
if (cleanURL.match(/(jpeg|jpg|gif|png)$/)) {
$('#imgPreview').attr('src', $('#url').val());
$('#imgPreview').attr('style', 'max-width: 300; max-height: 300');
}
else {
$('#imgPreview').attr('src', null);
}
});
});
$(function() {
$('select').selectize({});
});
$("#createandsave").click(function() {
$('html,body').animate({
scrollTop: $(".show").offset().top},
'slow');
});
$("#nextToAdd").click(function() {
$('html,body').animate({
scrollTop: $("#url").offset().top},
'slow');
});
$("#nextToReady").click(function() {
$('html,body').animate({
scrollTop: $(".ready").offset().top},
'slow');
});
</script>
<!-- Make url allergies work first -->
</form>
</body>
</html>