]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/edit/id.js.erb
Use search params without objectification
[rails.git] / app / assets / javascripts / edit / id.js.erb
index 49b776876ac1088a7e47cdf11b37ac309bb4f0f4..fd7b3bd7c61779871272ef16ca42de92eaa4be54 100644 (file)
@@ -8,8 +8,7 @@ $(function () {
     return;
   }
 
-  const hash = location.hash.substring(1);
-  const hashParams = hash ? OSM.params(hash) : {};
+  const hashParams = new URLSearchParams(location.hash.slice(1));
   const hashArgs = OSM.parseHash();
   const mapParams = OSM.mapParams();
   const params = new URLSearchParams();
@@ -28,7 +27,7 @@ $(function () {
 
   const passThroughKeys = ["background", "comment", "disable_features", "gpx", "hashtags", "locale", "maprules", "notes", "offset", "photo", "photo_dates", "photo_overlay", "photo_username", "presets", "source", "validationDisable", "validationWarning", "validationError", "walkthrough"];
   for (const key of passThroughKeys) {
-    if (hashParams[key]) params.set(key, hashParams[key]);
+    if (hashParams.has(key)) params.set(key, hashParams.get(key));
   }
 
   if (mapParams.layers.includes("N")) params.set("notes", "true");