more localization,
fixed bugs with FF3
This commit is contained in:
parent
ffd5e2de99
commit
b1631eff77
@ -44,12 +44,10 @@ init: function() {
|
|||||||
document.getElementById("gui-printer").onclick = OSRM.Printing.print;
|
document.getElementById("gui-printer").onclick = OSRM.Printing.print;
|
||||||
|
|
||||||
document.getElementById("gui-input-source").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.SOURCE_LABEL);};
|
document.getElementById("gui-input-source").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.SOURCE_LABEL);};
|
||||||
document.getElementById("gui-input-source").onkeyup = function(e) {OSRM.RoutingGUI.keyUp(e,OSRM.C.SOURCE_LABEL);};
|
|
||||||
document.getElementById("gui-delete-source").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.SOURCE_LABEL);};
|
document.getElementById("gui-delete-source").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.SOURCE_LABEL);};
|
||||||
document.getElementById("gui-search-source").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.SOURCE_LABEL);};
|
document.getElementById("gui-search-source").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.SOURCE_LABEL);};
|
||||||
|
|
||||||
document.getElementById("gui-input-target").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.TARGET_LABEL);};
|
document.getElementById("gui-input-target").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.TARGET_LABEL);};
|
||||||
document.getElementById("gui-input-target").onkeyup = function(e) {OSRM.RoutingGUI.keyUp(e,OSRM.C.TARGET_LABEL);};
|
|
||||||
document.getElementById("gui-delete-target").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.TARGET_LABEL);};
|
document.getElementById("gui-delete-target").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.TARGET_LABEL);};
|
||||||
document.getElementById("gui-search-target").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.TARGET_LABEL);};
|
document.getElementById("gui-search-target").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.TARGET_LABEL);};
|
||||||
|
|
||||||
@ -129,6 +127,12 @@ toggleOptions: function() {
|
|||||||
} else {
|
} else {
|
||||||
document.getElementById('options-box').style.visibility="visible";
|
document.getElementById('options-box').style.visibility="visible";
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// clear output area
|
||||||
|
clearResults: function() {
|
||||||
|
document.getElementById('information-box').innerHTML = "";
|
||||||
|
document.getElementById('information-box-header').innerHTML = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -79,7 +79,7 @@ _showResults: function(response, parameters) {
|
|||||||
|
|
||||||
// show first result
|
// show first result
|
||||||
OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon);
|
OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon);
|
||||||
if( OSRM.G.markers.route.length > 1 )
|
if( OSRM.G.markers.route.length > 1 ) // if a route is displayed, we don't need to show other possible geocoding results
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// show possible results for input
|
// show possible results for input
|
||||||
|
@ -109,7 +109,9 @@ onDragStart: function(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( this.parent != OSRM.G.markers.highlight)
|
if( this.parent != OSRM.G.markers.highlight)
|
||||||
OSRM.G.markers.highlight.hide();
|
OSRM.G.markers.highlight.hide();
|
||||||
|
if( this.parent != OSRM.G.markers.dragger)
|
||||||
|
OSRM.G.markers.dragger.hide();
|
||||||
if (OSRM.G.route.isShown())
|
if (OSRM.G.route.isShown())
|
||||||
OSRM.G.route.showOldRoute();
|
OSRM.G.route.showOldRoute();
|
||||||
},
|
},
|
||||||
@ -124,8 +126,7 @@ onDragEnd: function(e) {
|
|||||||
OSRM.G.route.hideUnnamedRoute();
|
OSRM.G.route.hideUnnamedRoute();
|
||||||
} else {
|
} else {
|
||||||
OSRM.Geocoder.updateAddress(this.parent.label);
|
OSRM.Geocoder.updateAddress(this.parent.label);
|
||||||
document.getElementById('information-box').innerHTML = ""; // do we want this?
|
OSRM.GUI.clearResults();
|
||||||
document.getElementById('information-box-header').innerHTML = "";
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toString: function() {
|
toString: function() {
|
||||||
|
@ -59,10 +59,11 @@ OSRM.Localization["de"] = {
|
|||||||
"SW": "Südwest",
|
"SW": "Südwest",
|
||||||
"NW": "Nordwest",
|
"NW": "Nordwest",
|
||||||
// driving directions
|
// driving directions
|
||||||
|
"DIRECTION_0":"Unbekannte Anweisung[ auf <b>%s</b>]",
|
||||||
"DIRECTION_1":"Links abbiegen[ auf <b>%s</b>]",
|
"DIRECTION_1":"Links abbiegen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_2":"Rechts abbiegen[ auf <b>%s</b>]",
|
"DIRECTION_2":"Rechts abbiegen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_3":"Umkehren[ auf <b>%s</b>]",
|
"DIRECTION_3":"Umkehren[ auf <b>%s</b>]",
|
||||||
"DIRECTION_4":"Fahren Sie Richtung %s",
|
"DIRECTION_4":"Fahren Sie Richtung <b>%s</b>",
|
||||||
"DIRECTION_5":"Weiterfahren[ auf <b>%s</b>]",
|
"DIRECTION_5":"Weiterfahren[ auf <b>%s</b>]",
|
||||||
"DIRECTION_6":"Leicht links abbiegen[ auf <b>%s</b>]",
|
"DIRECTION_6":"Leicht links abbiegen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_7":"Leicht rechts abbiegen[ auf <b>%s</b>]",
|
"DIRECTION_7":"Leicht rechts abbiegen[ auf <b>%s</b>]",
|
||||||
@ -72,7 +73,7 @@ OSRM.Localization["de"] = {
|
|||||||
"DIRECTION_11":"In den Kreisverkehr einfahren und bei zweiter Möglichkeit verlassen[ auf <b>%s</b>]",
|
"DIRECTION_11":"In den Kreisverkehr einfahren und bei zweiter Möglichkeit verlassen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_12":"In den Kreisverkehr einfahren und bei dritter Möglichkeit verlassen[ auf <b>%s</b>]",
|
"DIRECTION_12":"In den Kreisverkehr einfahren und bei dritter Möglichkeit verlassen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_13":"In den Kreisverkehr einfahren und bei vierter Möglichkeit verlassen[ auf <b>%s</b>]",
|
"DIRECTION_13":"In den Kreisverkehr einfahren und bei vierter Möglichkeit verlassen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_14":"In den Kreisverkehr einfahren und bei f<EFBFBD>nfter Möglichkeit verlassen[ auf <b>%s</b>]",
|
"DIRECTION_14":"In den Kreisverkehr einfahren und bei fünfter Möglichkeit verlassen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_15":"In den Kreisverkehr einfahren und bei sechster Möglichkeit verlassen[ auf <b>%s</b>]",
|
"DIRECTION_15":"In den Kreisverkehr einfahren und bei sechster Möglichkeit verlassen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_16":"In den Kreisverkehr einfahren und bei siebter Möglichkeit verlassen[ auf <b>%s</b>]",
|
"DIRECTION_16":"In den Kreisverkehr einfahren und bei siebter Möglichkeit verlassen[ auf <b>%s</b>]",
|
||||||
"DIRECTION_17":"In den Kreisverkehr einfahren und bei achter Möglichkeit verlassen[ auf <b>%s</b>]",
|
"DIRECTION_17":"In den Kreisverkehr einfahren und bei achter Möglichkeit verlassen[ auf <b>%s</b>]",
|
||||||
|
@ -59,10 +59,11 @@ OSRM.Localization["en"] = {
|
|||||||
"SW": "southwest",
|
"SW": "southwest",
|
||||||
"NW": "northwest",
|
"NW": "northwest",
|
||||||
// driving directions
|
// driving directions
|
||||||
|
"DIRECTION_0":"Unknown instruction[ on <b>%s</b>]",
|
||||||
"DIRECTION_1":"Turn left[ on <b>%s</b>]",
|
"DIRECTION_1":"Turn left[ on <b>%s</b>]",
|
||||||
"DIRECTION_2":"Turn right[ on <b>%s</b>]",
|
"DIRECTION_2":"Turn right[ on <b>%s</b>]",
|
||||||
"DIRECTION_3":"U-Turn[ on <b>%s</b>]",
|
"DIRECTION_3":"U-Turn[ on <b>%s</b>]",
|
||||||
"DIRECTION_4":"Head %s",
|
"DIRECTION_4":"Head <b>%s</b>",
|
||||||
"DIRECTION_5":"Continue[ on <b>%s</b>]",
|
"DIRECTION_5":"Continue[ on <b>%s</b>]",
|
||||||
"DIRECTION_6":"Turn slight left[ on <b>%s</b>]",
|
"DIRECTION_6":"Turn slight left[ on <b>%s</b>]",
|
||||||
"DIRECTION_7":"Turn slight right[ on <b>%s</b>]",
|
"DIRECTION_7":"Turn slight right[ on <b>%s</b>]",
|
||||||
|
@ -30,6 +30,7 @@ init: function() {
|
|||||||
// create dropdown menu
|
// create dropdown menu
|
||||||
var select = document.createElement('select');
|
var select = document.createElement('select');
|
||||||
select.id = "gui-language-toggle";
|
select.id = "gui-language-toggle";
|
||||||
|
select.className = "top-left-button";
|
||||||
select.onchange = function() { OSRM.Localization.change(this.value); };
|
select.onchange = function() { OSRM.Localization.change(this.value); };
|
||||||
|
|
||||||
// fill dropdown menu
|
// fill dropdown menu
|
||||||
@ -67,7 +68,7 @@ change: function(language) {
|
|||||||
} else {
|
} else {
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
script.src = "Localization/OSRM.Locale."+language+".js";
|
script.src = "localization/OSRM.Locale."+language+".js";
|
||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -131,6 +131,10 @@ html, body {
|
|||||||
border: 0px;
|
border: 0px;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
.top-left-button
|
||||||
|
{
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
.top-right-button
|
.top-right-button
|
||||||
{
|
{
|
||||||
float:right;
|
float:right;
|
||||||
|
@ -64,8 +64,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
<script src="OSRM.Browser.js" type="text/javascript"></script>
|
<script src="OSRM.Browser.js" type="text/javascript"></script>
|
||||||
<script src="OSRM.JSONP.js" type="text/javascript"></script>
|
<script src="OSRM.JSONP.js" type="text/javascript"></script>
|
||||||
<script src="Localization/OSRM.Localization.js" type="text/javascript"></script>
|
<script src="localization/OSRM.Localization.js" type="text/javascript"></script>
|
||||||
<script src="Printing/OSRM.Printing.js" type="text/javascript"></script>
|
<script src="printing/OSRM.Printing.js" type="text/javascript"></script>
|
||||||
<script src="OSRM.Utils.js" type="text/javascript"></script>
|
<script src="OSRM.Utils.js" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -72,21 +72,22 @@ show: function(response) {
|
|||||||
route_desc += '<td class="result-items">';
|
route_desc += '<td class="result-items">';
|
||||||
route_desc += '<div class="result-item" onclick="OSRM.RoutingDescription.onClickRouteDescription('+response.route_instructions[i][3]+')">';
|
route_desc += '<div class="result-item" onclick="OSRM.RoutingDescription.onClickRouteDescription('+response.route_instructions[i][3]+')">';
|
||||||
|
|
||||||
// // build route description
|
// 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];
|
|
||||||
if( i == 0 )
|
if( i == 0 )
|
||||||
route_desc += ' ' + OSRM.loc( response.route_instructions[i][6] );
|
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
|
||||||
if( response.route_instructions[i][1] != "" ) {
|
else if( response.route_instructions[i][1] != "" )
|
||||||
route_desc += ' on ';
|
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]);
|
||||||
route_desc += '<b>' + response.route_instructions[i][1] + '</b>';
|
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 += '</div>';
|
||||||
route_desc += "</td>";
|
route_desc += "</td>";
|
||||||
|
|
||||||
@ -181,6 +182,38 @@ getDirectionIcon: function(name) {
|
|||||||
"You have reached your destination":"target"
|
"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] )
|
if( directions[name] )
|
||||||
return directions[name];
|
return directions[name];
|
||||||
else
|
else
|
||||||
|
@ -82,16 +82,6 @@ showMarker: function(marker_id) {
|
|||||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView();
|
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])
|
// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before])
|
||||||
inputChanged: function(marker_id) {
|
inputChanged: function(marker_id) {
|
||||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
if( marker_id == OSRM.C.SOURCE_LABEL)
|
||||||
|
Loading…
Reference in New Issue
Block a user