X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/1add511c52e21492d3dd08b5a86e1f04e73791eb..7bf86b7c4eb7c11beb114eb9a7b398ff4d48d495:/app/assets/javascripts/index/directions/osrm.js diff --git a/app/assets/javascripts/index/directions/osrm.js b/app/assets/javascripts/index/directions/osrm.js index cc2756858..842909eab 100644 --- a/app/assets/javascripts/index/directions/osrm.js +++ b/app/assets/javascripts/index/directions/osrm.js @@ -31,7 +31,7 @@ function OSRMEngine() { I18n.t('javascripts.directions.instructions.end_oneway') // 17 ]; - var url = "http://router.project-osrm.org/viaroute?z=14&output=json&instructions=true"; + var url = document.location.protocol + "//router.project-osrm.org/viaroute?z=14&output=json&instructions=true"; for (var i = 0; i < points.length; i++) { url += "&loc=" + points[i].lat + ',' + points[i].lng; @@ -48,7 +48,7 @@ function OSRMEngine() { url: url, dataType: 'json', success: function (data) { - if (data.status == 207) + if (data.status === 207) return callback(true); previousPoints = points; @@ -68,7 +68,7 @@ function OSRMEngine() { if (instCodes[1]) { instText += "exit " + instCodes[1] + " "; } - if (instCodes[0] != 15) { + if (instCodes[0] !== 15) { instText += s[1] ? "" + s[1] + "" : I18n.t('javascripts.directions.instructions.unnamed'); } if ((i + 1) < data.route_instructions.length) { @@ -91,4 +91,4 @@ function OSRMEngine() { }; } -OSM.Directions.addEngine(OSRMEngine(), true); +OSM.Directions.addEngine(new OSRMEngine(), true);