diff --git a/public/index.html b/public/index.html index 800cb80..00458bf 100644 --- a/public/index.html +++ b/public/index.html @@ -48,84 +48,84 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -142,17 +142,17 @@ const client = io() document.addEventListener('click', (event) => { const item = event.target - if (item.classList.contains('led')) { - item.classList.toggle('on') - const { x, y } = item.dataset - const action = item.classList.contains('on') ? 'on' : 'off' - client.emit('action', { action, x, y }) - } else if (item.classList.contains('button')) { + if (item.classList.contains('button')) { const { action } = item.dataset document.querySelectorAll('.led').forEach((led) => led.classList.remove('on')) client.emit('action', { action }) } }) + function turnon(led) { + const { x, y } = led.dataset + const action = led.classList.toggle('on') ? 'on' : 'off' + client.emit('action', { action, x, y }) + }