battery-minus

Pebble activity tracker that records battery events
git clone https://git.instinctive.eu/battery-minus.git
Log | Files | Refs | README | LICENSE

commit 28ebdb17c4830520f49be884bda000b95ce90a7c
parent a4c60032ba4815e1fb26c1e894f9fee3098f1809
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date:   Wed, 18 May 2016 21:26:02 +0000

Add configuration UI for automatic wakeup time
Diffstat:
Mconfig.html | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/config.html b/config.html @@ -60,6 +60,8 @@ "signFieldName": document.getElementById("signFieldName").value, "signKey": document.getElementById("signKey").value, "signKeyFormat": document.getElementById("signKeyFormat").value, + "wakeupTime" : document.getElementById("wakeupEnable").checked + ? document.getElementById("wakeupTime").value : "-1", "extraFields" : readAndEncodeList("extraFields").join(","), } @@ -75,6 +77,12 @@ = document.getElementById("signEnable").checked ? "block" : "none"; } + + function updateWakeupVisibility() { + document.getElementById("wakeupFields").style.display + = document.getElementById("wakeupEnable").checked + ? "block" : "none"; + } </script> </head> <body> @@ -105,6 +113,22 @@ </div> <div class="item-container"> + <div class="item-container-header">Auto Wakeup</div> + <div class="item-container-content"> + <label class="item"> + Enable Auto Wakeup + <input type="checkbox" class="item-toggle" name="wakeupEnable" id="wakeupEnable" onchange="updateWakeupVisibility();"> + </label> + <div id="wakeupFields"> + <label class="item"> + Wake-up time + <input type="time" class="item-time" name="wakeupTime" id="wakeupTime" value="00:00"> + </label> + </div> + </div> + </div> + + <div class="item-container"> <div class="item-container-header">Data Signature</div> <div class="item-container-content"> <label class="item"> @@ -194,7 +218,17 @@ document.getElementById("signKeyFormat").value = getQueryParam("s_keyf", "HEX"); document.getElementById("signEnable").checked = (getQueryParam("s_field", "") !== ""); + var initWakeupTime = parseInt(getQueryParam("wakeup", "-1")); + if (initWakeupTime >= 0) { + var wakeupMin = initWakeupTime % 60; + document.getElementById("wakeupEnable").checked = true; + document.getElementById("wakeupTime").value = (initWakeupTime / 60 | 0).toString(10) + (wakeupMin >= 10 ? ":" : ":0") + wakeupMin.toString(10); + } else { + document.getElementById("wakeupEnable").checked = false; + } + updateSignVisibility(); + updateWakeupVisibility(); var initExtraFields = ("," + getRawQueryParam("extra", "")).split(","); initExtraFields.shift();