X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8f7f02b025f59db466fdb22ea3686cb6c5adc400..46cd3a1114d975a1791c16e5930c9ed7f8367d36:/app/assets/javascripts/index/contextmenu.js diff --git a/app/assets/javascripts/index/contextmenu.js b/app/assets/javascripts/index/contextmenu.js index 51ec87723..dd4f41493 100644 --- a/app/assets/javascripts/index/contextmenu.js +++ b/app/assets/javascripts/index/contextmenu.js @@ -1,12 +1,10 @@ -//= require qs/dist/qs - OSM.initializeContextMenu = function (map) { map.contextmenu.addItem({ text: I18n.t("javascripts.context.directions_from"), callback: function directionsFromHere(e) { const latlng = OSM.cropLocation(e.latlng, map.getZoom()); - OSM.router.route("/directions?" + Qs.stringify({ + OSM.router.route("/directions?" + new URLSearchParams({ from: latlng.join(","), to: getDirectionsEndpointCoordinatesFromInput($("#route_to")) })); @@ -18,7 +16,7 @@ OSM.initializeContextMenu = function (map) { callback: function directionsToHere(e) { const latlng = OSM.cropLocation(e.latlng, map.getZoom()); - OSM.router.route("/directions?" + Qs.stringify({ + OSM.router.route("/directions?" + new URLSearchParams({ from: getDirectionsEndpointCoordinatesFromInput($("#route_from")), to: latlng.join(",") })); @@ -30,7 +28,7 @@ OSM.initializeContextMenu = function (map) { callback: function addNoteHere(e) { const [lat, lon] = OSM.cropLocation(e.latlng, map.getZoom()); - OSM.router.route("/note/new?" + Qs.stringify({ lat, lon })); + OSM.router.route("/note/new?" + new URLSearchParams({ lat, lon })); } }); @@ -39,7 +37,7 @@ OSM.initializeContextMenu = function (map) { callback: function describeLocation(e) { const [lat, lon] = OSM.cropLocation(e.latlng, map.getZoom()).map(encodeURIComponent); - OSM.router.route("/search?" + Qs.stringify({ lat, lon })); + OSM.router.route("/search?" + new URLSearchParams({ lat, lon })); } }); @@ -48,7 +46,7 @@ OSM.initializeContextMenu = function (map) { callback: function queryFeatures(e) { const [lat, lon] = OSM.cropLocation(e.latlng, map.getZoom()); - OSM.router.route("/query?" + Qs.stringify({ lat, lon })); + OSM.router.route("/query?" + new URLSearchParams({ lat, lon })); } });