function wpdaproGetUserLocation(callback = null) { if (!navigator.geolocation) { jQuery("#wpdapro_geolocation_home").text("Geolocation is not supported by your browser"); } else { navigator.geolocation.getCurrentPosition( function(pos) { if (pos.coords===undefined) { coords = null; jQuery("#wpdapro_geolocation_home").text("ERROR - Could not determine user location"); } else { coords = pos.coords; if (callback!==null) { callback(); } } }, function(err) { coords = null; jQuery("#wpdapro_geolocation_home").text("ERROR - " + err); }, { enableHighAccuracy: true, timeout: 5000, maximumAge: 0 } ); } } function setUserPosition() { if (coords!==null) { home = { lat: coords.latitude, lng: coords.longitude }; wpdaproGeolocationCreate(); if (map!==null) { map.setCenter(home); } } } function addMarker(position, title, info, addLabel = true) { var markerArgs = { map: map, position: position, info: info }; if (addLabel && ""==="true") { markerArgs.label = String.fromCharCode(65+labelIndex); labelIndex++; } if (title!=="") { markerArgs.title = title; } var marker = new google.maps.Marker(markerArgs); markers.push(marker); if (info!=="") { marker.addListener("click", () => { markerPopup.setPosition(position); markerPopup.setContent(info); markerPopup.open(map); }); } } function popupClose() { markerPopup.close(); } function popupMarker(label) { for (var i=0; i