testing to remove route button -> search will be automatical on lost

focus
This commit is contained in:
DennisSchiefer 2012-03-15 17:45:22 +01:00
parent 441146eeae
commit 879d73c629
4 changed files with 17 additions and 7 deletions

View File

@ -82,8 +82,8 @@ OSRM.Localization["en"] = {
//gui //gui
"GUI_START": "Start", "GUI_START": "Start",
"GUI_END": "End", "GUI_END": "End",
"GUI_RESET": "Reset", "GUI_RESET": "  Reset  ",
"GUI_SEARCH": "Search", "GUI_SEARCH": " Search ",
"GUI_ROUTE": "Route", "GUI_ROUTE": "Route",
"GUI_REVERSE": "Reverse", "GUI_REVERSE": "Reverse",
"GUI_OPTIONS": "Options", "GUI_OPTIONS": "Options",

View File

@ -37,6 +37,11 @@ function updateLocation(marker_id) {
// process input request and call geocoder if needed // process input request and call geocoder if needed
function callGeocoder(marker_id, query) { function callGeocoder(marker_id, query) {
if (marker_id == OSRM.SOURCE_MARKER_LABEL && my_markers.route[0] && my_markers.route[0].label == OSRM.SOURCE_MARKER_LABEL && my_markers.route[0].dirty == false)
return;
if (marker_id == OSRM.TARGET_MARKER_LABEL && my_markers.route[my_markers.route.length-1] && my_markers.route[my_markers.route.length-1].label == OSRM.TARGET_MARKER_LABEL && my_markers.route[my_markers.route.length-1].dirty == false)
return;
//geo coordinates given -> go directly to drawing results //geo coordinates given -> go directly to drawing results
if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){ if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){
var coord = query.split(/[,;]/); var coord = query.split(/[,;]/);

View File

@ -88,16 +88,18 @@ or see http://www.gnu.org/licenses/agpl.txt.
<table class="full"> <table class="full">
<tr> <tr>
<td id="gui-search-source-label">Start:</td> <td id="gui-search-source-label">Start:</td>
<td><input id="input-source-name" class="input-box" type="text" maxlength="200" value="" title="Startposition eingeben" onkeypress="if(event.keyCode==13) {callGeocoder(OSRM.SOURCE_MARKER_LABEL, document.getElementById('input-source-name').value);}" /></td> <td><input id="input-source-name" class="input-box" type="text" maxlength="200" value="" title="Startposition eingeben" onchange="if( my_markers.route[0] && my_markers.route[0].label == OSRM.SOURCE_MARKER_LABEL) my_markers.route[0].dirty = true;" onblur="callGeocoder(OSRM.SOURCE_MARKER_LABEL, document.getElementById('input-source-name').value);" onkeypress="if(event.keyCode==13) {callGeocoder(OSRM.SOURCE_MARKER_LABEL, document.getElementById('input-source-name').value);}" /></td>
<!-- <td class="right"><a class="button not-selectable" id="gui-here-target" onclick="">i</a></td> --> <!-- <td class="right"><a class="button not-selectable" id="gui-here-target" onclick="">i</a></td> -->
<td class="right"><a class="button not-selectable" id="gui-search-source" onclick="callGeocoder(OSRM.SOURCE_MARKER_LABEL, document.getElementById('input-source-name').value);">Suchen</a></td> <!-- <td class="right"><a class="button not-selectable" id="gui-search-source" onclick="callGeocoder(OSRM.SOURCE_MARKER_LABEL, document.getElementById('input-source-name').value);">Suchen</a></td> -->
<td class="right"><a class="button not-selectable" id="gui-search-source" onclick="">Suchen</a></td>
</tr> </tr>
<tr> <tr>
<td id="gui-search-target-label">Ende:</td> <td id="gui-search-target-label">Ende:</td>
<td><input id="input-target-name" class="input-box" type="text" maxlength="200" value="" title="Zielposition eingeben" onkeypress="if(event.keyCode==13) {callGeocoder(OSRM.TARGET_MARKER_LABEL, document.getElementById('input-target-name').value);}" /></td> <td><input id="input-target-name" class="input-box" type="text" maxlength="200" value="" title="Zielposition eingeben" onchange="if( my_markers.route[my_markers.route.length-1] && my_markers.route[my_markers.route.length-1].label == OSRM.TARGET_MARKER_LABEL) my_markers.route[my_markers.route.length-1].dirty = true;" onblur="callGeocoder(OSRM.TARGET_MARKER_LABEL, document.getElementById('input-target-name').value);" onkeypress="if(event.keyCode==13) {callGeocoder(OSRM.TARGET_MARKER_LABEL, document.getElementById('input-target-name').value);}" /></td>
<!-- <td class="right"><a class="button not-selectable" id="gui-here-target" onclick="">i</a></td> --> <!-- <td class="right"><a class="button not-selectable" id="gui-here-target" onclick="">i</a></td> -->
<td class="right"><a class="button not-selectable" id="gui-search-target" onclick="callGeocoder(OSRM.TARGET_MARKER_LABEL, document.getElementById('input-target-name').value);">Suchen</a></td> <!-- <td class="right"><a class="button not-selectable" id="gui-search-target" onclick="callGeocoder(OSRM.TARGET_MARKER_LABEL, document.getElementById('input-target-name').value);">Suchen</a></td> -->
<td class="right"><a class="button not-selectable" id="gui-search-target" onclick="">Suchen</a></td>
</tr> </tr>
</table> </table>
@ -106,8 +108,11 @@ or see http://www.gnu.org/licenses/agpl.txt.
<table style="width:100%"> <table style="width:100%">
<tr> <tr>
<td> <a class="button not-selectable" id="gui-reset" onclick="resetRouting();">Reset</a></td> <td> <a class="button not-selectable" id="gui-reset" onclick="resetRouting();">Reset</a></td>
<!--
<td class="center"> <a class="button not-selectable" id="gui-reverse" onclick="reverseRouting();">Reverse</a></td> <td class="center"> <a class="button not-selectable" id="gui-reverse" onclick="reverseRouting();">Reverse</a></td>
<td class="right"> <a class="button not-selectable" id="gui-route" onclick="startRouting();">Route</a></td> <td class="right"> <a class="button not-selectable" id="gui-route" onclick="startRouting();">Route</a></td>
-->
<td class="right"> <a class="button not-selectable" id="gui-reverse" onclick="reverseRouting();">Reverse</a></td>
</tr> </tr>
</table> </table>

View File

@ -67,7 +67,7 @@ function prefetchIcons() {
// init localization // init localization
function initLocale() { function initLocale() {
document.getElementById("gui-route").innerHTML = OSRM.loc("GUI_ROUTE"); // document.getElementById("gui-route").innerHTML = OSRM.loc("GUI_ROUTE");
document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET"); document.getElementById("gui-reset").innerHTML = OSRM.loc("GUI_RESET");
document.getElementById("gui-reverse").innerHTML = OSRM.loc("GUI_REVERSE"); 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-highlight-nonames-label").innerHTML = OSRM.loc("GUI_HIGHLIGHT_UNNAMED_ROADS");