2 OSM.Element = function (map, type) {
5 page.pushstate = page.popstate = function (path, id, version) {
6 OSM.loadSidebarContent(path, function () {
7 page._addObject(type, id, version);
11 page.load = function (path, id, version) {
12 page._addObject(type, id, version, true);
15 page.unload = function () {
19 page._addObject = function () {};
20 page._removeObject = function () {};
25 OSM.MappedElement = function (map, type) {
26 const page = OSM.Element(map, type);
28 page._addObject = function (type, id, version, center) {
29 const hashParams = OSM.parseHash();
30 map.addObject({ type: type, id: parseInt(id, 10), version: version && parseInt(version, 10) }, function (bounds) {
31 if (!hashParams.center && bounds.isValid() &&
32 (center || !map.getBounds().contains(bounds))) {
33 OSM.router.withoutMoveListener(function () {
34 map.fitBounds(bounds);
40 page._removeObject = function () {