Files
longhikes/web/assets/prefs.js
T
swaitsandClaude Fable 5.2 ad2223f427
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s
Give trail pages an outdoor map
Trail maps now open on an outdoor style of our own, drawn on the same
OpenFreeMap tiles: hill shading and contour lines from the public
Terrain Tiles, woods, water, footpaths, and peaks with their heights.
Heights and contours follow the visitor's units. A switch on the map
goes back to the plain map and is remembered.

The home page's overview map is unchanged. If the elevation tiles or
the contour script fail, the map still loads without them.

The security policy allows the one elevation-tile path. The contour
add-on (maplibre-contour 0.1.1) is vendored with its licence, and the
elevation data is credited on the map, under it and in the footer.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 13:26:45 -07:00

17 lines
829 B
JavaScript

/* Runs in <head>, before first paint: marks that JavaScript runs, and applies the
reader's saved theme, length order and base map. Saved by app.js (the footer
switches, and the Outdoor / Plain switch on a trail map). */
(function () {
'use strict';
var root = document.documentElement;
root.classList.add('js');
try {
var theme = localStorage.getItem('lh-theme');
var units = localStorage.getItem('lh-units');
var basemap = localStorage.getItem('lh-basemap');
if (theme === 'light' || theme === 'dark') root.dataset.theme = theme;
if (units === 'km') root.dataset.units = 'km'; /* anything else, an old 'mi' included, is miles */
if (basemap === 'plain') root.dataset.basemap = 'plain'; /* anything else is the outdoor map */
} catch (e) { /* storage blocked: defaults apply */ }
})();