From 4a60e002b8ed29133f37207bd5cd405c5aaa0856 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 1 Aug 2023 17:53:40 +0100 Subject: [PATCH] hide cw buttons if not connected --- assets/js/winkey.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/winkey.js b/assets/js/winkey.js index 3391ebb1..bbb54c39 100644 --- a/assets/js/winkey.js +++ b/assets/js/winkey.js @@ -1,6 +1,8 @@ // Lets see if CW is selected const ModeSelected = document.getElementById('mode'); +$('#winkey_buttons').hide(); + if (location.protocol == 'http:') { // Do something if the page is being served over SSL $('#winkey').hide(); // Hide the CW buttons @@ -132,6 +134,8 @@ async function connect() { writeToByte("0x00, 0x02"); writeToByte("0x02, 0x00"); + $('#winkey_buttons').show(); + reader = inputStream.getReader(); readLoop(); } catch (e) { @@ -154,8 +158,6 @@ async function writeToStream(line) { } async function writeToByte(line) { - var enc = new TextEncoder(); // always utf-8 - const writer = outputStream.getWriter(); const data = new Uint8Array([line]); writer.write(line);