|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <script> |
| 5 | + let update = () => {}; |
| 6 | + let vfoSetting = ""; |
| 7 | + let splitSetting = "false"; |
| 8 | + let txvfoSetting = ""; |
| 9 | + |
| 10 | + function connectOpenActionSocket( |
| 11 | + inPort, |
| 12 | + inPropertyInspectorUUID, |
| 13 | + inRegisterEvent, |
| 14 | + inInfo, |
| 15 | + inActionInfo, |
| 16 | + ) { |
| 17 | + const websocket = new WebSocket("ws://localhost:" + inPort); |
| 18 | + inActionInfo = JSON.parse(inActionInfo); |
| 19 | + websocket.onopen = () => { |
| 20 | + websocket.send( |
| 21 | + JSON.stringify({ |
| 22 | + event: inRegisterEvent, |
| 23 | + uuid: inPropertyInspectorUUID, |
| 24 | + }), |
| 25 | + ); |
| 26 | + }; |
| 27 | + |
| 28 | + vfoSetting = inActionInfo.payload.settings.vfo ?? ""; |
| 29 | + splitSetting = inActionInfo.payload.settings.split ?? "false"; |
| 30 | + txvfoSetting = inActionInfo.payload.settings.txvfo ?? ""; |
| 31 | + |
| 32 | + websocket.onmessage = (event) => { |
| 33 | + const data = JSON.parse(event.data); |
| 34 | + if (data.event == "didReceiveSettings") { |
| 35 | + vfoSetting = data.payload.settings.vfo ?? ""; |
| 36 | + splitSetting = data.payload.settings.split ?? "false"; |
| 37 | + txvfoSetting = data.payload.settings.txvfo ?? ""; |
| 38 | + } |
| 39 | + if (data.event == "sendToPropertyInspector") { |
| 40 | + // TODO: receive available vfos from the plugin |
| 41 | + } |
| 42 | + }; |
| 43 | + |
| 44 | + const vfoElement = document.getElementById("vfo"); |
| 45 | + vfoElement.value = inActionInfo.payload.settings.vfo ?? ""; |
| 46 | + |
| 47 | + const splitElement = document.getElementById("split"); |
| 48 | + splitElement.checked = |
| 49 | + inActionInfo.payload.settings.split === "true"; |
| 50 | + |
| 51 | + const txvfoElement = document.getElementById("txvfo"); |
| 52 | + txvfoElement.value = inActionInfo.payload.settings.txvfo ?? ""; |
| 53 | + |
| 54 | + update = () => { |
| 55 | + websocket.send( |
| 56 | + JSON.stringify({ |
| 57 | + event: "setSettings", |
| 58 | + context: inActionInfo.context, |
| 59 | + payload: { |
| 60 | + vfo: vfoElement.value || "", |
| 61 | + split: splitElement.checked |
| 62 | + ? "true" |
| 63 | + : "false", |
| 64 | + txvfo: txvfoElement.value || "", |
| 65 | + }, |
| 66 | + }), |
| 67 | + ); |
| 68 | + }; |
| 69 | + } |
| 70 | + |
| 71 | + const connectElgatoStreamDeckSocket = connectOpenActionSocket; |
| 72 | + </script> |
| 73 | + |
| 74 | + <style> |
| 75 | + * { |
| 76 | + font-family: system-ui, sans-serif; |
| 77 | + font-size: 16px; |
| 78 | + color: oklch(92.2% 0 0); |
| 79 | + } |
| 80 | + body { |
| 81 | + margin: 16px; |
| 82 | + background-color: oklch(26.9% 0 0); |
| 83 | + } |
| 84 | + label { |
| 85 | + margin-right: 4px; |
| 86 | + } |
| 87 | + input { |
| 88 | + margin: 4px; |
| 89 | + padding: 4px; |
| 90 | + background-color: oklch(37.1% 0 0); |
| 91 | + border: 1px solid oklch(43.9% 0 0); |
| 92 | + border-radius: 8px; |
| 93 | + } |
| 94 | + input[type="checkbox"] { |
| 95 | + width: 18px; |
| 96 | + height: 18px; |
| 97 | + vertical-align: middle; |
| 98 | + } |
| 99 | + </style> |
| 100 | + </head> |
| 101 | + |
| 102 | + <body> |
| 103 | + <div> |
| 104 | + <label for="vfo">VFO:</label> |
| 105 | + <!-- should be a combo box with all VFOs --> |
| 106 | + <input id="vfo" oninput="update()" type="text" /> |
| 107 | + <br /> |
| 108 | + <label for="split">Split:</label> |
| 109 | + <input id="split" onchange="update()" type="checkbox" /> |
| 110 | + <br /> |
| 111 | + <label for="txvfo">TX VFO:</label> |
| 112 | + <!-- should be a combo box with all VFOs --> |
| 113 | + <input id="txvfo" oninput="update()" type="text" /> |
| 114 | + </div> |
| 115 | + </body> |
| 116 | +</html> |
0 commit comments