diff --git a/WebContent/OSRM.GUI.js b/WebContent/OSRM.GUI.js index 223c2a914..f47b548ad 100644 --- a/WebContent/OSRM.GUI.js +++ b/WebContent/OSRM.GUI.js @@ -29,6 +29,34 @@ width: null, init: function() { OSRM.GUI.visible = true; OSRM.GUI.width = document.getElementById("main-wrapper").clientWidth; + + // init events + // [TODO: switch to new event model] + document.getElementById("gui-toggle-in").onclick = OSRM.GUI.toggleMain; + document.getElementById("gui-toggle-out").onclick = OSRM.GUI.toggleMain; + 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-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-input-target").onchange = function() {OSRM.RoutingGUI.inputChanged(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-reset").onclick = OSRM.RoutingGUI.resetRouting; + document.getElementById("gui-reverse").onclick = OSRM.RoutingGUI.reverseRouting; + document.getElementById("gui-options-toggle").onclick = OSRM.GUI.toggleOptions; + document.getElementById("open-josm").onclick = OSRM.RoutingGUI.openJOSM; + document.getElementById("open-osmbugs").onclick = OSRM.RoutingGUI.openOSMBugs; + + // gui after transition events + if( OSRM.Browser.FF3==-1 && OSRM.Browser.IE6_9==-1 ) { + document.getElementById('main-wrapper').addEventListener("transitionend", OSRM.GUI.onMainTransitionEnd, false); + document.getElementById('main-wrapper').addEventListener("webkitTransitionEnd", OSRM.GUI.onMainTransitionEnd, false); + document.getElementById('main-wrapper').addEventListener("oTransitionEnd", OSRM.GUI.onMainTransitionEnd, false); + document.getElementById('main-wrapper').addEventListener("MSTransitionEnd", OSRM.GUI.onMainTransitionEnd, false); + } }, // set language dependent labels @@ -38,17 +66,17 @@ setLanguage: function() { 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-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("gui-input-source").title = OSRM.loc("GUI_START_TOOLTIP"); + document.getElementById("gui-input-target").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; + document.getElementById('gui-input-source').value = OSRM.DEFAULTS.ONLOAD_SOURCE; + document.getElementById('gui-input-target').value = OSRM.DEFAULTS.ONLOAD_TARGET; }, // show/hide main-gui @@ -68,15 +96,9 @@ toggleMain: function() { document.getElementById('main-wrapper').style.left=-OSRM.GUI.width+"px"; } - // execute after animation - if( OSRM.Browser.FF3==-1 && OSRM.Browser.IE6_9==-1 ) { - document.getElementById('main-wrapper').addEventListener("transitionend", OSRM.GUI.onMainTransitionEnd, false); - document.getElementById('main-wrapper').addEventListener("webkitTransitionEnd", OSRM.GUI.onMainTransitionEnd, false); - document.getElementById('main-wrapper').addEventListener("oTransitionEnd", OSRM.GUI.onMainTransitionEnd, false); - document.getElementById('main-wrapper').addEventListener("MSTransitionEnd", OSRM.GUI.onMainTransitionEnd, false); - } else { + // execute after animation (old browser support) + if( OSRM.Browser.FF3!=-1 || OSRM.Browser.IE6_9!=-1 ) OSRM.GUI.onMainTransitionEnd(); - } }, // do stuff after main-gui animation finished diff --git a/WebContent/OSRM.Geocoder.js b/WebContent/OSRM.Geocoder.js index 76378f43f..80f302995 100644 --- a/WebContent/OSRM.Geocoder.js +++ b/WebContent/OSRM.Geocoder.js @@ -91,7 +91,7 @@ _showResults: function(response, parameters) { html += ''; if(result.display_name){ - html += '
'+result.display_name+'
'; + html += '
'+result.display_name+'
'; } html += ""; } @@ -128,9 +128,9 @@ _showResults_Timeout: function() { //update geo coordinates in input boxes updateLocation: function(marker_id) { if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) { - document.getElementById("input-source-name").value = OSRM.G.markers.route[0].getLat().toFixed(6) + ", " + OSRM.G.markers.route[0].getLng().toFixed(6); + document.getElementById("gui-input-source").value = OSRM.G.markers.route[0].getLat().toFixed(6) + ", " + OSRM.G.markers.route[0].getLng().toFixed(6); } else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) { - document.getElementById("input-target-name").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat().toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng().toFixed(6); + document.getElementById("gui-input-target").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLat().toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getLng().toFixed(6); } }, @@ -198,9 +198,9 @@ _showReverseResults: function(response, parameters) { // add result to DOM if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) - document.getElementById("input-source-name").value = address; + document.getElementById("gui-input-source").value = address; else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) - document.getElementById("input-target-name").value = address; + document.getElementById("gui-input-target").value = address; }, _showReverseResults_Timeout: function(response, parameters) { if(!parameters.do_fallback) diff --git a/WebContent/OSRM.Markers.js b/WebContent/OSRM.Markers.js index ad649bc7c..8858a8ba1 100644 --- a/WebContent/OSRM.Markers.js +++ b/WebContent/OSRM.Markers.js @@ -174,8 +174,8 @@ removeAll: function() { for(var i=0; i - +
@@ -79,7 +79,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
-
+
@@ -90,9 +90,9 @@ or see http://www.gnu.org/licenses/agpl.txt.
-
+
-
+
@@ -102,15 +102,15 @@ or see http://www.gnu.org/licenses/agpl.txt.
Start:
-
-
- +
+
+
Ende:
-
-
- +
+
+
@@ -118,8 +118,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
@@ -129,7 +129,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
- Kartenwerkzeuge + Kartenwerkzeuge
@@ -138,8 +138,8 @@ or see http://www.gnu.org/licenses/agpl.txt. Unbenannte Straßen hervorheben
diff --git a/WebContent/main.js b/WebContent/main.js index 1dc16984d..a93203567 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -18,9 +18,6 @@ or see http://www.gnu.org/licenses/agpl.txt. // OSRM initialization // [initialization, image prefetching] -// will hold the Leaflet map object -OSRM.GLOBALS.map = null; - // onload initialization routine OSRM.init = function() { @@ -152,7 +149,7 @@ OSRM.checkURL = function(){ if( destination_name == null ) OSRM.Geocoder.updateAddress( OSRM.C.TARGET_LABEL, OSRM.C.DO_FALLBACK_TO_LAT_LNG ); else - document.getElementById("input-target-name").value = destination_name; + document.getElementById("gui-input-target").value = destination_name; OSRM.G.markers.route[index].show(); OSRM.G.markers.route[index].centerView(); return; @@ -185,4 +182,11 @@ OSRM.checkURL = function(){ // compute route OSRM.Routing.getRoute(); } -}; \ No newline at end of file +}; + + +// onload event +if(document.addEventListener) // FF, CH + document.addEventListener("DOMContentLoaded", OSRM.init, false); +else // old IE + document.onreadystatechange = function(){if(document.readyState == "interactive" || document.readyState == "complete") OSRM.init();}; diff --git a/WebContent/routing/OSRM.RoutingGUI.js b/WebContent/routing/OSRM.RoutingGUI.js index cd47d1e35..a7fa509cb 100644 --- a/WebContent/routing/OSRM.RoutingGUI.js +++ b/WebContent/routing/OSRM.RoutingGUI.js @@ -23,8 +23,8 @@ OSRM.RoutingGUI = { // click: button "reset" resetRouting: function() { - document.getElementById('input-source-name').value = ""; - document.getElementById('input-target-name').value = ""; + document.getElementById('gui-input-source').value = ""; + document.getElementById('gui-input-target').value = ""; OSRM.G.route.hideAll(); OSRM.G.markers.removeAll(); @@ -39,9 +39,9 @@ resetRouting: function() { // click: button "reverse" reverseRouting: function() { // invert input boxes - var tmp = document.getElementById("input-source-name").value; - document.getElementById("input-source-name").value = document.getElementById("input-target-name").value; - document.getElementById("input-target-name").value = tmp; + var tmp = document.getElementById("gui-input-source").value; + document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value; + document.getElementById("gui-input-target").value = tmp; // invert route OSRM.G.markers.route.reverse(); @@ -86,9 +86,9 @@ showMarker: function(marker_id) { // changed: any inputbox (is called when return is pressed [after] or focus is lost [before]) inputChanged: function(marker_id) { if( marker_id == OSRM.C.SOURCE_LABEL) - OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('input-source-name').value); + OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value); else if( marker_id == OSRM.C.TARGET_LABEL) - OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('input-target-name').value); + OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('gui-input-target').value); }, // click: button "open JOSM"