diff --git a/js/api_gmaps.js b/js/api_gmaps.js
index a800b67..8e48953 100755
--- a/js/api_gmaps.js
+++ b/js/api_gmaps.js
@@ -26,6 +26,7 @@ var mapOptions;
var loadedAPI = 'gmaps';
function init() {
+ if (gm_error) { return gm_authFailure(); }
google.maps.visualRefresh = true;
polyOptions = {
strokeColor: '#FF0000',
@@ -171,3 +172,11 @@ function zoomToBounds(b) {
var bounds = new google.maps.LatLngBounds(sw, ne);
map.fitBounds(bounds);
}
+
+function gm_authFailure() {
+ gm_error = true;
+ message = sprintf(lang['apifailure'], "Google Maps");
+ message += '
' + lang['gmauthfailure'];
+ message += '
' + lang['gmapilink'];
+ showModal(message);
+};
diff --git a/js/main.js b/js/main.js
index ac92613..fb2fc66 100755
--- a/js/main.js
+++ b/js/main.js
@@ -39,6 +39,8 @@ var live = 0;
var chart;
var altitudes = new Array();
var altTimeout;
+var gm_error = false;
+
function displayChart() {
if (chart) { google.visualization.events.removeAllListeners(chart); }
var data = new google.visualization.DataTable();
@@ -370,7 +372,11 @@ function setTime() {
var savedBounds;
function loadMapAPI(api) {
mapapi = api;
- savedBounds = getBounds();
+ try {
+ savedBounds = getBounds();
+ } catch (e) {
+ savedBounds = null;
+ }
document.getElementById("map-canvas").innerHTML = '';
var url = new Array();
if (api == 'gmaps') {
@@ -411,8 +417,12 @@ function waitAndInit(api) {
return;
}
loadTime = 0;
- zoomToBounds(savedBounds);
- loadTrack(userid, trackid, 0);
+ var update = 1;
+ if (savedBounds) {
+ zoomToBounds(savedBounds);
+ update = 0;
+ }
+ loadTrack(userid, trackid, update);
// save current api as default
setCookie('api', api, 30);
}
diff --git a/lang/en.php b/lang/en.php
index 14cc7b7..9645d86 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -112,5 +112,7 @@ $lang["passrules"][1] = "It should contain at least one lower case letter, one u
$lang["passrules"][2] = "It should contain at least one lower case letter, one upper case letter and one digit";
$lang["passrules"][3] = "It should contain at least one lower case letter, one upper case letter, one digit and one non-alphanumeric character";
$lang["owntrackswarn"] = "Your can only edit your own tracks";
+$lang["gmauthfailure"] = "There may be problem with Google Maps API key on this page";
+$lang["gmapilink"] = "You may find more information about API keys on this Google webpage";
?>
diff --git a/lang/pl.php b/lang/pl.php
index 08d20d4..b1817ac 100644
--- a/lang/pl.php
+++ b/lang/pl.php
@@ -107,5 +107,7 @@ $lang["passrules"][1] = "Powinno ono zawierać przynajmniej jedną małą i jedn
$lang["passrules"][2] = "Powinno ono zawierać przynajmniej jedną małą, jedną wielką literę i jedną cyfrę";
$lang["passrules"][3] = "Powinno ono zawierać przynajmniej jedną małą, jedną wielką literę, jedną cyfrę i jeden znak specjalny (nie alfanumeryczny)";
$lang["owntrackswarn"] = "Możesz edytować tylko swoje własne trasy";
+$lang["gmauthfailure"] = "Prawdopodobnie na tej stronie występuje problem z kluczem API Google Maps";
+$lang["gmapilink"] = "Więcej informacji o kluczach API znajdziesz pod tym linkiem";
?>