X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5853f81ee88a8a85ab35a78ea0ba288e638a6564..873c1cb84e2fe475bc4ff566d71929fdcc35787d:/app/assets/javascripts/routing.js.erb?ds=sidebyside diff --git a/app/assets/javascripts/routing.js.erb b/app/assets/javascripts/routing.js.erb index 7bb27f72b..5ff0656c8 100644 --- a/app/assets/javascripts/routing.js.erb +++ b/app/assets/javascripts/routing.js.erb @@ -18,7 +18,10 @@ var ROUTING_POLYLINE_HIGHLIGHT={ OSM.RoutingEngines={ - list: [] + list: [], + add: function(supportsHTTPS,engine) { + if (document.location.protocol=="http:" || supportsHTTPS) this.list.push(engine); + } }; OSM.Routing=function(map,name,jqSearch) { @@ -206,18 +209,18 @@ OSM.Routing=function(map,name,jqSearch) { row.append(" "); row.append(""+step[2]); row.append(""+dist); - with ({ num: i, ll: step[0], lineseg: step[4] }) { - row.on('click',function(e) { r.clickTurn(num, ll); }); + with ({ instruction: step[2], ll: step[0], lineseg: step[4] }) { + row.on('click',function(e) { r.clickTurn(instruction, ll); }); row.hover(function(e){r.highlightSegment(lineseg);}, function(e){r.unhighlightSegment();}); }; $('#turnbyturn').append(row); cumulative+=step[3]; } - $('#sidebar_content').append('

' + r.chosenEngine.creditline + '

'); + $('#sidebar_content').append('

' + I18n.t('javascripts.directions.instructions.courtesy',{link: r.chosenEngine.creditline}) + '

'); }; - r.clickTurn=function(num,latlng) { - r.popup=L.popup().setLatLng(latlng).setContent("

"+(num+1)+"

").openOn(r.map); + r.clickTurn=function(instruction,latlng) { + r.popup=L.popup().setLatLng(latlng).setContent("

"+instruction+"

").openOn(r.map); }; r.highlightSegment=function(lineseg){ if (r.highlighted) map.removeLayer(r.highlighted); @@ -232,7 +235,9 @@ OSM.Routing=function(map,name,jqSearch) { else { return Math.round(m / 1000) + "km"; } }; r.formatTime=function(s) { - var d=new Date(s*1000); var h=d.getHours(); var m=d.getMinutes(); + var m=Math.round(s/60); + var h=Math.floor(m/60); + m -= h*60; return h+":"+(m<10 ? '0' : '')+m; };