added call option to set destination when calling the site
This commit is contained in:
parent
74188206e8
commit
d453cadc8c
@ -177,6 +177,9 @@ function checkURL(){
|
|||||||
if( called_url != '') {
|
if( called_url != '') {
|
||||||
var positions = [];
|
var positions = [];
|
||||||
|
|
||||||
|
var destination = undefined;
|
||||||
|
var destination_name = undefined;
|
||||||
|
|
||||||
// parse input (currently only parses start, dest, via)
|
// parse input (currently only parses start, dest, via)
|
||||||
var splitted_url = called_url.split('&');
|
var splitted_url = called_url.split('&');
|
||||||
for(var i=0; i<splitted_url.length; i++) {
|
for(var i=0; i<splitted_url.length; i++) {
|
||||||
@ -184,12 +187,26 @@ function checkURL(){
|
|||||||
if(name_val.length!=2)
|
if(name_val.length!=2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var coordinates = unescape(name_val[1]).split(',');
|
if(name_val[0] == 'loc') {
|
||||||
if(coordinates.length!=2)
|
var coordinates = unescape(name_val[1]).split(',');
|
||||||
continue;
|
if(coordinates.length==2)
|
||||||
|
positions.push ( new L.LatLng( coordinates[0], coordinates[1]) );
|
||||||
|
}
|
||||||
|
else if(name_val[0] == 'dest') {
|
||||||
|
var coordinates = unescape(name_val[1]).split(',');
|
||||||
|
if(coordinates.length==2)
|
||||||
|
destination = new L.LatLng( coordinates[0], coordinates[1]);
|
||||||
|
}
|
||||||
|
else if(name_val[0] == 'destname')
|
||||||
|
destination_name = name_val[1];
|
||||||
|
}
|
||||||
|
|
||||||
if(name_val[0] == 'loc')
|
// destination given
|
||||||
positions.push ( new L.LatLng( coordinates[0], coordinates[1]) );
|
if( destination != undefined ) {
|
||||||
|
onclickGeocoderResult("target", destination.lat, destination.lng, (destination_name == undefined) );
|
||||||
|
if( destination_name != undefined )
|
||||||
|
document.getElementById("input-target-name").value = decodeURI(destination_name);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw via points
|
// draw via points
|
||||||
|
@ -139,7 +139,6 @@ function showRouteDescription(response) {
|
|||||||
|
|
||||||
// create link to the route
|
// create link to the route
|
||||||
var route_link ='<span class="route-summary" id="route-prelink">[<a id="gpx-link" href="#" onclick="onClickCreateShortcut(\'' + OSRM.DEFAULTS.WEBSITE_URL + query_string + '\')">'+OSRM.loc("GET_LINK")+'</a>]</span>';
|
var route_link ='<span class="route-summary" id="route-prelink">[<a id="gpx-link" href="#" onclick="onClickCreateShortcut(\'' + OSRM.DEFAULTS.WEBSITE_URL + query_string + '\')">'+OSRM.loc("GET_LINK")+'</a>]</span>';
|
||||||
alert(OSRM.DEFAULTS.WEBSITE_URL);
|
|
||||||
|
|
||||||
// create GPX link
|
// create GPX link
|
||||||
var gpx_link = '<span class="route-summary">[<a id="gpx-link" onClick="javascript: document.location.href=\'' + OSRM.DEFAULTS.HOST_ROUTING_URL + query_string + '&output=gpx\';">'+OSRM.loc("GPX_FILE")+'</a>]</span>';
|
var gpx_link = '<span class="route-summary">[<a id="gpx-link" onClick="javascript: document.location.href=\'' + OSRM.DEFAULTS.HOST_ROUTING_URL + query_string + '&output=gpx\';">'+OSRM.loc("GPX_FILE")+'</a>]</span>';
|
||||||
|
Loading…
Reference in New Issue
Block a user