From 66656e1d1d58e6073efd453007d7452920531b37 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Tue, 14 Jun 2022 20:41:10 +0200 Subject: [PATCH] only parse hashParams if there is a hash MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Presumably this was an oversight in the original implementation, as `OSM.params` falls back to the page's `query` string if the function's parameter (here: the page's `hash`) is an empty string. This fixes some inconsistent behaviour of the website. In the example below, the first URL sets the `background` to `none` while in the second example it doesn't. * https://www.openstreetmap.org/edit.html?background=none * https://www.openstreetmap.org/edit.html?background=none#map=… --- app/assets/javascripts/edit/id.js.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/edit/id.js.erb b/app/assets/javascripts/edit/id.js.erb index 02299d215..6a68b6b2d 100644 --- a/app/assets/javascripts/edit/id.js.erb +++ b/app/assets/javascripts/edit/id.js.erb @@ -4,7 +4,8 @@ $(document).ready(function () { var id = $("#id-embed"); if (id.data("configured") === true) { - var hashParams = OSM.params(location.hash.substring(1)); + var hash = location.hash.substring(1); + var hashParams = hash ? OSM.params(hash) : {}; var mapParams = OSM.mapParams(); var params = {}; -- 2.43.2