temporary commit
This commit is contained in:
@@ -46,7 +46,7 @@ init: function() {
|
||||
|
||||
// query last update of data
|
||||
OSRM.G.data_timestamp = "n/a";
|
||||
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_TIMESTAMP_URL+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.JSONP.empty, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
||||
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_TIMESTAMP_URL+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.GUI.setDataTimestampTimeout, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
||||
},
|
||||
|
||||
// set language dependent labels
|
||||
@@ -54,7 +54,7 @@ setLabels: function() {
|
||||
document.getElementById("open-josm").innerHTML = OSRM.loc("OPEN_JOSM");
|
||||
document.getElementById("open-osmbugs").innerHTML = OSRM.loc("OPEN_OSMBUGS");
|
||||
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
|
||||
document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM_ON_ROUTE");
|
||||
// document.getElementById("gui-zoom").innerHTML = OSRM.loc("GUI_ZOOM_ON_ROUTE");
|
||||
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE");
|
||||
document.getElementById("gui-option-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");
|
||||
document.getElementById("gui-option-show-previous-routes-label").innerHTML = OSRM.loc("GUI_SHOW_PREVIOUS_ROUTES");
|
||||
@@ -133,10 +133,14 @@ changeDistanceFormat: function(type) {
|
||||
// set timestamp of data
|
||||
setDataTimestamp: function(response) {
|
||||
if(!response)
|
||||
return;
|
||||
|
||||
OSRM.GUI.setDataTimestampTimeout();
|
||||
|
||||
OSRM.G.data_timestamp = response.timestamp.slice(0,25).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags
|
||||
document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp;
|
||||
},
|
||||
setDataTimestampTimeout: function() {
|
||||
OSRM.G.data_timestamp = "n/a";
|
||||
document.getElementById('gui-data-timestamp').innerHTML = OSRM.G.data_timestamp;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -36,24 +36,46 @@ init: function() {
|
||||
document.getElementById("gui-search-target").onclick = function() {OSRM.GUI.showMarker(OSRM.C.TARGET_LABEL);};
|
||||
|
||||
document.getElementById("gui-reset").onclick = OSRM.GUI.resetRouting;
|
||||
document.getElementById("gui-zoom").onclick = OSRM.GUI.zoomOnRoute;
|
||||
// document.getElementById("gui-zoom").onclick = OSRM.GUI.zoomOnRoute;
|
||||
document.getElementById("gui-reverse").onclick = OSRM.GUI.reverseRouting;
|
||||
document.getElementById("open-josm").onclick = OSRM.GUI.openJOSM;
|
||||
document.getElementById("open-osmbugs").onclick = OSRM.GUI.openOSMBugs;
|
||||
document.getElementById("option-highlight-nonames").onclick = OSRM.GUI.hightlightNonames;
|
||||
document.getElementById("option-show-previous-routes").onclick = OSRM.GUI.showPreviousRoutes;
|
||||
|
||||
// engine toggle
|
||||
var engines = OSRM.DEFAULTS.ROUTING_ENGINES;
|
||||
var options = [];
|
||||
for(var i=0, size=engines.length; i<size; i++) {
|
||||
options.push( {display:engines[i].title, value:i} );
|
||||
}
|
||||
|
||||
// generate selectors
|
||||
OSRM.GUI.selectorInit("gui-engine-toggle", options, OSRM.DEFAULTS.ONLOAD_ENGINE, OSRM.GUI.engineChanged);
|
||||
},
|
||||
|
||||
engineChanged: function( engine ) {
|
||||
OSRM.G.active_routing_engine = engine;
|
||||
OSRM.G.active_routing_server_url = OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].url;
|
||||
|
||||
// query route
|
||||
if( OSRM.G.markers.route.length > 1 )
|
||||
OSRM.Routing.getRoute();
|
||||
|
||||
// query timestamp of data
|
||||
OSRM.JSONP.call( OSRM.DEFAULTS.ROUTING_ENGINES[ OSRM.G.active_routing_engine ].timestamp+"?jsonp=%jsonp", OSRM.GUI.setDataTimestamp, OSRM.GUI.setDataTimestampTimeout, OSRM.DEFAULTS.JSONP_TIMEOUT, 'data_timestamp');
|
||||
},
|
||||
|
||||
// toggle GUI features that need a route to work
|
||||
activateRouteFeatures: function() {
|
||||
OSRM.Printing.activate();
|
||||
document.getElementById("gui-zoom").className = "button";
|
||||
document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route";
|
||||
// document.getElementById("gui-zoom").className = "button";
|
||||
// document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route";
|
||||
},
|
||||
deactivateRouteFeatures: function() {
|
||||
OSRM.Printing.deactivate();
|
||||
document.getElementById("gui-zoom").className = "button-inactive";
|
||||
document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route-inactive";
|
||||
// document.getElementById("gui-zoom").className = "button-inactive";
|
||||
// document.getElementById('leaflet-control-locations-route').className = "leaflet-control-locations-route-inactive";
|
||||
},
|
||||
|
||||
// click: button "reset"
|
||||
|
||||
Reference in New Issue
Block a user