Geocron leicht verbessert

This commit is contained in:
Eskimue
2026-04-02 15:53:32 +02:00
parent 1156cb66dc
commit b7a53e9912
2 changed files with 33 additions and 1 deletions
+12
View File
@@ -22,6 +22,18 @@ require __DIR__ . '/../header.php';
</div>
</section>
<script>
window.GeocronUserLocation = <?= json_encode(
!empty($currentLocation) ? [
'id' => (int)($currentLocation['id'] ?? 0),
'name' => (string)($currentLocation['name'] ?? 'Standort'),
'latitude' => isset($currentLocation['latitude']) ? (float)$currentLocation['latitude'] : null,
'longitude' => isset($currentLocation['longitude']) ? (float)$currentLocation['longitude'] : null,
'elevation' => isset($currentLocation['elevation']) ? (float)$currentLocation['elevation'] : null,
] : null,
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
) ?>;
</script>
<script src="../js/astronomy.browser.min.js"></script>
<script src="earth-core.js"></script>
<script src="plugin-terminator.js"></script>
+21 -1
View File
@@ -11,10 +11,30 @@
(function () {
const userLocation = window.GeocronUserLocation;
const userLocationMarker = userLocation
&& Number.isFinite(Number(userLocation.latitude))
&& Number.isFinite(Number(userLocation.longitude))
? {
name: userLocation.name || "Dein Standort",
lat: Number(userLocation.latitude),
lon: Number(userLocation.longitude),
color: "rgba(255, 215, 90, 0.98)",
glow: "rgba(255, 215, 90, 0.75)",
radius: 6,
showLabel: true,
popup: `${userLocation.name || "Dein Standort"}\n${Number(userLocation.latitude).toFixed(4)}° / ${Number(userLocation.longitude).toFixed(4)}°`
+ (userLocation.elevation !== null && userLocation.elevation !== undefined
? `\n${Number(userLocation.elevation).toFixed(0)} m`
: ""),
}
: null;
// ═══════════════════════════════════════════════════════════════
// MARKER-LISTE – hier eintragen
// ═══════════════════════════════════════════════════════════════
const MARKERS = [
...(userLocationMarker ? [userLocationMarker] : []),
// ═══════════════════════════════════════════════════════════
// EIGENE STANDORTE
@@ -28,7 +48,7 @@
iconW: 67,
iconH: 45,
showLabel: false,
popup: "Astronomiemuseum\nSternwarte Rodewisch",
popup: "Astronomiemuseum\nSternwarte Sonneberg",
},
{