2 OSM.Element = function () {
5 page.pushstate = page.popstate = function (path) {
6 OSM.loadSidebarContent(path);
12 OSM.MappedElement = function (map, type) {
15 page.pushstate = page.popstate = function (path, id, version) {
16 OSM.loadSidebarContent(path, function () {
17 addObject(type, id, version);
21 page.load = function (path, id, version) {
22 addObject(type, id, version, true);
25 function addObject(type, id, version, center) {
26 const hashParams = OSM.parseHash();
27 map.addObject({ type: type, id: parseInt(id, 10), version: version && parseInt(version, 10) }, function (bounds) {
28 if (!hashParams.center && bounds.isValid() &&
29 (center || !map.getBounds().contains(bounds))) {
30 OSM.router.withoutMoveListener(function () {
31 map.fitBounds(bounds);
37 page.unload = function () {