]> git.openstreetmap.org Git - rails.git/commitdiff
Display old node versions on map view
authorAnton Khorev <tony29@yandex.ru>
Mon, 21 Oct 2024 23:08:43 +0000 (02:08 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sun, 27 Oct 2024 23:39:59 +0000 (02:39 +0300)
app/assets/javascripts/index.js

index 4f3c414f5b85b207b399f4ed874bee7649e1ea92..2d943b44d641d34528f13d54144e2a42210c6bd9 100644 (file)
@@ -327,18 +327,18 @@ $(document).ready(function () {
   OSM.Browse = function (map, type) {
     var 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) {
-      map.addObject({ type: type, id: parseInt(id, 10) }, function (bounds) {
+    function addObject(type, id, version, center) {
+      map.addObject({ type: type, id: parseInt(id, 10), version: version && parseInt(version, 10) }, function (bounds) {
         if (!window.location.hash && bounds.isValid() &&
             (center || !map.getBounds().contains(bounds))) {
           OSM.router.withoutMoveListener(function () {
@@ -379,7 +379,7 @@ $(document).ready(function () {
     "/user/:display_name/history": history,
     "/note/:id": OSM.Note(map),
     "/node/:id(/history)": OSM.Browse(map, "node"),
-    "/node/:id/history/:version": OSM.OldBrowse(),
+    "/node/:id/history/:version": OSM.Browse(map, "node"),
     "/way/:id(/history)": OSM.Browse(map, "way"),
     "/way/:id/history/:version": OSM.OldBrowse(),
     "/relation/:id(/history)": OSM.Browse(map, "relation"),