diff --git a/static/index.html b/static/index.html
index fbc3be2..4e89442 100644
--- a/static/index.html
+++ b/static/index.html
@@ -1303,6 +1303,7 @@
+
@@ -4280,6 +4281,69 @@
}
}
+ async function getCurrentGps() {
+ // Check browser geolocation support
+ if (!navigator.geolocation) {
+ showToast('GPS not supported on this device', true);
+ return;
+ }
+
+ const myGpsBtn = document.getElementById('detailGpsMyGpsBtn');
+ myGpsBtn.textContent = '⏳ Getting GPS...';
+ myGpsBtn.disabled = true;
+
+ navigator.geolocation.getCurrentPosition(
+ function(pos) {
+ const lat = Math.round(pos.coords.latitude * 1000000) / 1000000;
+ const lng = Math.round(pos.coords.longitude * 1000000) / 1000000;
+
+ // Update the marker on the GPS editor map
+ if (_gpsState.marker) {
+ _gpsState.marker.setLatLng([lat, lng]);
+ } else {
+ showToast('GPS map not initialized yet', true);
+ myGpsBtn.textContent = '📍 My GPS';
+ myGpsBtn.disabled = false;
+ return;
+ }
+
+ // Update coords display
+ document.getElementById('detailGpsCoords').textContent =
+ `${lat.toFixed(6)}, ${lng.toFixed(6)}`;
+
+ // Auto-unlock if currently locked
+ if (!_gpsState.unlocked) {
+ toggleGpsLock();
+ }
+
+ // Show save button and update status/info
+ document.getElementById('detailGpsSaveBtn').style.display = '';
+ document.getElementById('detailGpsStatus').textContent =
+ `📍 Device GPS (accuracy: ${Math.round(pos.coords.accuracy)}m)`;
+
+ showToast(`📍 GPS position set: ${lat}, ${lng}`, false);
+
+ myGpsBtn.textContent = '📍 My GPS';
+ myGpsBtn.disabled = false;
+ },
+ function(err) {
+ const msgs = {
+ 1: 'GPS permission denied — allow location access in your browser settings',
+ 2: 'GPS position unavailable — try moving to an open area',
+ 3: 'GPS request timed out — try again',
+ };
+ showToast('GPS error: ' + (msgs[err.code] || err.message), true);
+ myGpsBtn.textContent = '📍 My GPS';
+ myGpsBtn.disabled = false;
+ },
+ {
+ enableHighAccuracy: true,
+ timeout: 15000,
+ maximumAge: 60000,
+ }
+ );
+ }
+
function statusBadge(status) {
return '';
}