mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-17 03:59:59 +01:00
Web interface "loading..." banner
This commit is contained in:
@@ -28,12 +28,15 @@ function convertLineBreaks(str) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMessage(msg, closeAfter) {
|
function showMessage(msg) {
|
||||||
if (msg.startsWith("ERROR")) {
|
if (msg.startsWith("ERROR")) {
|
||||||
getE("status").style.backgroundColor = "#d33";
|
getE("status").style.backgroundColor = "#d33";
|
||||||
getE("status").innerHTML = "disconnected";
|
getE("status").innerHTML = "disconnected";
|
||||||
|
|
||||||
console.error("disconnected (" + msg + ")");
|
console.error("disconnected (" + msg + ")");
|
||||||
|
} else if (msg.startsWith("LOADING")) {
|
||||||
|
getE("status").style.backgroundColor = "#fc0";
|
||||||
|
getE("status").innerHTML = "loading...";
|
||||||
} else {
|
} else {
|
||||||
getE("status").style.backgroundColor = "#3c5";
|
getE("status").style.backgroundColor = "#3c5";
|
||||||
getE("status").innerHTML = "connected";
|
getE("status").innerHTML = "connected";
|
||||||
@@ -72,11 +75,14 @@ function getFile(adr, callback, timeout, method, onTimeout, onError) {
|
|||||||
request.onreadystatechange = function () {
|
request.onreadystatechange = function () {
|
||||||
if (this.readyState == 4) {
|
if (this.readyState == 4) {
|
||||||
if (this.status == 200) {
|
if (this.status == 200) {
|
||||||
|
showMessage();
|
||||||
callback(this.responseText);
|
callback(this.responseText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
showMessage("LOADING");
|
||||||
|
|
||||||
/* send request */
|
/* send request */
|
||||||
request.send();
|
request.send();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user