From bde8fd954570701029a1160285b4722d33a58eff Mon Sep 17 00:00:00 2001 From: David Huss <dh@atoav.com> Date: Wed, 6 Nov 2024 16:22:31 +0100 Subject: [PATCH] Source selector won't send command if already active --- static/helpers.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/static/helpers.js b/static/helpers.js index da6432e..88b4650 100755 --- a/static/helpers.js +++ b/static/helpers.js @@ -306,6 +306,14 @@ class SourceSelector { button.textContent = this.name; button.source_selector = this; button.addEventListener("click", function(event) { + if (event.target.classList.contains("active")) { + console.log(`Did not send switch command (${command}): was already active`); + return; + } + if (event.target.classList.contains("requested")) { + console.log(`Did not send switch command (${command}): was already requested`); + return; + } let source_selector = event.target.source_selector; let command = "switch-video"; ws2.send(JSON.stringify({command: command, number: source_selector.number})); -- GitLab