MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / applyWardrivingMapFilters

Function applyWardrivingMapFilters

web/scripts/ragnar_modern.js:18635–18761  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18633 return;
18634 }
18635
18636 // Sort networks by signal strength
18637 networks.sort((a, b) => (b.signal || 0) - (a.signal || 0));
18638
18639 // Store for later use
18640 currentWifiNetworks = networks;
18641
18642 // Build network list HTML
18643 networksList.innerHTML = sectionHeader + warningMarkup + networks.map(network => {
18644 const ssid = network.ssid || network.SSID || 'Unknown Network';
18645 const signal = network.signal || 0;
18646 const isSecure = network.security !== 'open' && network.security !== 'Open';
18647 // Check both backend-provided 'known' flag AND local knownNetworks list
18648 // This ensures we catch both Ragnar's known networks AND NetworkManager system profiles
18649 const isKnown = network.known || network.has_system_profile || knownNetworks.includes(ssid);
18650 const isCurrent = network.in_use || false;
18651
18652 // Determine signal icon
18653 let signalIcon = '';
18654 if (signal >= 70) {
18655 signalIcon = `<svg class="w-5 h-5 text-green-400" fill="currentColor" viewBox="0 0 20 20">
18656 <path d="M2 11a1 1 0 011-1h2a1 1 0 011 1v5a1 1 0 01-1 1H3a1 1 0 01-1-1v-5zM8 7a1 1 0 011-1h2a1 1 0 011 1v9a1 1 0 01-1 1H9a1 1 0 01-1-1V7zM14 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1h-2a1 1 0 01-1-1V4z"></path>
18657 </svg>`;
18658 } else if (signal >= 50) {
18659 signalIcon = `<svg class="w-5 h-5 text-yellow-400" fill="currentColor" viewBox="0 0 20 20">
18660 <path d="M2 11a1 1 0 011-1h2a1 1 0 011 1v5a1 1 0 01-1 1H3a1 1 0 01-1-1v-5zM8 7a1 1 0 011-1h2a1 1 0 011 1v9a1 1 0 01-1 1H9a1 1 0 01-1-1V7z"></path>
18661 </svg>`;
18662 } else {
18663 signalIcon = `<svg class="w-5 h-5 text-red-400" fill="currentColor" viewBox="0 0 20 20">
18664 <path d="M2 11a1 1 0 011-1h2a1 1 0 011 1v5a1 1 0 01-1 1H3a1 1 0 01-1-1v-5z"></path>
18665 </svg>`;
18666 }
18667
18668 // Security icon
18669 const securityIcon = isSecure ? `
18670 <svg class="w-4 h-4 text-gray-400" fill="currentColor" viewBox="0 0 20 20">
18671 <path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd"></path>
18672 </svg>
18673 ` : '';
18674
18675 // Badge for known/current network
18676 let badge = '';
18677 if (isCurrent) {
18678 badge = '<span class="text-xs px-2 py-1 rounded bg-green-600 text-white ml-2">Connected</span>';
18679 } else if (isKnown) {
18680 badge = '<span class="text-xs px-2 py-1 rounded bg-blue-600 text-white ml-2">Saved</span>';
18681 }
18682
18683 // Edit button for saved networks (pencil icon)
18684 const editBtn = isKnown ? `
18685 <button onclick="event.stopPropagation(); openWifiConnectModal('${ssid.replace(/'/g, "\\'")}', ${isKnown}, ${isSecure}, true)"
18686 class="p-1 text-gray-400 hover:text-blue-400 transition-colors" title="Update password">
18687 <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
18688 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path>
18689 </svg>
18690 </button>
18691 ` : '';
18692

Callers 1

loadWardrivingMapDataFunction · 0.70

Calls 4

filterMethod · 0.80
pushMethod · 0.80
_wdSecurityTypeFunction · 0.70
_wdMarkerColorFunction · 0.70

Tested by

no test coverage detected