File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -274,14 +274,23 @@ <h2><span class="icon">✨</span> Features</h2>
274274
275275 function useGeolocation ( ) {
276276 if ( ! navigator . geolocation ) { toast ( 'Geolocation not supported by this browser' , true ) ; return ; }
277+ toast ( 'Locating…' ) ;
277278 navigator . geolocation . getCurrentPosition (
278279 pos => {
279280 document . getElementById ( 'inp-lat' ) . value = pos . coords . latitude . toFixed ( 4 ) ;
280281 document . getElementById ( 'inp-lon' ) . value = pos . coords . longitude . toFixed ( 4 ) ;
281282 // altitude not reliably available from browser — leave as-is
282283 toast ( 'Coordinates filled — click Save Location to confirm' ) ;
283284 } ,
284- ( ) => toast ( 'GPS permission denied or unavailable' , true )
285+ err => {
286+ const msgs = {
287+ 1 : 'GPS permission denied' ,
288+ 2 : 'Position unavailable — try again or enter coordinates manually' ,
289+ 3 : 'Location request timed out — try again' ,
290+ } ;
291+ toast ( msgs [ err . code ] || 'Geolocation failed' , true ) ;
292+ } ,
293+ { enableHighAccuracy : false , timeout : 15000 , maximumAge : 300000 }
285294 ) ;
286295 }
287296
You can’t perform that action at this time.
0 commit comments