mirror of
https://github.com/smittix/intercept.git
synced 2026-06-12 16:03:29 -07:00
up
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
// Shared observer location helper for map-based modules.
|
||||
// Default: shared location enabled unless explicitly disabled via config.
|
||||
window.ObserverLocation = (function() {
|
||||
const DEFAULT_LOCATION = { lat: 51.5074, lon: -0.1278 };
|
||||
const DEFAULT_LOCATION = (window.INTERCEPT_DEFAULT_LAT && window.INTERCEPT_DEFAULT_LON)
|
||||
? { lat: window.INTERCEPT_DEFAULT_LAT, lon: window.INTERCEPT_DEFAULT_LON }
|
||||
: { lat: 51.5074, lon: -0.1278 };
|
||||
const SHARED_KEY = 'observerLocation';
|
||||
const AIS_KEY = 'ais_observerLocation';
|
||||
const LEGACY_LAT_KEY = 'observerLat';
|
||||
@@ -41,6 +43,10 @@ window.ObserverLocation = (function() {
|
||||
return normalize(lat, lon);
|
||||
}
|
||||
|
||||
function hasStoredLocation() {
|
||||
return !!(readKey(SHARED_KEY) || readKey(AIS_KEY) || readLegacyLatLon());
|
||||
}
|
||||
|
||||
function getShared() {
|
||||
const current = readKey(SHARED_KEY);
|
||||
if (current) return current;
|
||||
@@ -93,6 +99,7 @@ window.ObserverLocation = (function() {
|
||||
|
||||
return {
|
||||
isSharedEnabled,
|
||||
hasStoredLocation,
|
||||
getShared,
|
||||
setShared,
|
||||
getForModule,
|
||||
|
||||
Reference in New Issue
Block a user