diff --git a/index.php b/index.php index d406198..b2c3141 100644 --- a/index.php +++ b/index.php @@ -92,7 +92,21 @@ } ?>
Votre navigateur doit prendre en charge la géolocalisation pour que ce site puisse fonctionner correctement.
Your browser must have geolocation capabilities for this site to display.
Map is handled thanks to the Leaflet library, using © OpenStreetMap contributors tiles. Reverse geolocation (Nominatim) are provided by the MapQuest open API. Routes are provided by the OSRM project (OSRM is a free and open source program under GNU Affero GPL).
diff --git a/js.js b/js.js index 4ea2e02..a0e9d67 100644 --- a/js.js +++ b/js.js @@ -2,11 +2,23 @@ var tiles_provider = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png'; var reverse_geolocation_provider = "http://open.mapquestapi.com/nominatim/v1/reverse.php"; var directions_provider = "http://router.project-osrm.org/viaroute"; +var lat_long_provider = "http://open.mapquestapi.com/nominatim/v1/search.php" var email = "webmaster@phyks.me"; //Mettre votre adresse e-mail ici si vous utilisez Nominatim (cf Usage Policy de Nominatim) /* Script : */ window.onload = function() { + function escapeHTML(unsafe) + { + return unsafe + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + } + + function params() //Get all the parameters in the URL { var t = location.search.substring(1).split('&'); @@ -14,7 +26,7 @@ window.onload = function() { for (var i=0; iUne erreur a été rencontrée. Veuillez réessayer.
"; + else + getBikes(latitude, longitude); + } + } + } + } + + xhr.open("GET", lat_long_provider+"?format=json&q="+encodeURI(position+", Paris, France"), true); //xhr handle the data about stations + xhr.send(); + } } else { - document.getElementById("position").innerHTML = "Votre navigateur doit prendre en charge la géolocalisation pour que ce site puisse fonctionner correctement.
"; + var input_params = ''; + + for(GET in params) //Define hidden input to keep params + { + if(GET != '') + { + input_params += ""; + } + } + + document.getElementById("position").innerHTML = ''; } } else //If we didn't choose what to do, display the choices { - document.getElementById("position").innerHTML = ""; } }