Display old node versions on map view

This commit is contained in:
Anton Khorev 2024-10-22 02:08:43 +03:00
parent 50cfc0a95c
commit 0c237c11d2

View file

@ -327,18 +327,18 @@ $(document).ready(function () {
OSM.Browse = function (map, type) { OSM.Browse = function (map, type) {
var page = {}; var page = {};
page.pushstate = page.popstate = function (path, id) { page.pushstate = page.popstate = function (path, id, version) {
OSM.loadSidebarContent(path, function () { OSM.loadSidebarContent(path, function () {
addObject(type, id); addObject(type, id, version);
}); });
}; };
page.load = function (path, id) { page.load = function (path, id, version) {
addObject(type, id, true); addObject(type, id, version, true);
}; };
function addObject(type, id, center) { function addObject(type, id, version, center) {
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 (!window.location.hash && bounds.isValid() &&
(center || !map.getBounds().contains(bounds))) { (center || !map.getBounds().contains(bounds))) {
OSM.router.withoutMoveListener(function () { OSM.router.withoutMoveListener(function () {
@ -379,7 +379,7 @@ $(document).ready(function () {
"/user/:display_name/history": history, "/user/:display_name/history": history,
"/note/:id": OSM.Note(map), "/note/:id": OSM.Note(map),
"/node/:id(/history)": OSM.Browse(map, "node"), "/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)": OSM.Browse(map, "way"),
"/way/:id/history/:version": OSM.OldBrowse(), "/way/:id/history/:version": OSM.OldBrowse(),
"/relation/:id(/history)": OSM.Browse(map, "relation"), "/relation/:id(/history)": OSM.Browse(map, "relation"),