mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 04:07:47 +00:00
Sketch size is reduced by 5 - 6 kB Files are extracted from original source and moved to `static` directory.
34 lines
675 B
JavaScript
34 lines
675 B
JavaScript
i = document.getElementById('rbtmsg');
|
|
i.innerHTML = "Please reboot: <input id='reboot' class='button link' value='Reboot' type='submit' onclick='r()'>";
|
|
var x = new XMLHttpRequest();
|
|
|
|
//done
|
|
function d() {
|
|
i.innerHTML = '';
|
|
clearTimeout(t);
|
|
}
|
|
|
|
|
|
//keep requesting mainpage until no more errors
|
|
function c() {
|
|
i.innerHTML += '.';
|
|
x.onload = d;
|
|
x.open('GET', window.location.origin);
|
|
x.send();
|
|
}
|
|
|
|
//rebooting
|
|
function b() {
|
|
i.innerHTML = 'Rebooting..';
|
|
t = setInterval(c, 2000);
|
|
}
|
|
|
|
|
|
//request reboot
|
|
function r() {
|
|
i.innerHTML += ' (requesting)';
|
|
x.onload = b;
|
|
x.open('GET', window.location.origin + '/?cmd=reboot');
|
|
x.send();
|
|
}
|