diff --git a/raspberry-backend/templates/base.html b/raspberry-backend/templates/base.html index 4ffb363838d3fc3e8d5d0991ad1b9e41a8d56b91..c8b29c37378bfe9ba49bead039c27ae31248dfe6 100644 --- a/raspberry-backend/templates/base.html +++ b/raspberry-backend/templates/base.html @@ -41,8 +41,10 @@ <!-- Battery --> <ul class="navbar-nav ml-auto mr-0 mr-md-3 my-2 my-md-0"> <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="battery-full" class="svg-inline--fa fa-battery-full fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"> + <!--Powered --> + <path class="path-icon transparent" id = "powered" d="M320,32a32,32,0,0,0-64,0v96h64Zm48,128H16A16,16,0,0,0,0,176v32a16,16,0,0,0,16,16H32v32A160.07,160.07,0,0,0,160,412.8V512h64V412.8A160.07,160.07,0,0,0,352,256V224h16a16,16,0,0,0,16-16V176A16,16,0,0,0,368,160ZM128,32a32,32,0,0,0-64,0v96h64Z"></path> <!-- Full --> - <path class="path-icon" id = "battery-full" d="M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48zm-48 96H96v128h416V192z"></path> + <path class="path-icon transparent" id = "battery-full" d="M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48zm-48 96H96v128h416V192z"></path> <!-- Empty --> <path class="path-icon-alarm transparent" id = "battery-empty" d="M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48z"></path> <!--Three Quarter --> @@ -53,16 +55,6 @@ <path class="path-icon-alarm transparent" id ="battery-one-quarter" d="M544 160v64h32v64h-32v64H64V160h480m16-64H48c-26.51 0-48 21.49-48 48v224c0 26.51 21.49 48 48 48h512c26.51 0 48-21.49 48-48v-16h8c13.255 0 24-10.745 24-24V184c0-13.255-10.745-24-24-24h-8v-16c0-26.51-21.49-48-48-48zm-336 96H96v128h128V192z"> </svg> </ul> - <!-- - <ul class = "navbar-nav ml-auto mr-0 mr-md-3 my-2 my-md-0"> - <a class="unlock" id="toggle_lock" onclick="toggle_lock()"> - <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="lock" class="svg-inline--fa fa-lock fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"> - <path class="path-icon" id = "path-locked-main" d="M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"></path> - <path class="path-icon transparent" id="path-unlocked-main" d="M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"></path> - </svg> - </a> - </ul> - --> </nav> <div id="layoutSidenav"> @@ -149,8 +141,16 @@ var lockTimer; + var idleTimer; var unlocked = Boolean(false); - + + {% if not fan_active %} + idleTimer = setTimeout( idleRedirect, 5000 ); + {% endif %} + function idleRedirect(){ + window.location.href = "/"; + } + function timeOutLock(){ window.createNotification({ closeOnClick: 1, @@ -224,7 +224,8 @@ function lock() { - var x = document.getElementsByClassName("input-editable"); + clearTimeout(lockTimer); + var x = document.getElementsByClassName("input-editable"); for (i = 0; i < x.length; i++) {x[i].readOnly=true;x[i].disabled = true;} var el = document.getElementById("path-locked-main"); el.classList.remove("transparent"); @@ -247,18 +248,33 @@ if (unlocked) { clearTimeout(lockTimer); lockTimer = setTimeout('timeOutLock()', 10000); + } - }) - $(this).keypress(function (e) { + + {% if not fan_active %} + clearTimeout(idleTimer); + idleTimer = setTimeout( idleRedirect, 5000 ); + {% endif %} + }); + + $(this).keypress(function (e) { + console.log('keypress'); if (unlocked) { clearTimeout(lockTimer); - lockTimer = setTimeout('timeOutLock()', 10000);} - }) + lockTimer = setTimeout('timeOutLock()', 10000); + } + {% if not fan_active %} + clearTimeout(idleTimer); + idleTimer = setTimeout( idleRedirect, 5000 ); + {% endif %} + }); - var battery = 100; + var battery = 120; function update_battery() { // set all transparent + var powered = document.getElementById("powered"); + powered.classList.add("transparent"); var full = document.getElementById("battery-full"); full.classList.add("transparent"); three_qtr = document.getElementById("battery-three-quarter"); @@ -271,18 +287,46 @@ empty.classList.add("transparent"); - // find the one to show - if ( battery >=87.5 ) {full.classList.remove("transparent");} + // find the one to show + if (battery > 100.0) { powered.classList.remove("transparent"); } + else if ( battery >=87.5 && battery <= 100.0 ) {full.classList.remove("transparent");} else if (battery >= 67.5 && battery < 87.5) { three_qtr.classList.remove("transparent"); } else if (battery >= 37.5 && battery < 67.5) { half.classList.remove("transparent"); } else if (battery >= 7.5 && battery < 37.5) { one_qtr.classList.remove("transparent"); } else { empty.classList.remove("transparent"); } battery = battery - 1; - if (battery <= 0 ) battery = 100; - } - var batteryInterval = setInterval('update_battery()', 1000); - </script> + if (battery <= 0 ) battery = 120; + } var batteryInterval = setInterval('update_battery()', 1000); + var prev_val; + +$('.input-editable').focus(function() { + prev_val = $(this).val(); +}).change(function() { +$(this).blur() // Firefox fix as suggested by AgDude +/*window.createNotification({ + closeOnClick: 0, + displayCloseButton: 1, + positionClass: "nfc-bottom-right", + showDuration: false, + theme: "info" + })({ + title: "Screen Lock", + message: "Screen has locked due to timeout" + });*/ + var success = confirm('Are you sure you want to change the ' + $(this).name + " from" + prev_val + " to " + $(this).val()); + if(success) +{ +//send to hevserver +$(this).val($(this).val()); + } + else + { + $(this).val(prev_val); +} +lock(); +}); + </script> </body> diff --git a/raspberry-backend/templates/index.html b/raspberry-backend/templates/index.html index 12862531deea3869b7e0b69b8bac79b96e8734fd..e12bba4667783dd9cbaf2b2205ecb5cf40f720ce 100644 --- a/raspberry-backend/templates/index.html +++ b/raspberry-backend/templates/index.html @@ -56,11 +56,13 @@ </div> </div> - <div class="card-reading"> + <div class="card-reading br-red"> <div class="card-header d-flex align-items-center justify-content-between py-1 min-height-1b"> <a class="small text-dark col-center" href="#">FIO<sub>2</sub></a> </div> - <div class="card-body px-1 py-1 tiny ml-auto mr-auto"><input class = "input-reading py-0" id = "fio2" value="62" type="number" readOnly disabled>%</div> + <div class="card-body px-1 py-1 tiny ml-auto mr-auto br-red"> + <div class = "reading-wrapper br-red"><input class = "input-reading py-0" id = "fio2" value="62" type="number" readOnly disabled>%</div> + </div> </div> <div class="card-reading"> @@ -191,37 +193,6 @@ <script src="{{ url_for('static', filename='js/Chart-display.js') }}"></script> - <script> -var prev_val; - -$('.input-editable').focus(function() { - prev_val = $(this).val(); -}).change(function() { -$(this).blur() // Firefox fix as suggested by AgDude - -window.createNotification({ - closeOnClick: 0, - displayCloseButton: 1, - positionClass: "nfc-bottom-right", - showDuration: false, - theme: "info" - })({ - title: "Screen Lock", - message: "Screen has locked due to timeout" - }); - var success = confirm('Are you sure you want to change the ' + $(this).name + " from" + prev_val + " to " + $(this).val()); - if(success) -{ -//send to hevserver -$(this).val($(this).val()); - } - else - { - $(this).val(prev_val); -} -lock(); -}); - </script> <script> pickout.to({ el:'.pickout',