more localization,

fixed bugs with FF3
This commit is contained in:
DennisSchiefer
2012-04-11 17:31:02 +01:00
parent ffd5e2de99
commit b1631eff77
10 changed files with 71 additions and 36 deletions
+47 -14
View File
@@ -72,21 +72,22 @@ show: function(response) {
route_desc += '<td class="result-items">';
route_desc += '<div class="result-item" onclick="OSRM.RoutingDescription.onClickRouteDescription('+response.route_instructions[i][3]+')">';
// // build route description
// if( i == 0 )
// route_desc += OSRM.loc("DIRECTION_"+response.route_instructions[i][0]).replace(/%s/, response.route_instructions[i][6]);
// else if( response.route_instructions[i][1] != "" )
// route_desc += OSRM.loc("DIRECTION_"+response.route_instructions[i][0]).replace(/\[(.*)\]/,"");
// else
// route_desc += OSRM.loc("DIRECTION_"+response.route_instructions[i][0]).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][6]);
route_desc += response.route_instructions[i][0];
// build route description
if( i == 0 )
route_desc += ' ' + OSRM.loc( response.route_instructions[i][6] );
if( response.route_instructions[i][1] != "" ) {
route_desc += ' on ';
route_desc += '<b>' + response.route_instructions[i][1] + '</b>';
}
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
else if( response.route_instructions[i][1] != "" )
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]);
else
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
// route_desc += response.route_instructions[i][0];
// if( i == 0 )
// route_desc += ' ' + OSRM.loc( response.route_instructions[i][6] );
// if( response.route_instructions[i][1] != "" ) {
// route_desc += ' on ';
// route_desc += '<b>' + response.route_instructions[i][1] + '</b>';
// }
route_desc += '</div>';
route_desc += "</td>";
@@ -181,6 +182,38 @@ getDirectionIcon: function(name) {
"You have reached your destination":"target"
};
if( directions[name] )
return directions[name];
else
return "default";
},
//map driving instructions to ids
getDirectionId: function(name) {
var directions = {
"Turn left":1,
"Turn right":2,
"U-Turn":3,
"Head":4,
"Continue":5,
"Turn slight left":6,
"Turn slight right":7,
"Turn sharp left":8,
"Turn sharp right":9,
"Enter roundabout and leave at first exit":10,
"Enter roundabout and leave at second exit":11,
"Enter roundabout and leave at third exit":12,
"Enter roundabout and leave at fourth exit":13,
"Enter roundabout and leave at fifth exit":14,
"Enter roundabout and leave at sixth exit":15,
"Enter roundabout and leave at seventh exit":16,
"Enter roundabout and leave at eighth exit":17,
"Enter roundabout and leave at nineth exit":18,
"Enter roundabout and leave at tenth exit":19,
"Enter roundabout and leave at one of the too many exit":20,
"You have reached your destination":21
};
if( directions[name] )
return directions[name];
else
-10
View File
@@ -82,16 +82,6 @@ showMarker: function(marker_id) {
OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView();
},
// keyup: force geocoder when enter is pressed
// (change event can be triggered, too; second call to geocoder gets fenced by JSONP)
// (alternative: track changes manually and only permit keyup event, if there was no change)
// do we want this?
keyUp: function(e, marker_id) {
if(e.keyCode==13)
OSRM.RoutingGUI.inputChanged(marker_id);
},
// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before])
inputChanged: function(marker_id) {
if( marker_id == OSRM.C.SOURCE_LABEL)