* Load DNS query analysis data
()
| 16146 | |
| 16147 | function getNetworkSlugForInterface(interfaceName) { |
| 16148 | if (!interfaceName) { |
| 16149 | return null; |
| 16150 | } |
| 16151 | const meta = Array.isArray(wifiInterfaceMetadata) |
| 16152 | ? wifiInterfaceMetadata.find(entry => entry && entry.name === interfaceName) |
| 16153 | : null; |
| 16154 | if (!meta) { |
| 16155 | return null; |
| 16156 | } |
| 16157 | if (meta.network_slug) { |
| 16158 | return meta.network_slug; |
| 16159 | } |
| 16160 | if (meta.connected_ssid) { |
| 16161 | return slugifyNetworkIdentifier(meta.connected_ssid); |
| 16162 | } |
| 16163 | return null; |
| 16164 | } |
| 16165 | |
| 16166 | function getSelectedDashboardNetworkKey() { |
| 16167 | const iface = getActiveWifiInterface(); |
| 16168 | const slug = getNetworkSlugForInterface(iface); |
| 16169 | if (slug) { |
| 16170 | return { interface: iface, network: slug }; |
| 16171 | } |
| 16172 | return { interface: iface, network: null }; |
| 16173 | } |
| 16174 | |
| 16175 | function updateWifiInterfaceSwitchActiveState(activeInterface) { |
| 16176 | const buttonsContainer = document.getElementById('wifi-interface-switch-buttons'); |
| 16177 | if (!buttonsContainer) return; |
| 16178 | const buttons = buttonsContainer.querySelectorAll('button[data-interface]'); |
| 16179 | buttons.forEach(button => { |
| 16180 | const isActive = button.dataset.interface === activeInterface; |
| 16181 | button.classList.remove('bg-Ragnar-600', 'border-Ragnar-400', 'text-white', 'shadow-lg', 'bg-slate-800', 'border-slate-600', 'text-gray-300'); |
| 16182 | if (isActive) { |
| 16183 | button.classList.add('bg-Ragnar-600', 'border-Ragnar-400', 'text-white', 'shadow-lg'); |
| 16184 | } else { |
| 16185 | button.classList.add('bg-slate-800', 'border-slate-600', 'text-gray-300'); |
| 16186 | } |
| 16187 | }); |
| 16188 | } |
| 16189 | |
| 16190 | function updateDashboardInterfaceSwitchActiveState(activeInterface) { |
| 16191 | const buttonsContainer = document.getElementById('wifi-dashboard-interface-buttons'); |
| 16192 | if (!buttonsContainer) { |
| 16193 | return; |
| 16194 | } |
| 16195 | buttonsContainer.querySelectorAll('button[data-interface]').forEach(button => { |
| 16196 | const isActive = button.dataset.interface === activeInterface; |
| 16197 | button.classList.remove('bg-Ragnar-500', 'text-white', 'border-Ragnar-400', 'shadow'); |
| 16198 | button.classList.remove('bg-slate-800', 'text-gray-300', 'border-slate-700'); |
| 16199 | if (isActive) { |
| 16200 | button.classList.add('bg-Ragnar-500', 'text-white', 'border-Ragnar-400', 'shadow'); |
| 16201 | } else { |
| 16202 | button.classList.add('bg-slate-800', 'text-gray-300', 'border-slate-700'); |
| 16203 | } |
| 16204 | }); |
| 16205 | } |
no test coverage detected