Apparently 'final' is a reserved word in JS...

This commit is contained in:
Richard Fairhurst 2014-01-23 22:29:09 +00:00
parent 7c13b43f31
commit 149182f620
5 changed files with 8 additions and 8 deletions

View file

@ -159,10 +159,10 @@ OSM.Routing=function(map,name,jqSearch) {
// Route-fetching UI
r.requestRoute=function(final) {
r.requestRoute=function(isFinal) {
if (r.route_from && r.route_to) {
r.awaitingRoute=true;
r.chosenEngine.getRoute(final,[r.route_from,r.route_to]);
r.chosenEngine.getRoute(isFinal,[r.route_from,r.route_to]);
// then, when the route has been fetched, it'll call the engine's gotRoute function
} else if (r.route_from==false || r.route_to==false) {
// we're waiting for a Nominatim response before we can request a route

View file

@ -16,7 +16,7 @@ OSM.RoutingEngines.list.push({
"TSHR": 4,
"TU": 5
}, // was half expecting to see TLDR in there
getRoute: function(final,points) {
getRoute: function(isFinal,points) {
var url="http://routes.cloudmade.com/8ee2a50541944fb9bcedded5165f09d9/api/0.3/";
var p=[];
for (var i=0; i<points.length; i++) {

View file

@ -4,13 +4,13 @@ OSM.RoutingEngines.list.push({
name: 'Bicycle (GraphHopper)',
draggable: true,
_hints: {},
getRoute: function(final, points) {
getRoute: function(isFinal, points) {
var url = "http://graphhopper.com/routing/api/route?vehicle=bike&locale=en";
for (var i = 0; i < points.length; i++) {
var pair = points[i].join(',');
url += "&point=" + pair;
}
if (final)
if (isFinal)
url += "&instructions=true";
this.requestJSONP(url + "&type=jsonp&callback=");
},

View file

@ -30,7 +30,7 @@ OSM.RoutingEngines.list.push({
17: 8, // left fork
18: 1 // straight fork
},
getRoute: function(final,points) {
getRoute: function(isFinal,points) {
var url="http://open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluur290anu%2Crl%3Do5-908a0y";
var from=points[0]; var to=points[points.length-1];
url+="&from="+from.join(',');

View file

@ -6,14 +6,14 @@ OSM.RoutingEngines.list.push({
name: 'Car (OSRM)',
draggable: true,
_hints: {},
getRoute: function(final,points) {
getRoute: function(isFinal,points) {
var url="http://router.project-osrm.org/viaroute?z=14&output=json";
for (var i=0; i<points.length; i++) {
var pair=points[i].join(',');
url+="&loc="+pair;
if (this._hints[pair]) url+= "&hint="+this._hints[pair];
}
if (final) url+="&instructions=true";
if (isFinal) url+="&instructions=true";
this.requestJSONP(url+"&jsonp=");
},
gotRoute: function(router,data) {