]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/contextmenu.js
Merge remote-tracking branch 'upstream/pull/5614'
[rails.git] / app / assets / javascripts / index / contextmenu.js
index 51ec87723b0a18ecc871a0bdd5d5a8993c6a7562..fea7e73145415ecf36bca270b53f19feab5683f3 100644 (file)
@@ -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,16 +28,16 @@ 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 }));
     }
   });
 
   map.contextmenu.addItem({
     text: I18n.t("javascripts.context.show_address"),
     callback: function describeLocation(e) {
-      const [lat, lon] = OSM.cropLocation(e.latlng, map.getZoom()).map(encodeURIComponent);
+      const [lat, lon] = OSM.cropLocation(e.latlng, map.getZoom());
 
-      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 }));
     }
   });