client/locations-list-map.js
/**
 * Centers map at automatically detected coordinates using built in navigator.geolocation API.
 */
Centers map at automatically detected coordinates using built in navigator.geolocation API.
Centers map at automatically detected coordinates using built in navigator . geolocation API .
function centerMapToMarkersNearUser() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition((position) => {
      const bounds = new google.maps.LatLngBounds();
      const latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
      bounds.extend(latlng);
      fitMapToMarkersNearBounds(bounds);
    }, (err) => {
      console.error(err);
      $('#use-location').hide();
    }, {
      maximumAge: Infinity,
      timeout: 10000,
    });
  }
}
function centerMapToMarkersNearUser ( ) { if ( navigator . geolocation ) { navigator . geolocation . getCurrentPosition ( ( position ) => { const bounds = new google . maps . LatLngBounds ( ) ; const latlng = new google . maps . LatLng ( position . coords . latitude , position . coords . longitude ) ; bounds . extend ( latlng ) ; fitMapToMarkersNearBounds ( bounds ) ; } , ( err ) => { console . error ( err ) ; $ ( '#use-location' ) . hide ( ) ; } , { maximumAge : Infinity , timeout : 10000 , } ) ; } }
Centers map at automatically detected coordinates using built in navigator.geolocation API.
Centers map at automatically detected coordinates using built in navigator . geolocation API .
// First check to see if the user will accept getting their location, if not, silently return // Hide the "User my location" link since we know that will not work.