From 0cf4d26fa38c09d4ad7fe4259e89eeb9c5f08c52 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 02:24:32 +0000 Subject: added extended reload control feature --- map.js | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/map.js b/map.js index f2aa9aa..56212d6 100644 --- a/map.js +++ b/map.js @@ -58,7 +58,7 @@ function initialize(lat, lng, res) { countboxText = document.createTextNode("Aktiv: 0"); countbox.appendChild(countboxText); -//##// reloadcon.started(); + reloadcon.started(); $.get( "data.php",onData); } @@ -73,8 +73,9 @@ function onMapClick(mouse_event) //##// reloadcon.finished(); //##// return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")"); //##// } -//##// reloadcon.loaded(); function onData(xmlData) { + reloadcon.loaded(); + for(var loc in overlays["locations"]) { overlays["locations"][loc].setMap(null); } @@ -99,7 +100,7 @@ function onData(xmlData) { countboxText.data = "Aktiv: " + count; } -//##// reloadcon.finished(); + reloadcon.finished(); } function drawLocations(xmlData) { @@ -527,7 +528,7 @@ function onFFLogin(xmlData) { if(status[0].getAttribute("code") == "logged_in") { var username = xmlData.getElementsByTagName("username")[0].getAttribute("name"); showFFLogout(username); -//##// reloadcon.started(); + reloadcon.started(); $.get( "data.php",onData); } } @@ -559,7 +560,7 @@ function onFFLogout(xmlData) { } else { showFFLogin(); -//##// reloadcon.started(); + reloadcon.started(); $.get("data.php", onData); } } @@ -597,30 +598,21 @@ function ReloadControl(controlDiv, map) { controlDiv.appendChild(controlUI); var controlText = document.createElement('div'); - controlText.innerHTML = 'Daten neu laden'; + controlText.innerHTML = 'Daten neu laden'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { -// reloadcon.started(); + controlText.innerHTML = 'wird geladen...'; $.get("data.php", onData); }); -} - -// ReloadControl.prototype.started = function() { -// btnText.data = "wird geladen..."; -// } -// ReloadControl.prototype.loaded = function() { -// btnText.data = "wird verarbeitet..."; -// } - -// ReloadControl.prototype.finished = function() { -// btnText.data = "Daten neu laden"; -// } + var cntrl = new Object(); + cntrl.started = function() { controlText.innerHTML = 'wird geladen...'; } + cntrl.loaded = function() { controlText.innerHTML = 'wird verarbeitet...'; } + cntrl.finished = function() { controlText.innerHTML = 'Daten neu laden'; } + return cntrl; +} -// ReloadControl.prototype.getDefaultPosition = function() { -// return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7)); -// } //##//function RulerControl() { -- cgit v1.2.1