-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
104 lines (98 loc) · 1.88 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
<!DOCTYPE html>
<html>
<!-- set front end styles -->
<style>
body {
background-color: #333;
padding: 0;
margin: 0;
}
h1 {
font-family: Lobster,Helvetica;
}
.container {
height: 100vh;
width: 100vw;
background-color: #fff;
}
#title {
position: absolute;
width: 400px;
height: 200px;
left: 50%;
top:30%;
margin-left: -200px;
margin-top: -100px;
text-align: center;
}
.block {
width: 200px;
height: 200px;
list-style-type: none;
border-radius: 20px;
margin: 10px;
box-shadow: inset 0px 0px 20px rgba(220,220,220,1);
}
#red {
background-color: red;
}
#blue {
background-color: blue;
}
#green {
background-color: green;
}
#clear {
text-align: center;
position: absolute;
width: 200px;
height: 100px;
top: 75%;
left: 50%;
margin-top: -50px;
margin-left: -100px;
padding: 5px;
}
#row {
position: absolute;
left: 50%;
top: 30%;
display: flex;
margin-left: -380px;
margin-top: 100px;
}
</style>
<head>
<!-- link to google fonts for Lobster font -->
<link href='https://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
</head>
<!-- front end HTML -->
<body>
<div class="container">
<div id="title">
<h1>Click to change the LED color!</h1>
</div>
<ul id="row">
<li class="block" id="red" data-color="red"></li>
<li class="block" id="blue" data-color="blue"></li>
<li class="block" id="green" data-color="green"></li>
</ul>
<div class="block" id="clear" data-color="clear">
<h1>Clear</h1>
</div>
</div>
<!-- jquery click listener. On click sends http POST to /output/[color] -->
<script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$(".block").on('click', function() {
console.log(this.dataset.color);
var color = this.dataset.color;
$.post("/output/" + color, function(data) {
console.log(data);
});
});
});
</script>
</body>
</html>