(tabName)
| 2566 | if (e.key === 'Escape') { e.preventDefault(); wifiToggleFullscreen(); return; } |
| 2567 | if (typing) return; |
| 2568 | if (e.key === 'ArrowDown') { e.preventDefault(); _wifiFsStep(1); } |
| 2569 | else if (e.key === 'ArrowUp') { e.preventDefault(); _wifiFsStep(-1); } |
| 2570 | else if (e.key === 's' || e.key === 'S') wifiScan(); |
| 2571 | else if (e.key === 'b' || e.key === 'B') wifiSetView('bar'); |
| 2572 | else if (e.key === 'd' || e.key === 'D') wifiSetView('dome'); |
| 2573 | else if (e.key === 'a' || e.key === 'A') wifiSetBand('all'); |
| 2574 | else if (e.key === '2') wifiSetBand('2.4'); |
| 2575 | else if (e.key === '5') wifiSetBand('5'); |
| 2576 | else if (e.key === '6') wifiSetBand('6'); |
| 2577 | } |
| 2578 | |
| 2579 | // Walk the currently-filtered list with the arrow keys. |
| 2580 | function _wifiFsStep(delta) { |
| 2581 | const aps = _wifiFsAps(); |
| 2582 | if (!aps.length) return; |
| 2583 | const i = aps.findIndex(a => a.bssid === _wifiState.selected); |
| 2584 | const next = aps[Math.max(0, Math.min(aps.length - 1, i < 0 ? 0 : i + delta))]; |
| 2585 | if (next) { |
| 2586 | wifiSelectAp(next.bssid); |
| 2587 | const row = document.querySelector(`#wifi-fs-list tr[data-b="${next.bssid}"]`); |
| 2588 | if (row && row.scrollIntoView) row.scrollIntoView({ block: 'nearest' }); |
| 2589 | } |
| 2590 | } |
| 2591 | |
| 2592 | function _wifiFsAps() { |
| 2593 | const g = id => (document.getElementById(id) || {}); |
| 2594 | return _wifiFilterAps(g('wifi-fs-search').value, g('wifi-fs-std').value || '', !!g('wifi-fs-issues').checked); |
| 2595 | } |
| 2596 | |
| 2597 | function _wifiSetStatus(text) { |
| 2598 | const st = document.getElementById('wifi-status'); |
| 2599 | if (st) st.textContent = text; |
| 2600 | const fs = document.getElementById('wifi-fs-status'); |
| 2601 | if (fs) fs.textContent = text; |
| 2602 | } |
| 2603 | |
| 2604 | // Mirror the hardware gates (HackRF present? Huginn present?) onto the |
| 2605 | // full-screen controls — the in-page buttons are the source of truth. |
| 2606 | function _wifiFsSyncGates() { |
| 2607 | const zb = document.getElementById('wifi-fs-zb'), zbl = document.getElementById('wifi-fs-zb-label'); |
| 2608 | const zbMain = document.getElementById('wifi-zb'); |
| 2609 | if (zb && zbMain) { |
| 2610 | zb.disabled = zbMain.disabled; |
| 2611 | if (zbl) { zbl.style.opacity = zbMain.disabled ? '.4' : '1'; zbl.style.cursor = zbMain.disabled ? 'not-allowed' : 'pointer'; } |
| 2612 | } |
| 2613 | const wf = document.getElementById('wifi-fs-view-wf'), wfMain = document.getElementById('wifi-view-wf'); |
| 2614 | if (wf && wfMain) { |
| 2615 | wf.disabled = wfMain.disabled; |
| 2616 | wf.style.opacity = wfMain.disabled ? '.4' : '1'; |
| 2617 | wf.style.cursor = wfMain.disabled ? 'not-allowed' : 'pointer'; |
| 2618 | wf.title = wfMain.title; |
| 2619 | } |
| 2620 | } |
| 2621 | |
| 2622 | // Repaint everything the console owns (called after each render/scan). |
| 2623 | function _wifiFsRender() { |
| 2624 | if (!_wifiState.fs.open) return; |
| 2625 | const d = _wifiState.data; |
no test coverage detected