diff --git a/WebContent/OSRM.GUI.js b/WebContent/OSRM.GUI.js index e2096f664..093e557ce 100644 --- a/WebContent/OSRM.GUI.js +++ b/WebContent/OSRM.GUI.js @@ -20,10 +20,31 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.GUI = { - -// default state + +// defaults visible: true, width: 410, + +// init GUI +init: function() { + OSRM.GUI.visible = true; + OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth; + + document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET"); + 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("options-toggle").innerHTML = OSRM.loc("GUI_OPTIONS"); + document.getElementById("gui-search-source").innerHTML = OSRM.loc("GUI_SEARCH"); + document.getElementById("gui-search-target").innerHTML = OSRM.loc("GUI_SEARCH"); + document.getElementById("gui-search-source-label").innerHTML = OSRM.loc("GUI_START")+":"; + document.getElementById("gui-search-target-label").innerHTML = OSRM.loc("GUI_END")+":"; + document.getElementById("input-source-name").title = OSRM.loc("GUI_START_TOOLTIP"); + document.getElementById("input-target-name").title = OSRM.loc("GUI_END_TOOLTIP"); + document.getElementById("legal-notice").innerHTML = OSRM.loc("GUI_LEGAL_NOTICE"); + + document.getElementById('input-source-name').value = OSRM.DEFAULTS.ONLOAD_SOURCE; + document.getElementById('input-target-name').value = OSRM.DEFAULTS.ONLOAD_TARGET; +}, // show/hide main-gui toggleMain: function() { diff --git a/WebContent/OSRM.Markers.js b/WebContent/OSRM.Markers.js index e8fb8256a..feaee67b7 100644 --- a/WebContent/OSRM.Markers.js +++ b/WebContent/OSRM.Markers.js @@ -158,7 +158,7 @@ toString: function() { // [this holds the vital information of the route] OSRM.Markers = function() { this.route = new Array(); - this.highlight = new OSRM.HighlightMarker("highlight", {draggable:false,icon:OSRM.icons['marker-highlight']});; + this.highlight = new OSRM.HighlightMarker("highlight", {draggable:false,icon:OSRM.G.icons['marker-highlight']});; }; OSRM.extend( OSRM.Markers,{ removeAll: function() { @@ -177,7 +177,7 @@ setSource: function(position) { if( this.route[0] && this.route[0].label == OSRM.C.SOURCE_LABEL ) this.route[0].setPosition(position); else - this.route.splice(0,0, new OSRM.RouteMarker(OSRM.C.SOURCE_LABEL, {draggable:true,icon:OSRM.icons['marker-source']}, position)); + this.route.splice(0,0, new OSRM.RouteMarker(OSRM.C.SOURCE_LABEL, {draggable:true,icon:OSRM.G.icons['marker-source']}, position)); return 0; }, setTarget: function(position) { @@ -185,7 +185,7 @@ setTarget: function(position) { if( this.route[this.route.length-1] && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL ) this.route[this.route.length-1].setPosition(position); else - this.route.splice( this.route.length,0, new OSRM.RouteMarker(OSRM.C.TARGET_LABEL, {draggable:true,icon:OSRM.icons['marker-target']}, position)); + this.route.splice( this.route.length,0, new OSRM.RouteMarker(OSRM.C.TARGET_LABEL, {draggable:true,icon:OSRM.G.icons['marker-target']}, position)); return this.route.length-1; }, setVia: function(id, position) { @@ -193,7 +193,7 @@ setVia: function(id, position) { if( this.route.length<2 || id > this.route.length-2 ) return -1; - this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.icons['marker-via']}, position)); + this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.G.icons['marker-via']}, position)); return id+1; }, removeMarker: function(id) { diff --git a/WebContent/main.html b/WebContent/main.html index c53a8e78f..be1c3c099 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -45,26 +45,25 @@ or see http://www.gnu.org/licenses/agpl.txt. + - - - - - - - + + + + + - +
diff --git a/WebContent/main.js b/WebContent/main.js index 03987f151..c53ca5c08 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -16,30 +16,29 @@ or see http://www.gnu.org/licenses/agpl.txt. */ // OSRM initialization -// [initialization of maps, local strings, image prefetching] +// [initialization of maps, gui, image prefetching] // will hold the Leaflet map object OSRM.GLOBALS.map = null; // onload initialization routine -function init() { - prefetchImages(); - prefetchIcons(); +OSRM.init = function() { + OSRM.prefetchImages(); + OSRM.prefetchIcons(); - initLocale(); - initGUI(); - initMap(); + OSRM.GUI.init(); OSRM.Routing.init(); + OSRM.initMap(); - // check if the URL contains some GET parameter, e.g. for the route - checkURL(); -} + // check if the URL contains some GET parameter, e.g. for showing a route + OSRM.checkURL(); +}; // prefetch images -OSRM.images = Array(); -function prefetchImages() { +OSRM.GLOBALS.images = Array(); +OSRM.prefetchImages = function() { var images = [ 'images/marker-source.png', 'images/marker-target.png', 'images/marker-via.png', @@ -53,15 +52,15 @@ function prefetchImages() { ]; for(var i=0; i