40 lines
5.5 KiB
Plaintext
Vendored
40 lines
5.5 KiB
Plaintext
Vendored
<% if (plugins.nightscout) { %>
|
|
<section>
|
|
<h2 class="field">
|
|
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="16px" height="19px" viewBox="0 0 806 1108"><g transform="translate(0,1108) scale(0.100000,-0.100000)" stroke="none"><path d="M3770 11074 c-596 -51 -1037 -168 -1505 -397 -198 -97 -288 -149 -475 -273 -987 -656 -1625 -1702 -1767 -2899 -24 -210 -25 -748 0 -995 89 -890 324 -1717 746 -2630 522 -1127 1482 -2471 2527 -3535 229 -233 449 -335 724 -335 194 0 359 50 530 161 134 87 677 668 1051 1124 662 807 1146 1537 1553 2344 224 445 358 764 507 1211 207 624 316 1144 365 1749 22 271 15 762 -15 976 -37 271 -82 473 -158 710 -337 1047 -1073 1901 -2058 2384 -426 210 -832 328 -1325 386 -127 16 -596 28 -700 19z m660 -649 c790 -107 1475 -448 2011 -1002 680 -703 1007 -1583 959 -2581 -63 -1336 -575 -2703 -1548 -4137 -366 -540 -899 -1201 -1377 -1709 -296 -314 -350 -353 -470 -344 -95 8 -146 42 -293 192 -912 938 -1720 2045 -2242 3071 -448 881 -712 1741 -807 2620 -24 230 -24 771 0 945 58 414 158 740 333 1090 374 748 1011 1333 1783 1640 304 120 607 193 911 219 69 6 143 13 165 15 86 9 466 -4 575 -19z"/><path d="M3805 9814 c-16 -2 -73 -9 -125 -15 -470 -52 -927 -237 -1329 -536 -140 -105 -416 -377 -519 -514 -40 -52 -72 -98 -72 -101 0 -4 43 9 96 28 128 46 308 81 486 95 423 34 849 -76 1198 -309 133 -89 323 -267 415 -391 33 -44 63 -80 66 -81 3 0 29 30 57 68 298 401 755 654 1284 711 256 28 581 -8 821 -92 53 -19 97 -30 97 -26 0 23 -171 231 -285 345 -434 438 -946 698 -1572 800 -93 15 -543 28 -618 18z"/><path d="M2276 8179 c-442 -65 -797 -358 -949 -786 -87 -241 -89 -568 -7 -948 156 -717 625 -1369 1269 -1760 356 -216 734 -342 1155 -385 149 -16 532 -8 674 14 256 39 518 116 749 219 580 261 1056 723 1338 1302 156 318 241 627 275 995 23 249 -20 500 -122 705 -109 217 -311 421 -519 523 -192 93 -344 126 -589 126 -153 0 -189 -3 -286 -26 -471 -111 -783 -425 -902 -908 l-26 -105 -5 -845 c-6 -785 -7 -847 -24 -871 -30 -45 -53 -49 -285 -49 -197 0 -220 2 -249 20 -17 10 -38 29 -45 42 -10 18 -14 198 -19 873 -5 818 -6 853 -26 935 -124 505 -473 840 -963 924 -101 17 -340 20 -444 5z m459 -147 c160 -42 274 -101 418 -214 237 -186 381 -467 394 -769 14 -315 -81 -568 -299 -795 -301 -314 -747 -412 -1154 -255 -230 89 -464 306 -574 535 -137 283 -139 621 -6 902 154 324 436 543 789 610 106 20 330 13 432 -14z m3087 -5 c379 -100 674 -394 775 -776 23 -84 26 -116 26 -256 1 -142 -2 -171 -26 -260 -156 -582 -751 -931 -1318 -774 -438 121 -763 529 -786 984 -9 188 36 384 127 553 55 102 103 163 206 261 143 138 299 226 475 270 114 28 134 29 289 26 106 -2 156 -8 232 -28z"/><path d="M2406 7439 c-210 -31 -375 -223 -376 -435 0 -128 41 -235 125 -323 90 -95 196 -141 325 -141 196 0 369 118 429 293 117 338 -151 660 -503 606z"/><path d="M5505 7443 c-163 -23 -290 -117 -358 -261 -40 -86 -49 -217 -22 -318 49 -180 210 -310 399 -321 199 -13 362 80 449 257 31 63 32 70 32 190 0 120 -1 128 -32 192 -35 74 -106 157 -167 195 -77 49 -213 79 -301 66z"/><path d="M1966 4303 c89 -192 278 -539 437 -803 94 -156 324 -508 400 -613 l34 -48 45 63 c141 197 489 747 513 810 5 13 -5 18 -52 28 -32 6 -125 29 -208 51 -400 108 -790 298 -1128 551 -43 32 -80 58 -82 58 -2 0 16 -44 41 -97z"/><path d="M6049 4352 c-544 -410 -1158 -633 -1870 -678 l-106 -6 -73 -132 c-175 -315 -465 -772 -678 -1069 -51 -71 -92 -134 -92 -141 0 -13 176 -232 329 -411 116 -136 438 -492 452 -500 14 -9 51 26 239 235 746 827 1333 1667 1759 2517 77 154 113 233 107 233 -2 0 -32 -22 -67 -48z"/></g></svg>
|
|
<% if (plugins.nightscout.error) { %>
|
|
Nightscout plugin
|
|
<% } else { %>
|
|
Blood Sugar: <%= `${plugins.nightscout.data[plugins.nightscout.data.length-1].sgv}${plugins.nightscout.data[plugins.nightscout.data.length-1].arrowHumanReadable} (${plugins.nightscout.data[plugins.nightscout.data.length-1].alert})`%>
|
|
<% } %>
|
|
</h2>
|
|
<div class="row">
|
|
<% if (plugins.nightscout.error) { %>
|
|
<section>
|
|
<div class="field error">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.343 13.657A8 8 0 1113.657 2.343 8 8 0 012.343 13.657zM6.03 4.97a.75.75 0 00-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 101.06 1.06L8 9.06l1.97 1.97a.75.75 0 101.06-1.06L9.06 8l1.97-1.97a.75.75 0 10-1.06-1.06L8 6.94 6.03 4.97z"></path></svg>
|
|
<%= plugins.nightscout.error.message %>
|
|
</div>
|
|
</section>
|
|
<% } else if (plugins.nightscout.data.length > 1) { %>
|
|
<section class="column chart">
|
|
<div class="chart-bars" style="margin-top: 0px; margin-bottom:0px;">
|
|
<div class="field" style="width: 200%;">
|
|
<% { let previous = null; for (const dataObject of Object.values(plugins.nightscout.data)) { const p = dataObject.sgv/Math.max.apply(Math, Object.values(plugins.nightscout.data).map(function(o) { return o.sgv; })); %>
|
|
<div class="entry" style="margin-top: auto;">
|
|
<span class="value" style="font-size: <%= 125*(10/plugins.nightscout.data.length) %>%;"><%= dataObject.sgv != 0 ? f(dataObject.sgv, {sign:false}) : "" %></span>
|
|
<div class="bar" style="height: <%= p*75 %>px; width: 50%; background-color: <%= dataObject.color %>"></div>
|
|
<div style="font-size: <%= 125*(10/plugins.nightscout.data.length) %>%;">
|
|
<%= dataObject.timeUTCHumanReadable %>
|
|
</div>
|
|
</div>
|
|
<% previous = dataObject.sgv } } %>
|
|
</div>
|
|
</div>
|
|
<div class="bottom"><i>All times are in UTC.</i></div>
|
|
</section>
|
|
<% } %>
|
|
</div>
|
|
</section>
|
|
<% } %>
|