};
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);