banyaro/backend/static/js
rene 297bd22f96 Bündel 2: Zentrale Helper für DRY-Cleanup, SW by-v1114
NEUE BACKEND-MODULE:

math_utils.py
- haversine_km(lat1, lon1, lat2, lon2) — Distanz in km
- haversine_m(...) — Convenience-Wrapper in Metern
- bbox_deg_from_km(lat, radius_km) — Bounding-Box-Approximation
  für SQL-Vorfilter (statt Haversine im Python-Loop)

config.py
- DB_PATH, MEDIA_DIR, BREEDER_DOCS_DIR, SCANINPUT_DIR
- API_TIMEOUT_SHORT (5s) / DEFAULT (10s) / LONG (30s)
- HTTP_USER_AGENT, HTTP_HEADERS

errors.py
- not_found(msg), forbidden(msg), bad_request(msg), unauthorized(msg)
- conflict(msg), too_many_requests(msg, retry_after), service_unavailable(msg)
- require_or_404(row, msg) — Convenience-Helper

UI.JS ERWEITERUNGEN:

UI.time erweitert:
- formatDate(d)     → "15.03.2026"
- formatDateTime(d) → "15.03.2026, 14:30"
- weekday(d)        → "Di"
- parseISO(str)     → {year, month, day}

UI.text (neu):
- truncate(str, maxLen, ellipsis='…')
- slug(str) — URL-Slug aus String (mit DE-Umlauten)

UI.money (neu):
- format(value) → "12,34 €" (de-DE, EUR)
- formatWithSuffix(value, '/Jahr')

HAVERSINE-MIGRATION (13 Backend-Routen):
alerts.py, services.py, places.py, events.py, diary.py, playdate.py,
lost.py, poison.py, adoption.py, gassi_zeiten.py, sitting.py, routen.py,
walks.py

- Alle lokalen def _haversine/haversine_km entfernt
- Aufrufe ersetzt durch haversine_km/haversine_m je nach Einheit
- from math_utils import haversine_km|haversine_m in jeder Datei

Tests 19/19 grün.

Hinweis: Migrationen für MEDIA_DIR (19 Stellen), API-Timeouts (12),
Date-Formatter im Frontend (24) und UI.text.truncate (5) sind als
Folge-Sprints möglich. Helper sind verfügbar.
2026-05-27 11:19:06 +02:00
..
pages Refactor: 1167 _esc() → UI.escape() in 36 Dateien, SW by-v1113 2026-05-27 10:15:33 +02:00
api.js Perf: 9 Performance-Fixes — SW by-v1072 2026-05-26 06:30:36 +02:00
app.js Bündel 2: Zentrale Helper für DRY-Cleanup, SW by-v1114 2026-05-27 11:19:06 +02:00
boot-early.js Security: CSP gehärtet — unsafe-inline + unsafe-eval raus, SW by-v1100 2026-05-27 06:23:47 +02:00
boot.js Security: CSP gehärtet — unsafe-inline + unsafe-eval raus, SW by-v1100 2026-05-27 06:23:47 +02:00
landing-init.js Security: CSP gehärtet — unsafe-inline + unsafe-eval raus, SW by-v1100 2026-05-27 06:23:47 +02:00
leaflet.js leaflet.js: Attribution-Control-Hook deaktiviert 2026-04-12 18:17:19 +02:00
leaflet.markercluster.js Sprint 10: OSM-POI-Cache, Karten-Clustering, Routen-Redesign 2026-04-15 16:30:10 +02:00
offline-indicator.js Bündel A-D: Race-Fixes, JWT-Cleanup, Storage-Watchdog, HTTPException, SW by-v1112 2026-05-27 09:41:56 +02:00
qrcode.min.js Feature: QR-Code mit Logo im Referral-Block — SW by-v441, APP_VER 420 2026-04-27 06:23:01 +02:00
ui.js Bündel 2: Zentrale Helper für DRY-Cleanup, SW by-v1114 2026-05-27 11:19:06 +02:00
worlds.js UX: Übung des Tages zeigt 'Stand erfassen →' statt '--' wenn kein Stand 2026-05-19 18:41:44 +02:00