-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.htm
228 lines (199 loc) · 9.45 KB
/
index.htm
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
<!doctype html>
<html lang="en" class="h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Brew Bubbles, a Home Brewing application">
<meta name="author" content="Lee Bussy">
<title>Brew Bubbles</title>
<link rel="canonical" href="https://www.brewbubbles.com/">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<meta name="apple-mobile-web-app-title" content="Brew Bubbles">
<meta name="application-name" content="Brew Bubbles">
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
<meta name="msapplication-config" content="/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/united/bootstrap.min.css"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" crossorigin="anonymous">
<style>
main>.container {
padding: 60px 15px 0;
}
.footer {
background-color: #f5f5f5f5;
}
.footer>.container {
padding-right: 15px;
padding-left: 15px;
}
</style>
</head>
<body class="d-flex flex-column h-100">
<header>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">
<img src="/mstile-144x144.png" style="width:25px;height:25px;">
Brew Bubbles
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01"
aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarColor01">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/settings/">Settings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/help/">Help</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about/">About</a>
</li>
</ul>
</div>
</nav>
</header>
<main role="main" class="flex-shrink-0">
<div class="container" id="settingsapp">
<!-- Container -->
<div class="card border-dark mb-3">
<!-- Sensor Readings -->
<div class="card-header">
<h4 class="card-title">Current Readings</h4>
</div>
<div class="card-body">
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
<strong>Vessel Name: </strong>
<span id="name">...loading</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<strong>Bubbles Per Minute: </strong>
<span id="bpm">...loading</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<strong>Ambient Temp: </strong>
<span id="aTemp">...loading</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<strong>Vessel Temp: </strong>
<span id="vTemp">...loading</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<strong>Last Reading: </strong>
<span id="time">...loading</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<strong>Refresh in: </strong>
<span id="time">
<div id="countdown">...loading</div>
</span>
</li>
</ul>
</div>
</div> <!-- Sensor Readings -->
</div> <!-- Container -->
</main>
<footer class="footer mt-auto py-3">
<div class="container text-center">
<span class="text-muted">Copyright © 2019-2021, Lee C. Bussy</span>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
<script>
// Attach the event after the page loads
if (window.addEventListener)
window.addEventListener("load", loadPage, false);
else if (window.attachEvent)
window.attachEvent("onload", loadPage);
else window.onload = loadPage;
function loadPage() {
// console.log("DEBUG: Entering: " + arguments.callee.name);
loadData(); // Load data the first time
reloadPeriod = 60;
(function countdown(remaining) { // Refresh data every 60 secs
if (remaining === 0) {
loadData()
remaining = reloadPeriod
}
document.getElementById('countdown').innerHTML = remaining
setTimeout(function () { countdown(remaining - 1) }, 1000)
})(reloadPeriod)
// console.log("DEBUG: Exiting: " + arguments.callee.name);
}
function loadData() {
// console.log("DEBUG: Entering: " + arguments.callee.name);
var url = "/bubble/";
var bubble = $.getJSON(url, function () {
})
.done(function (bubble) {
try {
var disco
if (bubble.temp_unit == "F") {
disco = -196.6
} else {
disco = -127
}
$("#name").text(bubble.name)
$("#bpm").text(parseFloat(bubble.bpm).toFixed(1));
if (bubble.ambient == disco) {
$("#aTemp").text("Not connected")
} else if (bubble.ambient == 0) {
$("#aTemp").text("Not yet updated.")
} else {
$("#aTemp").text(parseFloat(bubble.ambient).toFixed(2) + "°" + bubble.temp_unit);
}
if (bubble.temp == disco) {
$("#vTemp").text("Not connected")
} else if (bubble.temp == 0) {
$("#vTemp").text("Not yet updated.")
} else {
$("#vTemp").text(parseFloat(bubble.temp).toFixed(2) + "°" + bubble.temp_unit);
}
var date = new Date(bubble.datetime)
$("#time").text(date)
}
catch {
$("#name").text("Not yet updated.")
$("#bpm").text("Not yet updated.")
$("#aTemp").text("Not yet updated.")
$("#vTemp").text("Not yet updated.")
$("#time").text("Not yet updated.")
}
})
.fail(function () {
$("#name").text("Error loading JSON.")
$("#bpm").text("Error loading JSON.")
$("#aTemp").text("Error loading JSON.")
$("#vTemp").text("Error loading JSON.")
$("#time").text("Error loading JSON.")
})
.always(function () {
// Post load processing here
}
);
// console.log("DEBUG: Exiting: " + arguments.callee.name);
}
</script>
</body>
</html>