|
|
|
@ -14,6 +14,12 @@ var userPosition = {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Preload last known location while GPS warms up
|
|
|
|
|
if (localStorage.getItem("user_latitude") != null && localStorage.getItem("user_longitude") != null) {
|
|
|
|
|
userPosition.coords.latitude = localStorage.getItem("user_latitude");
|
|
|
|
|
userPosition.coords.longitude = localStorage.getItem("user_longitude");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var geoerrorcount = 0;
|
|
|
|
|
|
|
|
|
|
var mapLocationControlStarted = false;
|
|
|
|
@ -21,6 +27,8 @@ var mapLocationControlStarted = false;
|
|
|
|
|
if ("geolocation" in navigator) {
|
|
|
|
|
navigator.geolocation.watchPosition(function (position) {
|
|
|
|
|
userPosition = position;
|
|
|
|
|
localStorage.setItem("user_latitude", userPosition.coords.latitude);
|
|
|
|
|
localStorage.setItem("user_longitude", userPosition.coords.longitude);
|
|
|
|
|
if (mapLocationControlStarted) {
|
|
|
|
|
//setMapLocation(position.coords.latitude, position.coords.longitude);
|
|
|
|
|
// Don't refresh at an interval less than ten seconds
|
|
|
|
|