1/* Demo data persists under its own namespace, separate from real station data. */ 2(() => { 3 "use strict"; 4 const prefix = "dcc-demo-v1:"; 5 let backing; 6 try { backing = window.localStorage; } catch { /* Report failed saving below. */ } 7 const memory = new Map(); 8 const storage = { 9 get length() { return this.keys().length; }, 10 keys() { 11 const keys = new Set(memory.keys()); 12 try { for (let i = 0; i < backing.length; i++) { const key = backing.key(i); if (key?.startsWith(prefix)) keys.add(key.slice(prefix.length)); } } catch {} 13 return [...keys]; 14 }, 15 key(index) { return this.keys()[index] ?? null; }, 16 getItem(key) { 17 key = String(key); 18 if (memory.has(key)) return memory.get(key); 19 try { return backing.getItem(prefix + key); } catch { return null; } 20 }, 21 setItem(key, value) { 22 key = String(key); value = String(value); memory.set(key, value); 23 try { backing.setItem(prefix + key, value); window.dccDemoStorageError = false; } 24 catch { window.dccDemoStorageError = true; } 25 if (key === "ft8-command-profiles-clean-v2" || key === "radio-configuration") { 26 window.dccDemoSaveLabel = window.dccDemoStorageError ? "Station not saved · storage unavailable" : "Station saved"; 27 if (window.dispatchEvent) window.dispatchEvent(new CustomEvent("dcc-demo-saved")); 28 } 29 }, 30 removeItem(key) { memory.delete(String(key)); try { backing.removeItem(prefix + key); } catch {} }, 31 clear() { for (const key of this.keys()) this.removeItem(key); } 32 }; 33 Object.defineProperty(window, "localStorage", {value: storage, configurable: false}); 34 window.dccReadDemoSetting = (key, fallback) => { 35 try { return JSON.parse(storage.getItem(key)) ?? fallback; } catch { return fallback; } 36 }; 37 window.dccDemoPreferences = window.dccReadDemoSetting("preferences", {}); 38 window.dccDemoPreferences.temperatureUnit = window.dccDemoPreferences.temperatureUnit === "C" ? "C" : "F"; 39 window.dccDemoPreferences.doubleClickTx = window.dccDemoPreferences.doubleClickTx !== false; 40})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.