thermograph/templates
Emi Griffith aab42610ef Fix the hero's "Use my location" doing nothing (#179)
The button was dead on plain HTTP and failed silently everywhere.

Browsers only expose geolocation on secure origins, but `navigator.geolocation`
still EXISTS on http:// — getCurrentPosition just fails with a permission error
("Only secure origins are allowed"). The guard was `if (!navigator.geolocation)
return;`, which passes on http://, so the call went ahead, errored, and landed
in an empty error callback. Nothing happened at all.

`make lan-run` serves plain HTTP on 0.0.0.0:8137 so phones can reach it, so the
button could never work in the normal dev-and-phone workflow, and gave no hint
why. It would have worked on thermograph.org, which is HTTPS.

- Gate on `window.isSecureContext`, not just the API's presence. Where the
  browser will refuse, hide the locate button and promote "Pick on the map" to
  primary rather than offering a control that cannot work.
- Report failures: a declined prompt, a timeout, and an unavailable fix each get
  their own message in an aria-live slot. A silent failure is indistinguishable
  from a broken button, which is exactly how this went unnoticed.
- Show a "Locating…" state while the fix is pending; it can take seconds.

To exercise geolocation against the LAN dev server, serve it over TLS:
`make lan-run TLS=1` (self-signed cert into certs/).

Verified by driving the button in a real browser across all three cases:
insecure origin (button hidden, map promoted), permission granted (hero
re-points at the located place), permission denied (message shown, button
restored).
2026-07-18 07:48:17 +00:00
..
about.html.j2 Give climate/city/record pages full header parity + working °F/°C (#124) 2026-07-16 17:48:30 +00:00
base.html.j2 Rebuild the homepage as a distribution landing; add an SMTP seam (#178) 2026-07-18 07:39:47 +00:00
city.html.j2 Give climate/city/record pages full header parity + working °F/°C (#124) 2026-07-16 17:48:30 +00:00
glossary.html.j2 SEO: crawlable programmatic climate pages + technical hygiene (#96) 2026-07-15 23:53:11 +00:00
glossary_term.html.j2 SEO: crawlable programmatic climate pages + technical hygiene (#96) 2026-07-15 23:53:11 +00:00
home.html.j2 Fix the hero's "Use my location" doing nothing (#179) 2026-07-18 07:48:17 +00:00
hub.html.j2 Climate hub: client-side search + alphabetical results (#110) 2026-07-16 04:44:18 +00:00
month.html.j2 Mobile hamburger nav; crisp SVG logo; month travel-note callout (#117) 2026-07-16 05:42:59 +00:00
privacy.html.j2 Rebuild the homepage as a distribution landing; add an SMTP seam (#178) 2026-07-18 07:39:47 +00:00
records.html.j2 Give climate/city/record pages full header parity + working °F/°C (#124) 2026-07-16 17:48:30 +00:00