]> git.openstreetmap.org Git - rails.git/commitdiff
Don't show http-only routers to users on https
authorRichard Fairhurst <richard@systemeD.net>
Mon, 10 Mar 2014 18:02:28 +0000 (18:02 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Mon, 10 Mar 2014 18:02:28 +0000 (18:02 +0000)
app/assets/javascripts/routing.js.erb
app/assets/javascripts/routing_engines/graphhopper.js
app/assets/javascripts/routing_engines/mapquest.js
app/assets/javascripts/routing_engines/osrm.js

index 42e4ba2bc57222d66a2279c47b2aee40149b0fb4..84bf178328954205c4ade68ca92f68eb4da71a10 100644 (file)
@@ -18,7 +18,10 @@ var ROUTING_POLYLINE_HIGHLIGHT={
 
 
 OSM.RoutingEngines={
 
 
 OSM.RoutingEngines={
-    list: []
+    list: [],
+    add: function(supportsHTTPS,engine) {
+        if (document.location.protocol=="http:" || supportsHTTPS) this.list.push(engine);
+    }
 };
 
 OSM.Routing=function(map,name,jqSearch) {
 };
 
 OSM.Routing=function(map,name,jqSearch) {
index 5e14ea0dfc8f2e3040d2b1fed672844d305f14a6..6d83e26e2839b721454cd9722caf2352556105af 100644 (file)
@@ -59,5 +59,5 @@ GraphHopperEngine.prototype.createConfig = function() {
     };
 };
 
     };
 };
 
-OSM.RoutingEngines.list.push(new GraphHopperEngine("Bicycle", "vehicle=bike").createConfig());
-OSM.RoutingEngines.list.push(new GraphHopperEngine("Foot", "vehicle=foot").createConfig());
+OSM.RoutingEngines.add(false, new GraphHopperEngine("Bicycle", "vehicle=bike").createConfig());
+OSM.RoutingEngines.add(false, new GraphHopperEngine("Foot", "vehicle=foot").createConfig());
index fd17e59428857262b0f4e9dd4647c1f236aa4b85..dc854ccdc9dffd38ccbfc5b88888e110f01adb12 100644 (file)
@@ -40,7 +40,7 @@ MapQuestEngine.prototype.createConfig = function() {
             18: 1  // straight fork
         },
         getRoute: function(isFinal,points) {
             18: 1  // straight fork
         },
         getRoute: function(isFinal,points) {
-            var url="http://open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluur290anu%2Crl%3Do5-908a0y";
+            var url=document.location.protocol+"//open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluur290anu%2Crl%3Do5-908a0y";
             var from=points[0]; var to=points[points.length-1];
             url+="&from="+from.join(',');
             url+="&to="+to.join(',');
             var from=points[0]; var to=points[points.length-1];
             url+="&from="+from.join(',');
             url+="&to="+to.join(',');
@@ -88,7 +88,7 @@ MapQuestEngine.prototype.createConfig = function() {
     };
 };
 
     };
 };
 
-OSM.RoutingEngines.list.push(new MapQuestEngine("Bicycle", "routeType=bicycle").createConfig());
-OSM.RoutingEngines.list.push(new MapQuestEngine("Foot", "routeType=pedestrian").createConfig());
-OSM.RoutingEngines.list.push(new MapQuestEngine("Car", "routeType=fastest").createConfig());
+OSM.RoutingEngines.add(true, new MapQuestEngine("Bicycle", "routeType=bicycle").createConfig());
+OSM.RoutingEngines.add(true, new MapQuestEngine("Foot", "routeType=pedestrian").createConfig());
+OSM.RoutingEngines.add(true, new MapQuestEngine("Car", "routeType=fastest").createConfig());
 // can be: routeType=fastest|shortest|pedestrian|multimodal|bicycle
 // can be: routeType=fastest|shortest|pedestrian|multimodal|bicycle
index 5808fb7ee8dc633e096fd320387a8ef984b5eb68..660a306ea093e6d17bbb6a248acc9d4848d23075 100644 (file)
@@ -57,4 +57,4 @@ OSRMEngine.prototype.createConfig = function() {
     };
 };
 
     };
 };
 
-OSM.RoutingEngines.list.push(new OSRMEngine("Car", "http://router.project-osrm.org/viaroute").createConfig());
+OSM.RoutingEngines.add(false, new OSRMEngine("Car", "http://router.project-osrm.org/viaroute").createConfig());