408fde440d
Photograph/screenshot a boarding pass, decode its BCBP barcode (PDF417/ Aztec/QR/DataMatrix), fetch the historical flight track from FlightAware the day after the flight, stage it for review, and write it into AirTrail via its REST API on approval. ntfy notifications carry signed Approve/Deny/Investigate actions.
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
(function () {
|
|
var root = document.documentElement;
|
|
var toggle = document.getElementById("theme-toggle");
|
|
if (toggle) {
|
|
toggle.addEventListener("click", function () {
|
|
var isLight = root.classList.contains("light");
|
|
root.classList.remove("light", "dark");
|
|
var next = isLight ? "dark" : "light";
|
|
root.classList.add(next);
|
|
localStorage.setItem("theme", next);
|
|
});
|
|
}
|
|
|
|
var mapEl = document.getElementById("track-map");
|
|
if (mapEl && window.L) {
|
|
var coords = JSON.parse(mapEl.dataset.track || "[]");
|
|
// KML/GeoJSON order is [lon, lat, elev?]; Leaflet wants [lat, lon].
|
|
var latLngs = coords.map(function (c) { return [c[1], c[0]]; });
|
|
if (latLngs.length) {
|
|
var map = L.map(mapEl);
|
|
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
attribution: "© OpenStreetMap contributors",
|
|
maxZoom: 18,
|
|
}).addTo(map);
|
|
var line = L.polyline(latLngs, { color: "#3b82f6", weight: 3 }).addTo(map);
|
|
map.fitBounds(line.getBounds(), { padding: [20, 20] });
|
|
L.marker(latLngs[0]).addTo(map);
|
|
L.marker(latLngs[latLngs.length - 1]).addTo(map);
|
|
}
|
|
}
|
|
})();
|