X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5c019cd2eef41a4e75a2640f19f674431cf67733..b0348093f8877d2f59f153bf35e87ba411f4004b:/app/assets/javascripts/index.js?ds=inline diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 9b825caad..810327e3f 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -39,6 +39,14 @@ $(document).ready(function () { $("#sidebar_loader").show().addClass("delayed-fade-in"); + // Prevent caching the XHR response as a full-page URL + // https://github.com/openstreetmap/openstreetmap-website/issues/5663 + if (content_path.indexOf("?") >= 0) { + content_path += "&xhr=1"; + } else { + content_path += "?xhr=1"; + } + $("#sidebar_content") .empty(); @@ -300,8 +308,9 @@ $(document).ready(function () { }; function addObject(type, id, center) { + var hashParams = OSM.parseHash(window.location.hash); map.addObject({ type: type, id: parseInt(id, 10) }, function (bounds) { - if (!window.location.hash && bounds.isValid() && + if (!hashParams.center && bounds.isValid() && (center || !map.getBounds().contains(bounds))) { OSM.router.withoutMoveListener(function () { map.fitBounds(bounds);