From: Martin Raifer Date: Tue, 14 Jun 2022 18:41:10 +0000 (+0200) Subject: only parse hashParams if there is a hash X-Git-Tag: live~1696^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/66656e1d1d58e6073efd453007d7452920531b37 only parse hashParams if there is a hash 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=… --- 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 = {};