added remaining settings to websocket-functionality
This commit is contained in:
		| @@ -25,9 +25,7 @@ function initButtons() { | ||||
|   if (elements.length > 0) { | ||||
|     for (var i = 0; i < elements.length; i++) { | ||||
|       let element = elements[i]; | ||||
|       element.addEventListener("click", function () { | ||||
|         websocket_sendevent("btn-" + element.id, 0); | ||||
|       }); | ||||
|       element.addEventListener("click", sendButton); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -55,6 +53,18 @@ function onClose(event) { | ||||
|   overlay.style.display = "flex"; | ||||
| } | ||||
|  | ||||
| function sendButton(event) { | ||||
|   var targetElement = event.target; | ||||
|  | ||||
|   if ( | ||||
|     targetElement.classList.contains("confirm") && | ||||
|     window.confirm("Sicher?") == false | ||||
|   ) | ||||
|     return; | ||||
|  | ||||
|   websocket_sendevent("btn-" + targetElement.id, targetElement.value); | ||||
| } | ||||
|  | ||||
| function onMessage(event) { | ||||
|   var data = event.data; | ||||
|   console.log("ws_msg:" + event.data + "\n"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user