Hide winkey buttons

这个提交包含在:
Peter Goodhall 2023-08-01 16:37:57 +01:00
父节点 fc687978f8
当前提交 b79229f326
共有 2 个文件被更改,包括 12 次插入4 次删除

查看文件

@ -533,7 +533,7 @@
</h4> </h4>
</div> </div>
<div class="card-body"> <div id="winkey_buttons" class="card-body">
<div id="modals-here"></div> <div id="modals-here"></div>
<button id="morsekey_func1" onclick="morsekey_func1()" class="btn btn-warning">F1</button> <button id="morsekey_func1" onclick="morsekey_func1()" class="btn btn-warning">F1</button>
<button id="morsekey_func2" onclick="morsekey_func2()" class="btn btn-warning">F2</button> <button id="morsekey_func2" onclick="morsekey_func2()" class="btn btn-warning">F2</button>

查看文件

@ -1,5 +1,11 @@
// Lets see if CW is selected let isWinkeyConnected = false;
// if isWinkeyConnected is false
if (!isWinkeyConnected) {
$('#winkey_buttons').hide();
}
// Lets see if CW is selected
const ModeSelected = document.getElementById('mode'); const ModeSelected = document.getElementById('mode');
if (location.protocol == 'http:') { if (location.protocol == 'http:') {
@ -70,7 +76,6 @@ let statusBar = document.getElementById("statusBar");
//Couple the elements to the Events //Couple the elements to the Events
connectButton.addEventListener("click", clickConnect) connectButton.addEventListener("click", clickConnect)
sendButton.addEventListener("click", clickSend) sendButton.addEventListener("click", clickSend)
helpButton.addEventListener("click", clickHelp)
statusButton.addEventListener("click", clickStatus) statusButton.addEventListener("click", clickStatus)
//When the connectButton is pressed //When the connectButton is pressed
@ -78,10 +83,11 @@ async function clickConnect() {
if (port) { if (port) {
//if already connected, disconnect //if already connected, disconnect
disconnect(); disconnect();
$('#winkey_buttons').hide();
} else { } else {
//otherwise connect //otherwise connect
await connect(); await connect();
$('#winkey_buttons').show();
} }
} }
@ -107,6 +113,8 @@ async function connect() {
//Try to connect to the Serial port //Try to connect to the Serial port
try { try {
isWinkeyConnected = true;
$('#winkey_buttons').show();
port = await navigator.serial.requestPort(/*{ filters: [filter] }*/); port = await navigator.serial.requestPort(/*{ filters: [filter] }*/);
// Continue connecting to |port|. // Continue connecting to |port|.