()
| 1366 | try { _rusenseLoader.suspend(); } catch (e) { /* ignore */ } |
| 1367 | } |
| 1368 | |
| 1369 | // Leaving RuSense: stop the Observatory iframe (WebGL + WS) if it was open. |
| 1370 | if (tabName !== 'rusense') { |
| 1371 | const _obsFrame = document.getElementById('observatory-frame'); |
| 1372 | if (_obsFrame && _obsFrame.getAttribute('src')) _obsFrame.removeAttribute('src'); |
| 1373 | } |
| 1374 | |
| 1375 | if (systemMonitoringInterval && tabName !== 'system') { |
| 1376 | clearInterval(systemMonitoringInterval); |
| 1377 | systemMonitoringInterval = null; |
| 1378 | } |
| 1379 | |
| 1380 | // Mesh File Transfer polling only runs while the transfer view is on screen. |
| 1381 | if (tabName !== 'mesh') { |
| 1382 | try { _xferStopPolling(); } catch (e) { /* ignore */ } |
| 1383 | } else { |
| 1384 | const tv = document.getElementById('mesh-view-transfer'); |
| 1385 | if (tv && !tv.classList.contains('hidden')) { try { xferRefresh(); _xferStartPolling(); } catch (e) { /* ignore */ } } |
| 1386 | } |
| 1387 | |
| 1388 | document.querySelectorAll('.tab-content').forEach(tab => { |
| 1389 | tab.classList.add('hidden'); |
| 1390 | }); |
| 1391 | |
| 1392 | document.querySelectorAll('.nav-btn, [data-tab]').forEach(btn => { |
| 1393 | btn.classList.remove('bg-Ragnar-600'); |
| 1394 | btn.classList.add('text-gray-300', 'hover:text-white', 'hover:bg-gray-700'); |
| 1395 | }); |
| 1396 | |
| 1397 | const selectedTab = document.getElementById(`${tabName}-tab`); |
| 1398 | if (selectedTab) { |
| 1399 | selectedTab.classList.remove('hidden'); |
| 1400 | } |
| 1401 | |
| 1402 | // File Management uses the full page width (its file browser benefits from |
| 1403 | // the extra room); every other tab keeps the centered max-width column. |
| 1404 | const mainEl = document.querySelector('main'); |
| 1405 | if (mainEl) mainEl.style.maxWidth = (tabName === 'files') ? 'none' : ''; |
| 1406 | |
| 1407 | const selectedBtn = document.querySelector(`[data-tab="${tabName}"]`); |
| 1408 | if (selectedBtn) { |
| 1409 | selectedBtn.classList.add('bg-Ragnar-600'); |
| 1410 | selectedBtn.classList.remove('text-gray-300', 'hover:text-white', 'hover:bg-gray-700'); |
| 1411 | } |
| 1412 | |
| 1413 | loadTabData(tabName); |
| 1414 | |
| 1415 | if (tabName === 'config') { |
| 1416 | try { refreshSensingInstallCard(); syncRusenseTabToggle(); syncTerminalToggle(); syncMeshTabToggle(); } catch (e) { /* ignore */ } |
| 1417 | try { showConfigSubtab(localStorage.getItem('cfg-subtab') || 'system'); } catch (e) { /* ignore */ } |
| 1418 | } |
| 1419 | |
| 1420 | const mobileMenu = document.getElementById('mobile-menu'); |
| 1421 | if (mobileMenu) { |
| 1422 | mobileMenu.classList.add('hidden'); |
nothing calls this directly
no test coverage detected