--- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -36,6 +36,10 @@ if ($datepicker) echo ''; if (isDebugServer()) echo ' + '; else echo ' @@ -111,13 +115,13 @@ function success(position) { $('#geolocate').val(position.coords.latitude+','+position.coords.longitude); $.ajax({ url: \"common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude }); -$('#here').click(function(event) { $('#geolocate').val(doAJAXrequestForGeolocSessionHere()); return false;}); -$('#here').show(); +location.reload(true); } function error(msg) { console.log(msg); } +function geolocate() { if (navigator.geolocation) { var options = { enableHighAccuracy: false, @@ -126,8 +130,14 @@ } navigator.geolocation.getCurrentPosition(success, error, options); } - - "; +} +$(document).ready(function() { + $('#here').click(function(event) { $('#geolocate').val(geolocate()); return false;}); +$('#here').show(); +}); +"; +if (!isset($_SESSION['lat']) || $_SESSION['lat'] == "") echo "geolocate();"; +echo " "; } if (isAnalyticsOn()) echo ' "; - } echo '
'; if (isAnalyticsOn()) { @@ -194,7 +198,7 @@ } echo '