// GPS button document.getElementById('btn-gps')?.addEventListener('click', function () { const status = document.getElementById('gps-status') as HTMLElement; if (!navigator.geolocation) { status.textContent = '// GPS nicht verfügbar'; return; } status.textContent = '// Standort wird ermittelt...'; navigator.geolocation.getCurrentPosition( function (pos: GeolocationPosition) { (document.getElementById('entry-lat') as HTMLInputElement).value = pos.coords.latitude.toFixed(6); (document.getElementById('entry-lon') as HTMLInputElement).value = pos.coords.longitude.toFixed(6); status.textContent = '// Standort gesetzt (' + pos.coords.accuracy.toFixed(0) + ' m Genauigkeit)'; }, function (err: GeolocationPositionError) { status.textContent = '// Fehler: ' + err.message; }, { enableHighAccuracy: true, timeout: 10000 } ); }); // Set current time as default (function () { const input = document.getElementById('entry-time') as HTMLInputElement | null; if (input && !input.value) { const now = new Date(); const hh = String(now.getHours()).padStart(2, '0'); const mm = String(now.getMinutes()).padStart(2, '0'); input.value = hh + ':' + mm; } })();