-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
386 lines (352 loc) · 22 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
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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="color-scheme" content="dark, light">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" sizes="180x180" href="./assets/images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="./assets/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="./assets/images/favicon-16x16.png">
<link rel="manifest" href="./site.webmanifest">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css">
<link rel="stylesheet" href="./assets/css/styles.css">
<title>Battery Voltage Monitor</title>
</head>
<body>
<div class="container mt-5">
<hgroup>
<h1>Battery Voltage Monitor</h1>
<p id="subtitle">Visualize battery voltage on the go</p>
</hgroup>
<div class="d-flex justify-content-between align-items-center mb-3">
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="check2" viewBox="0 0 16 16">
<path
d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z">
</path>
</symbol>
<symbol id="circle-half" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"></path>
</symbol>
<symbol id="moon-stars-fill" viewBox="0 0 16 16">
<path
d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z">
</path>
<path
d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z">
</path>
</symbol>
<symbol id="sun-fill" viewBox="0 0 16 16">
<path
d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z">
</path>
</symbol>
</svg>
<!-- Add battery modal trigger -->
<button id="add-button" type="button" class="btn btn-success shadow" data-bs-toggle="modal"
data-bs-target="#add-battery-modal">Add Battery
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor"
class="battery-indicator battery-indicator-plus-circle-fill" viewBox="0 0 16 16">
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3z" />
</svg>
</button>
<div id="alert-box">
<div id="add-battery-alert" class="alert alert-success alert-dismissible fade" role="alert">
<a data-bs-target="#add-battery-modal" data-bs-toggle="modal" href="javascript:void(0);">Add a battery</a> to get
started.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div id="add-reading-alert" class="alert alert-info alert-dismissible fade" role="alert">
<a data-bs-target="#add-reading-modal" data-bs-toggle="modal" href="javascript:void(0);">Add a reading</a> to get
started.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
<!-- Light/Dark/Auto Theme Switching-->
<ul id="theme-selector">
<li class="dropdown">
<button class="btn btn-link nav-link dropdown-toggle d-flex align-items-center" id="bd-theme"
type="button" aria-expanded="false" data-bs-toggle="dropdown" data-bs-display="static"
aria-label="Toggle theme (dark)">
<svg class="battery-indicator my-1 theme-icon-active">
<use href="#moon-stars-fill"></use>
</svg>
<span class="d-lg-none ms-2" id="bd-theme-text">Toggle theme</span>
</button>
<ul id="theme-selection" class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-theme-text">
<li>
<button type="button" class="dropdown-item d-flex align-items-center"
data-bs-theme-value="light" aria-pressed="false">
<svg class="battery-indicator me-2 opacity-50 theme-icon">
<use href="#sun-fill"></use>
</svg>
Light
<svg class="battery-indicator ms-auto d-none">
<use href="#check2"></use>
</svg>
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center active"
data-bs-theme-value="dark" aria-pressed="true">
<svg class="battery-indicator me-2 opacity-50 theme-icon">
<use href="#moon-stars-fill"></use>
</svg>
Dark
<svg class="battery-indicator ms-auto d-none">
<use href="#check2"></use>
</svg>
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center"
data-bs-theme-value="auto" aria-pressed="false">
<svg class="battery-indicator me-2 opacity-50 theme-icon">
<use href="#circle-half"></use>
</svg>
Auto
<svg class="battery-indicator ms-auto d-none">
<use href="#check2"></use>
</svg>
</button>
</li>
</ul>
</li>
</ul>
</div>
<h2 class="text-center mb-0">Voltage Readings</h2>
<div id="chartContainer" class="col-12 mx-auto mb-5"> <!-- Chart will be loaded here --> </div>
<hr>
<h2 id="batteries" class="heading">Batteries</h2>
<div id="card-box" class="row gap-3 my-3 justify-content-center">
<!-- Battery cards will be rendered here -->
</div>
<hr>
<h2 id="voltage-readings" class="heading">Voltage Readings</h2>
<div id="voltage-reading-table-container">
<!-- Voltage readings for all batteries will be rendered here -->
</div>
<hr>
<div id="instructions">
<h2 class="heading">Instructions</h2>
<ol class="fit-center">
<li>
<b>Adding a new battery</b><br>
<ul>
<li>Click the green "Add Battery" button at the top of the page</li>
<li>In the popup, give your battery the following information:</li>
<ul>
<li>Nickname</li>
<li>Brand (or description)</li>
<li>Select whether the battery is a deep cycle</li>
<li>Enter the rated amp hours (deep cycle) or CCA rating (non deep cycle)</li>
<li>Select a colour (color for our imperial friends 😉)</li>
</ul>
<li>Click the green "Add" button</li>
</ul>
</li>
<li>
<b>Updating a battery</b>
<ul>
<li>On the battery card, click the "Edit / Add Reading" button</li>
<li>Change any of the battery information</li>
<li>Click the green "Update" button</li>
</ul>
</li>
<li>
<b>Delete a battery</b> - <i>NOTE: This will delete all readings for this battery and cannot be undone</i>
<ul>
<li>Click the "X" in the battery card's top right corner</li>
<li>Click "Ok" in the confirmation dialog to confirm, or "Cancel" to abort</li>
</ul>
</li>
<li>
<b>Add a battery voltage reading</b>
<ul>
<li>On the appropriate battery card, click the "Edit / Add Reading" button</li>
<li>In the popup, click the blue "Add Reading" button</li>
<li>A new popup will appear where you can enter the voltage reading (E.g. "12.45")</li>
<li>
Click the "Add" button to add the reading, or cancel to abort.<br>
You should now see your voltage reading on the graph as well as in the <a href="#voltage-readings">voltage readings</a> table.
</li>
</ul>
</li>
<li>
<b>Change a voltage reading</b><br>
If you have entered an incorrect voltage, you can update the reading
<ul>
<li>In the <a href="#voltage-readings">voltage readings</a> table, click the "Edit" button</li>
<li>In the prompt, enter a new voltage reading value to replace the current one</li>
<li>Click "Ok" to confirm the changes or "Cancel" to abort</li>
</ul>
</li>
<li>
<b>Delete a voltage reading</b>
<ul>
<li>In the <a href="#voltage-readings">voltage readings</a> table, click the "Delete" button relative to the reading you wish to delete</li>
<li>In the confirmation prompt, click "Ok" to confirm deletion or "Cancel" to abort</li>
</ul>
</li>
</ol>
</div>
<h5 class="m-5 text-center">
This site is still in the making, so <a href="feedback.html">click here</a> to suggest an edit or improvement!
</h5>
<!-- Add Battery Modal -->
<div class="modal fade" id="add-battery-modal" tabindex="-1" aria-labelledby="addBatteryModal"
aria-hidden="true">
<form id="add-battery-form" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="addBatteryModal">Add a new battery</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label for="nickname" class="form-label">Nickname</label>
<input type="text" class="form-control" name="nickname" id="nickname"
aria-describedby="nickname-help">
<div id="nickname-help" class="form-text">A name to help you recognize this battery</div>
</div>
<div class="mb-3">
<label for="brand" class="form-label">Brand</label>
<input type="text" class="form-control" name="brand" id="brand"
aria-describedby="brand-help">
<div id="brand-help" class="form-text">E.g. Century N70ZZ</div>
</div>
<div class="row mb-3 gap-2">
<div class="col align-self-center">
<input type="checkbox" class="form-check-input" checked name="deepCycle" id="deepCycle">
<label for="deepCycle" class="form-check-label">Deep Cycle?</label>
</div>
<div id="ampHoursDiv" class="col">
<label for="ampHours" class="form-label">Amp Hours</label>
<input type="number" min="0" max="2000" name="ampHours" id="ampHours"
class="form-control">
</div>
<div id="ccaDiv" class="col" hidden>
<label for="cca" class="form-label col">Cold Cranking Amps</label>
<input type="number" min="0" max="2000" name="cca" id="cca" class="col form-control">
</div>
</div>
<div class="col">
<label for="color" class="form-label">Color picker</label>
<input type="color" class="form-control form-control-color" id="color" value="#563d7c"
title="Choose your color">
</div>
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-success" data-bs-dismiss="modal">Add</button>
</div>
</div>
</form>
</div>
<!-- Edit Battery Modal -->
<div class="modal fade" id="edit-battery-modal" tabindex="-1" aria-labelledby="editBatteryModal" aria-hidden="true">
<form id="edit-battery-form" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="editBatteryModal">Edit</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="edit-id" id="edit-id">
<div class="mb-3">
<label for="edit-nickname" class="form-label">Nickname</label>
<input type="text" class="form-control" name="edit-nickname" id="edit-nickname"
aria-describedby="nickname-help">
<div id="nickname-help" class="form-text">A name to help you recognize this battery</div>
</div>
<div class="mb-3">
<label for="edit-brand" class="form-label">Brand</label>
<input type="text" class="form-control" name="edit-brand" id="edit-brand"
aria-describedby="edit-brand-help">
<div id="edit-brand-help" class="form-text">E.g. Century N70ZZ</div>
</div>
<div class="row mb-3 gap-2">
<div class="col align-self-center">
<input type="checkbox" class="form-check-input" checked name="edit-deepCycle"
id="edit-deepCycle">
<label for="edit-deepCycle" class="form-check-label">Deep Cycle?</label>
</div>
<div id="edit-ampHoursDiv" class="col">
<label for="edit-ampHours" class="form-label">Amp Hours</label>
<input type="number" min="0" max="2000" name="edit-ampHours" id="edit-ampHours"
class="form-control">
</div>
<div id="edit-ccaDiv" class="col" hidden>
<label for="edit-cca" class="form-label col">Cold Cranking Amps</label>
<input type="number" min="0" max="2000" name="edit-cca" id="edit-cca"
class="col form-control">
</div>
</div>
<div class="col">
<label for="edit-color" class="form-label">Color picker</label>
<input type="color" class="form-control form-control-color" id="edit-color" value="#000000"
title="Choose your color">
</div>
</div>
<div class="modal-footer">
<!-- Add battery reading modal trigger -->
<button id="add-reading-button" type="button" class="btn btn-primary" data-bs-toggle="modal"
data-bs-target="#add-reading-modal">Add Reading
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-bolt" width="24"
height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11" />
</svg>
</button>
<button type="reset" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-success" data-bs-dismiss="modal">Update</button>
</div>
</div>
</form>
</div>
<!-- Add Reading Modal -->
<div class="modal fade" id="add-reading-modal" tabindex="-1" aria-labelledby="addReadingModal" aria-hidden="true">
<form id="add-reading-form" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="addReadingModal">Add a new voltage Reading</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label for="volts" class="form-label">Volts</label>
<input type="text" class="form-control" name="volts" id="volts"
aria-describedby="volts-help">
<div id="volts-help" class="form-text">Enter the voltage reading upto 2 decimal places</div>
</div>
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-success" data-bs-dismiss="modal">Add</button>
</div>
</div>
</form>
</div>
<hr>
</div>
<footer>
<div>Copyright © <script>document.writeln(new Date().getFullYear())</script> <a href="https://aussiedev81.com"
target="_blank">AussieDev81</a></div>
<div><span class="separator"> - </span>All Rights Reserved</div>
</footer>
<div class="text-center fst-italic">View the <a href="https://github.com/AussieDev81/battery-monitor"
target="_blank">GitHub</a> repository</div>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script src="https://unpkg.com/gridjs/dist/gridjs.umd.js"></script>
<script src="./assets/js/scripts.js"></script>
<script src="./assets/js/theme.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz"
crossorigin="anonymous"></script>
</body>
</html>