diff --git a/WebContent/OSRM.GUI.js b/WebContent/OSRM.GUI.js index f60b44913..6d4c3841d 100644 --- a/WebContent/OSRM.GUI.js +++ b/WebContent/OSRM.GUI.js @@ -30,6 +30,9 @@ init: function() { OSRM.GUI.visible = true; OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth; + // init favicon + document.getElementById('favicon').href=OSRM.G.images["favicon"].src; + // init starting source/target document.getElementById('gui-input-source').value = OSRM.DEFAULTS.ONLOAD_SOURCE; document.getElementById('gui-input-target').value = OSRM.DEFAULTS.ONLOAD_TARGET; diff --git a/WebContent/main.html b/WebContent/main.html index 271f73d46..e6be48e39 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -30,7 +30,7 @@ or see http://www.gnu.org/licenses/agpl.txt. - + diff --git a/WebContent/main.js b/WebContent/main.js index a93203567..b848d95e8 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -27,7 +27,7 @@ OSRM.init = function() { OSRM.Localization.init(); OSRM.GUI.init(); OSRM.Map.init(); - OSRM.Routing.init(); + OSRM.Routing.init(); // check if the URL contains some GET parameter, e.g. for showing a route OSRM.checkURL(); @@ -35,40 +35,54 @@ OSRM.init = function() { // prefetch images -OSRM.GLOBALS.images = Array(); +OSRM.GLOBALS.images = {}; OSRM.prefetchImages = function() { - var images = [ 'images/marker-source.png', - 'images/marker-target.png', - 'images/marker-via.png', - 'images/marker-highlight.png', - 'images/marker-source-drag.png', - 'images/marker-target-drag.png', - 'images/marker-via-drag.png', - 'images/marker-highlight-drag.png', - 'images/marker-drag.png', - 'images/cancel.png', - 'images/cancel_active.png', - 'images/cancel_hover.png', - 'images/restore.png', - 'images/restore_active.png', - 'images/restore_hover.png', - 'images/printer.png', - 'images/printer_active.png', - 'images/printer_hover.png', - 'images/printer_inactive.png' - ]; - - for(var i=0; i'; route_desc += ''; - route_desc += ''; + route_desc += ''; route_desc += ""; route_desc += ''; @@ -158,33 +158,33 @@ showNA: function( display_text ) { // [TODO: language-safe implementation] getDirectionIcon: function(name) { var directions = { - "Turn left":"turn-left.png", - "Turn right":"turn-right.png", - "U-Turn":"u-turn.png", - "Head":"continue.png", - "Continue":"continue.png", - "Turn slight left":"slight-left.png", - "Turn slight right":"slight-right.png", - "Turn sharp left":"sharp-left.png", - "Turn sharp right":"sharp-right.png", - "Enter roundabout and leave at first exit":"round-about.png", - "Enter roundabout and leave at second exit":"round-about.png", - "Enter roundabout and leave at third exit":"round-about.png", - "Enter roundabout and leave at fourth exit":"round-about.png", - "Enter roundabout and leave at fifth exit":"round-about.png", - "Enter roundabout and leave at sixth exit":"round-about.png", - "Enter roundabout and leave at seventh exit":"round-about.png", - "Enter roundabout and leave at eighth exit":"round-about.png", - "Enter roundabout and leave at nineth exit":"round-about.png", - "Enter roundabout and leave at tenth exit":"round-about.png", - "Enter roundabout and leave at one of the too many exit":"round-about.png", - "You have reached your destination":"target.png" + "Turn left":"turn-left", + "Turn right":"turn-right", + "U-Turn":"u-turn", + "Head":"continue", + "Continue":"continue", + "Turn slight left":"slight-left", + "Turn slight right":"slight-right", + "Turn sharp left":"sharp-left", + "Turn sharp right":"sharp-right", + "Enter roundabout and leave at first exit":"round-about", + "Enter roundabout and leave at second exit":"round-about", + "Enter roundabout and leave at third exit":"round-about", + "Enter roundabout and leave at fourth exit":"round-about", + "Enter roundabout and leave at fifth exit":"round-about", + "Enter roundabout and leave at sixth exit":"round-about", + "Enter roundabout and leave at seventh exit":"round-about", + "Enter roundabout and leave at eighth exit":"round-about", + "Enter roundabout and leave at nineth exit":"round-about", + "Enter roundabout and leave at tenth exit":"round-about", + "Enter roundabout and leave at one of the too many exit":"round-about", + "You have reached your destination":"target" }; if( directions[name] ) return directions[name]; else - return "default.png"; + return "default"; } }; \ No newline at end of file diff --git a/WebContent/routing/OSRM.RoutingGUI.js b/WebContent/routing/OSRM.RoutingGUI.js index e549b1a0a..b276ad1f3 100644 --- a/WebContent/routing/OSRM.RoutingGUI.js +++ b/WebContent/routing/OSRM.RoutingGUI.js @@ -48,17 +48,17 @@ reverseRouting: function() { if(OSRM.G.markers.route.length == 1) { if(OSRM.G.markers.route[0].label == OSRM.C.TARGET_LABEL) { OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL; - OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') ); + OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-source'] ); } else if(OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL) { OSRM.G.markers.route[0].label = OSRM.C.TARGET_LABEL; - OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-target.png') ); + OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-target'] ); } } else if(OSRM.G.markers.route.length > 1){ OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL; - OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') ); + OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-source'] ); OSRM.G.markers.route[OSRM.G.markers.route.length-1].label = OSRM.C.TARGET_LABEL; - OSRM.G.markers.route[OSRM.G.markers.route.length-1].marker.setIcon( new L.Icon('images/marker-target.png') ); + OSRM.G.markers.route[OSRM.G.markers.route.length-1].marker.setIcon( OSRM.G.icons['marker-target'] ); } // recompute route