From 393334cabda49d20b39c7274675410dfce3a5896 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Thu, 12 Apr 2012 22:44:30 +0200 Subject: [PATCH] corrected error in route description, made dropdown button more beautiful --- WebContent/images/selector.png | Bin 0 -> 446 bytes WebContent/localization/OSRM.Localization.js | 23 +++++++++- WebContent/main.css | 15 ++++++ WebContent/routing/OSRM.RoutingDescription.js | 43 ++++++++++++++++-- 4 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 WebContent/images/selector.png diff --git a/WebContent/images/selector.png b/WebContent/images/selector.png new file mode 100644 index 0000000000000000000000000000000000000000..9082cb8def0c4d2068d9fabcd5eadabc67b233a8 GIT binary patch literal 446 zcmV;v0YUzWP)WdKBPATcr^L2z;)GB7bRATlvJGC4XiG$1Q5F)%QLToQx;000McNliru z+yo312_I3L(wqPQ010qNS#tmY3h)2`3h)6!tTdPa000DMK}|sb0I`n?{9y$E009 1) diff --git a/WebContent/main.css b/WebContent/main.css index 02f695a1c..ffdefe771 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -130,7 +130,22 @@ html, body { { border: 0px; text-decoration:none; + position: relative; + opacity: 0; + filter: alpha(opacity=0); + z-index: 5; } + +.styled-select +{ + position:absolute; + background: url("images/selector.png"); + background-repeat:no-repeat; + background-position: top right; + padding: 1px 1px 1px 1px; + overflow: hidden; +} + .top-left-button { float:left; diff --git a/WebContent/routing/OSRM.RoutingDescription.js b/WebContent/routing/OSRM.RoutingDescription.js index 0ec55e785..55800566d 100644 --- a/WebContent/routing/OSRM.RoutingDescription.js +++ b/WebContent/routing/OSRM.RoutingDescription.js @@ -74,11 +74,11 @@ show: function(response) { // build route description if( i == 0 ) - route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/%s/, OSRM.loc(response.route_instructions[i][6]) ); + route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/%s/, OSRM.loc(response.route_instructions[i][6]) ); else if( response.route_instructions[i][1] != "" ) - route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]); + route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]); else - route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,""); + route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,""); route_desc += ''; route_desc += ""; @@ -147,8 +147,41 @@ showNA: function( display_text ) { document.getElementById('information-box').innerHTML = "
"+display_text+"
"; }, -//map driving instruction ids to internal ids -mapDirectionId: function(name) { +// map driving instructions to icons +// [TODO: language-safe implementation] +getDirectionIcon: function(name) { + var directions = { + "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"; +}, + +//map driving instructions to ids +getDirectionId: function(name) { var directions = { "Turn left":1, "Turn right":2,