Minor changes to improve browser compatibility.

This commit is contained in:
Paul K3PGM 2024-04-07 14:12:28 -04:00
parent ac664f43a8
commit 6883725ca9
2 changed files with 9 additions and 6 deletions

View File

@ -194,10 +194,13 @@ function html.wait_for_reboot(delay, countdown, address)
const div = document.getElementById("countdown");
if (div) {
let t = Math.round(]] .. countdown .. [[ - (Date.now() - start) / 1000);
div.innerHTML = t <= 0 ? "" : new Date(1000 * t).toISOString().substring(14, 19);
const cdp = document.getElementById("cdProgress");
div.innerHTML = t <= 0 ? "..." : new Date(1000 * t).toISOString().substring(14, 19);
const cdp = document.getElementById("cdprogress");
if (cdp) {
cdp.value = cdp.max - t;
if (t < 0)
cdp.removeAttribute("value");
else
cdp.setAttribute("value", cdp.getAttribute("max") - t);
}
}
}
@ -265,8 +268,8 @@ function html.reboot()
html.print("or<br><a href='http://" .. node .. ".local.mesh:8080/'>http://" .. node .. ".local.mesh:8080/</a></h3>")
end
end
html.print("<br><h3><label for='cdProgress'>Rebooting: </label><progress id='cdProgress' max='120'/></h3>")
html.print("<h1>Time Remaining: <span id='countdown'></h1>")
html.print("<br><h3><label for='cdprogress'>Rebooting: </label><progress id='cdprogress' max='120'/></h3>")
html.print("<h1>Time Remaining: <span id='countdown'/></h1>")
html.print("</center></body></html>")
http_footer()
os.execute("reboot >/dev/null 2>&1")

View File

@ -123,7 +123,7 @@ function print_firmware_notice(reboot_when, href_addr, text_addr)
received a new IP address and reconnect with<br>
<a href='http://]] .. href_addr .. [[:8080/'>http://]] .. text_addr .. [[:8080/</a><br>
This page will automatically reload once the upgrade has completed</h3>
<br><h3><label for='cdProgress'>Writing firmware: </label><progress id='cdProgress' max='300'/></h3>
<br><h3><label for='cdprogress'>Writing firmware: </label><progress id='cdprogress' max='300'/></h3>
<h1>Time Remaining: <span id='countdown'></h1>
</center></body></html>
]])