-
Notifications
You must be signed in to change notification settings - Fork 0
/
brew.html
executable file
·177 lines (143 loc) · 5.4 KB
/
brew.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Socket.io</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link href="nouislider.min.css" rel="stylesheet"> -->
<link href="toggle-switch.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<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.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body style="background-color:#37474f ;">
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Raspberry Espresso</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li class="active"><a href="brew.html">Brew</a></li>
<li><a href="#">Stats</a></li>
<li><a href="#">Settings</a></li>
<li><a href="#">Other</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<!-- Brew on/off button -->
<h3 id="h3Brew">Brew</h3>
<input type="checkbox" data-toggle="toggle" data-on="Enabled" data-off="Disabled" id="toggle">
<script>
$(function() {
$('#toggle-two').bootstrapToggle({
on: 'ON',
off: 'OFF'
});
})
</script>
<!-- breww on/off end -->
</div>
<div class="col-md-6">
<h2 id="header" style="color:white ;"></h2>
<!-- Button for Off, pre-infusion, boil -->
<div class="switch-toggle switch-3 switch-candy">
<input id="on" name="state-d" type="radio" checked="checked">
<label for="on" onclick="">Off</label>
<input id="na" name="state-d" type="radio">
<label for="na" onclick="">Pre-Infusion</label>
<input id="off" name="state-d" type="radio">
<label for="off" onclick="">Boiling</label>
<a></a>
</div>
<!-- end -->
<!-- Timer -->
<div id="timer">
<h3 class="timer">Timer</h3>
<!-- <span class="timer" id="hours">00:</span> -->
<!-- <span class="timer" id="mins">00:</span> -->
<span class="timer" id="seconds">00</span>
<span class="timer"> sec </span>
</div>
<div id="controls">
<button id="start">Start</button>
<button id="stop">Stop</button>
<button id="reset">Reset</button>
</div>
<script>
var hours =0;
var mins =0;
var seconds =0;
$('#start').click(function(){
startTimer();
});
$('#stop').click(function(){
clearTimeout(timex);
});
$('#reset').click(function(){
hours =0; mins =0; seconds =0;
$('#hours','#mins').html('00:');
$('#seconds').html('00');
});
function startTimer(){
timex = setTimeout(function(){
seconds++;
if(seconds >59){seconds=0;mins++;
if(mins>59) {
mins=0;hours++;
if(hours <10) {$("#hours").text('0'+hours+':')} else $("#hours").text(hours+':');
}
if(mins<10){
$("#mins").text('0'+mins+':');}
else $("#mins").text(mins+':');
}
if(seconds <10) {
$("#seconds").text('0'+seconds);} else {
$("#seconds").text(seconds);
}
startTimer();
},1000);
}
</script>
<!-- timer end -->
</div>
</div>
</div>
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="/socket.io/socket.io.js"></script>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<!-- // <script src="https://github.com/seiyria/bootstrap-slider/tree/master/distbootstrap-slider.min.js"></script> -->
<script>
var socket = io.connect('http://192.168.1.184:3000');
socket.on('change_header', function(data) {
document.getElementById('header').innerHTML ="Boiler Temperature: " + data.header;
});
$(document).ready(function() {
$('#toggle').change(function() {
if($(this).is(":checked")) {
socket.emit('message1', '1');
$(this).attr("checked", returnVal);}
socket.emit('message0', '0');
});
});
</script>
</body>
</html>