]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/5278'
authorTom Hughes <tom@compton.nu>
Sun, 16 Feb 2025 13:11:45 +0000 (13:11 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 16 Feb 2025 13:11:45 +0000 (13:11 +0000)
1  2 
app/assets/javascripts/index.js

index 194ed82f7451098bd318d63a661a2b35221087c0,2d943b44d641d34528f13d54144e2a42210c6bd9..4903703cd39d4635d1afdef7bbd8370091cea4ad
@@@ -295,22 -325,21 +295,22 @@@ $(document).ready(function () 
    };
  
    OSM.Browse = function (map, type) {
 -    var page = {};
 +    const page = {};
  
-     page.pushstate = page.popstate = function (path, id) {
+     page.pushstate = page.popstate = function (path, id, version) {
        OSM.loadSidebarContent(path, function () {
-         addObject(type, id);
+         addObject(type, id, version);
        });
      };
  
-     page.load = function (path, id) {
-       addObject(type, id, true);
+     page.load = function (path, id, version) {
+       addObject(type, id, version, true);
      };
  
-     function addObject(type, id, center) {
+     function addObject(type, id, version, center) {
 +      const hashParams = OSM.parseHash(window.location.hash);
-       map.addObject({ type: type, id: parseInt(id, 10) }, function (bounds) {
+       map.addObject({ type: type, id: parseInt(id, 10), version: version && parseInt(version, 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);