added an overlay to the WebUI and some ConnectionHandling
This commit is contained in:
		| @@ -3,8 +3,13 @@ var websocket; | ||||
|  | ||||
| var statusMapping; | ||||
| var staticMapping; | ||||
| var overlay; | ||||
|  | ||||
| window.addEventListener("load", onLoad); | ||||
| document.addEventListener("DOMContentLoaded", function () { | ||||
|   // Ihr JavaScript-Code hier, einschließlich der onLoad-Funktion | ||||
|   overlay = document.getElementById("overlay"); | ||||
|   onLoad(); | ||||
| }); | ||||
|  | ||||
| function initWebSocket() { | ||||
|   console.log("Trying to open a WebSocket connection..."); | ||||
| @@ -46,7 +51,8 @@ function onOpen(event) { | ||||
|  | ||||
| function onClose(event) { | ||||
|   console.log("Connection closed"); | ||||
|   setTimeout(initWebSocket, 2000); | ||||
|   setTimeout(initWebSocket, 1000); | ||||
|   overlay.style.display = "flex"; | ||||
| } | ||||
|  | ||||
| function onMessage(event) { | ||||
| @@ -98,6 +104,7 @@ function onMessage(event) { | ||||
|     console.log("STATIC:"); | ||||
|     console.log(JSON.stringify(result, null, 2)); | ||||
|     fillValuesToHTML(result); | ||||
|     overlay.style.display = "none"; | ||||
|     return; | ||||
|   } | ||||
| } | ||||
| @@ -130,6 +137,7 @@ function onLoad(event) { | ||||
|   initWebSocket(); | ||||
|   initButtons(); | ||||
|   initSettingInputs(); | ||||
|   overlay.style.display = "flex"; | ||||
| } | ||||
|  | ||||
| function websocket_sendevent(element_id, element_value) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user