function getConfigHasSeenInfoModal() { return localStorage.getItem("config_has_seen_info_modal") === "true"; } function setConfigHasSeenInfoModal(value) { return localStorage.setItem("config_has_seen_info_modal", value); } function getConfigAutoUpdatePositionInUrl() { // use user preference, or enable by default const value = localStorage.getItem("config_auto_update_position_in_url"); return value === "true" || value == null; } function setConfigAutoUpdatePositionInUrl(value) { return localStorage.setItem("config_auto_update_position_in_url", value); } function getConfigEnableMapAnimations() { const value = localStorage.getItem("config_enable_map_animations"); // enable animations by default if(value === null){ return true; } return value === "true"; } function setConfigEnableMapAnimations(value) { return localStorage.setItem("config_enable_map_animations", value); } function getConfigTemperatureFormat() { return localStorage.getItem("config_temperature_format") || "celsius"; } function setConfigTemperatureFormat(format) { return localStorage.setItem("config_temperature_format", format); } function getConfigMapSelectedTileLayer() { return localStorage.getItem("config_map_selected_tile_layer") || "Thunderforest Neighbourhood"; } function setConfigMapSelectedTileLayer(layer) { return localStorage.setItem("config_map_selected_tile_layer", layer); } function getConfigMapEnabledOverlayLayers() { try { const value = localStorage.getItem("config_map_enabled_overlay_layers"); if(value){ return JSON.parse(value); } } catch(e) {} // overlays enabled by default return ["Legend", "Position History", "Traceroutes"]; } function setConfigMapEnabledOverlayLayers(layers) { return localStorage.setItem("config_map_enabled_overlay_layers", JSON.stringify(layers)); } function getConfigNodesMaxAgeInSeconds() { const value = localStorage.getItem("config_nodes_max_age_in_seconds"); return value != null ? parseInt(value) : null; } function setConfigNodesMaxAgeInSeconds(value) { if(value != null){ return localStorage.setItem("config_nodes_max_age_in_seconds", value); } else { return localStorage.removeItem("config_nodes_max_age_in_seconds"); } } function getConfigNodesOfflineAgeInSeconds() { const value = localStorage.getItem("config_nodes_offline_age_in_seconds"); return value != null ? parseInt(value) : 10800; } function setConfigNodesOfflineAgeInSeconds(value) { if(value != null){ return localStorage.setItem("config_nodes_offline_age_in_seconds", value); } else { return localStorage.removeItem("config_nodes_offline_age_in_seconds"); } } function getConfigWaypointsMaxAgeInSeconds() { const value = localStorage.getItem("config_waypoints_max_age_in_seconds"); return value != null ? parseInt(value) : null; } function setConfigWaypointsMaxAgeInSeconds(value) { if(value != null){ return localStorage.setItem("config_waypoints_max_age_in_seconds", value); } else { return localStorage.removeItem("config_waypoints_max_age_in_seconds"); } } function getConfigConnectionsMaxDistanceInMeters() { const value = localStorage.getItem("config_connections_max_distance_in_meters"); // default to 70km (70,000 meters) return value != null ? parseInt(value) : 70000; } function setConfigConnectionsMaxDistanceInMeters(value) { return localStorage.setItem("config_connections_max_distance_in_meters", value); } function getConfigZoomLevelGoToNode() { const value = localStorage.getItem("config_zoom_level_go_to_node"); const parsedValue = value != null ? parseInt(value) : null; return parsedValue || 15; } function setConfigZoomLevelGoToNode(value) { return localStorage.setItem("config_zoom_level_go_to_node", value); } function getConfigConnectionsTimePeriodInSeconds() { const value = localStorage.getItem("config_connections_time_period_in_seconds"); // default to 7 days if unset return value != null ? parseInt(value) : 604800; } function setConfigConnectionsTimePeriodInSeconds(value) { return localStorage.setItem("config_connections_time_period_in_seconds", value); } function getConfigConnectionsColoredLines() { const value = localStorage.getItem("config_connections_colored_lines"); // disable colored lines by default if(value === null){ return false; } return value === "true"; } function setConfigConnectionsColoredLines(value) { return localStorage.setItem("config_connections_colored_lines", value); } function getConfigConnectionsBidirectionalOnly() { const value = localStorage.getItem("config_connections_bidirectional_only"); // disable bidirectional filter by default if(value === null){ return false; } return value === "true"; } function setConfigConnectionsBidirectionalOnly(value) { return localStorage.setItem("config_connections_bidirectional_only", value); } function getConfigConnectionsMinSnrDb() { const value = localStorage.getItem("config_connections_min_snr_db"); // default to null (unset) if(value === null || value === ""){ return null; } const parsed = parseFloat(value); return isNaN(parsed) ? null : parsed; } function setConfigConnectionsMinSnrDb(value) { if(value === null || value === "" || value === undefined){ return localStorage.removeItem("config_connections_min_snr_db"); } // Convert to string for localStorage (handles both number and string inputs) const stringValue = typeof value === "number" ? value.toString() : String(value); return localStorage.setItem("config_connections_min_snr_db", stringValue); } function getConfigConnectionsBidirectionalMinSnr() { const value = localStorage.getItem("config_connections_bidirectional_min_snr"); // disable bidirectional minimum SNR by default if(value === null){ return false; } return value === "true"; } function setConfigConnectionsBidirectionalMinSnr(value) { return localStorage.setItem("config_connections_bidirectional_min_snr", value); } function isMobile() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); }