-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
336 lines (283 loc) · 15.5 KB
/
index.html
File metadata and controls
336 lines (283 loc) · 15.5 KB
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mugsy</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
crossorigin="anonymous">
<style>
html {
overflow: scroll;
overflow-x: hidden;
}
::-webkit-scrollbar {
width: 0px;
/* remove scrollbar space */
background: transparent;
/* optional: just make scrollbar invisible */
}
/* optional: show position indicator in red */
::-webkit-scrollbar-thumb {
background: #FF0000;
}
body {
background-image: url("img/newBluBG.png");
background-repeat: no-repeat;
background-attachment: fixed;
color: #707070;
overflow-x: hidden;
}
.modal-dialog {
width: 98%;
height: 92%;
padding: 0;
}
.modal-content {
height: 99%;
}
.active menu-item {
background-color: red !important;
}
</style>
</head>
<body onload="showSettings();">
<!--#todo: kill these breaks and set proper padding-->
<br>
<div class="container-fluid">
<!-- If Needed Left and Right Padding in 'md' and 'lg' screen means use container class -->
<div class="row">
<!--header-->
<center>
<img src="img/header.png" style="padding-left: 8px" />
</center>
</div>
<!--end header-->
<div class="row">
<!--status-->
<div class="col-xs-6" style="padding-left: 20px; padding-top:9px">
<h4>Status: </h4>
</div>
<div class="col-xs-6" style="padding-left: 10px; padding-top:11px">
<span id="onlineStatus" class="badge badge-success" style="background-color: #8f918f;">Offline</span>
</div>
<div class="col-xs-4" style="padding-left: 12px; padding-top:11px">
<span id="waterLevel" class="badge badge-primary" style="background-color: #48cded">Water Level 0%</span>
</div>
<div class="col-xs-4" style="padding-left: 12px; padding-top:11px">
<span id="beanLevel" class="badge badge-danger" style="background-color: #f26d7d">Bean Level 0%</span>
</div>
</div>
<!--end status-->
<hr>
<div class="row">
<div class="col-xs-12">
<img class="btn" src="img/coffeeNow.png" style="padding-left: 12px; padding-top: 5px" onclick="coffeeNowCall();"/>
</div>
</div>
<code id="apiResponse"></code>
<hr>
<div class="row">
<div class="col-xs-12" style="padding-left: 14px; padding-top:11px">
<div class="accordion" id="accordionExample">
<div class="card" style="width:24.5rem">
<div class="card-header" id="headingOne">
<h2 class="mb-0">
<center>
<button class="btn btn-danger btn-block" style="background-color: #f26d7d"
type="button" data-toggle="modal" data-target="#exampleModalCenter">
Brew Settings
</button>
</center>
</h2>
</div>
<div id="collapseOne" class="collapse" aria-labelledby="headingOne"
data-parent="#accordionExample">
<div class="card-body" style="width:24.5rem">
</div>
</div>
</div>
<div class="card" style="width:24.5rem">
<div class="card-header" id="headingOne">
<h2 class="mb-0">
<center>
<button class="btn btn-danger btn-block" style="background-color: #f26d7d"
type="button" data-toggle="modal" data-target="#machineSettings">
Connection Settings
</button>
</center>
</h2>
</div>
<div id="collapseOne" class="collapse" aria-labelledby="headingOne"
data-parent="#accordionExample">
<div class="card-body" style="width:24.5rem">
</div>
</div>
</div>
</div>
<div class="row">
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog"
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document" style="padding-left: 7px">
<div class="modal-content bg-dark" style="width:24.5rem">
<div class="card text-white bg-dark mb-3">
<h5 class="card-header">Brew Settings</h5>
<div class="card-body">
<!-- <h5 class="card-title">Select Recipe</h5> -->
<h6>This app currently only brews your saved "Coffee Now" recipe.
Recipe selection will be available in a future update.</h6>
<div class="dropdown">
<button class="btn btn-block dropdown-toggle" type="button"
id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false" style="background-color: #48cded; color: white"
disabled>
Recipes
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"
style="width: 100%;">
</div>
</div>
<hr>
<button class="btn btn-default btn-block"
style="background-color: #f26d7d; color:white;" disabled>New Recipe</button>
<button type="button" class="btn btn-secondary btn-block"
data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="machineSettings" tabindex="-1" role="dialog"
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document" style="padding-left: 7px">
<div class="modal-content bg-dark" style="width:24.5rem">
<div class="card text-white bg-dark mb-3">
<h5 class="card-header">Machine Settings</h5>
<div class="card-body">
<!-- <h5 class="card-title">Select Recipe</h5> -->
<table class="table table-striped table-dark">
<tbody>
<tr>
<th scope="row">Auto Discover:</th>
<td><span class="badge badge-danger"> offline <i
class="fas fa-check-circle"></i></span>
</td>
</tr>
<tr>
<th scope="row">IP:</th>
<td id="ipDisplay"></td>
</tr>
<tr>
<th scope="row">Machine ID:</th>
<td id="machineIdDisplay"></td>
</tr>
</tbody>
</table>
<hr>
<button class="btn btn-default btn-block" data-toggle="modal"
data-target="#editSettings"
style="background-color: #48cded; color:white;">Edit Settings</button>
<br>
<button type="button" class="btn btn-secondary btn-block"
data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="editSettings" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content bg-dark text-white">
<div class="modal-body">
<form>
<div class="form-group">
<label for="ip" class="col-form-label">Mugsy's IP
Address</label>
<input type="text" class="form-control" id="ip">
</div>
<div class="form-group">
<label for="machineId" class="col-form-label">Machine ID</label>
<input type="text" class="form-control" id="machineId">
</div>
<div class="form-group">
<label for="user" class="col-form-label">User Key</label>
<input type="text" class="form-control" id="userKey">
</div>
<div class="form-group">
<label for="apiKey" class="col-form-label">API Key</label>
<input type="text" class="form-control" id="apiKey">
</div>
</form>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="store()" data-dismiss="modal"
style="background-color: #48cded;">Save Settings</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!--end status-->
</div>
<script type="text/javascript">
function store() {
var inputIP = document.getElementById("ip");
var inputMachineId = document.getElementById("machineId");
var ApiKey = document.getElementById("apiKey");
var userKey = document.getElementById("userKey");
localStorage.setItem("ip", inputIP.value);
localStorage.setItem("machineId", inputMachineId.value);
localStorage.setItem("apiKey", ApiKey.value);
localStorage.setItem("userKey", userKey.value);
var storedIP = localStorage.getItem("ip");
var storedMachineId = localStorage.getItem("machineId");
var storedApiKey = localStorage.getItem("apiKey");
var storedUserKey = localStorage.getItem("userKey");
document.getElementById("ipDisplay").innerHTML = storedIP;
document.getElementById("machineIdDisplay").innerHTML = storedMachineId;
}
function showSettings() {
var storedIP = localStorage.getItem("ip");
var storedMachineId = localStorage.getItem("machineId");
var storedApiKey = localStorage.getItem("apiKey");
document.getElementById("ipDisplay").innerHTML = storedIP;
document.getElementById("machineIdDisplay").innerHTML = storedMachineId;
}
function coffeeNowCall() {
var storedUserKey = localStorage.getItem("userKey");
var storedMachineId = localStorage.getItem("machineId");
var storedApiKey = localStorage.getItem("apiKey");
const Http = new XMLHttpRequest();
const url='https://cloud.heymugsy.com/v2/api/alexa/coffeeNowCloud.php?userID='+ storedUserKey
+ '&machineID=' + storedMachineId + '&authKey=' + storedApiKey;
console.log(url)
Http.open("GET", url);
Http.send();
Http.onreadystatechange = (e) => {
console.log(Http.responseText)
document.getElementById("apiResponse").innerHTML = (Http.responseText);
}
}
</script>
</div>
<!--end container-->
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"
integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4"
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>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://kit.fontawesome.com/6884ddcb45.js"></script>
</body>
</body>
</html>