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>
17 lines
829 B
JavaScript
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 */ }
|
|
})();
|