]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index.js
Merge branch 'master' into redesign
[rails.git] / app / assets / javascripts / index.js
index d612b27780109c50bcbbd5de8a7ccc95e993b4f5..f1644c06f0a12a131d0e7d0b7d30a63d29c8d033 100644 (file)
@@ -203,6 +203,11 @@ $(document).ready(function () {
       map.invalidateSize({pan: false})
         .panBy([-300, 0], {animate: false});
       OSM.loadSidebarContent(path);
+      page.load();
+    };
+
+    page.load = function() {
+      return map.getState();
     };
 
     page.popstate = function(path) {
@@ -230,19 +235,7 @@ $(document).ready(function () {
     };
 
     page.load = function(path, type, id) {
-      if (OSM.STATUS === 'api_offline' || OSM.STATUS === 'database_offline') return;
-
-      map.addObject({type: type, id: parseInt(id)},
-        {
-          zoom: window.location.hash == "",
-          style: {
-            color: "#FF6200",
-            weight: 4,
-            opacity: 1,
-            fillOpacity: 0.5
-          }
-        }
-      );
+      map.addObject({type: type, id: parseInt(id)});
     };
 
     page.unload = function() {
@@ -268,6 +261,8 @@ $(document).ready(function () {
     "/browse/:type/:id(/history)": OSM.Browse(map)
   });
 
+  OSM.route.load();
+
   $(document).on("click", "a", function(e) {
     if (e.isDefaultPrevented() || e.isPropagationStopped()) return;
     if (this.host === window.location.host && OSM.route(this.pathname + this.search + this.hash)) e.preventDefault();