]> 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 e83b4994766726d0c3557906facb887728e6a8f5..f1644c06f0a12a131d0e7d0b7d30a63d29c8d033 100644 (file)
@@ -37,6 +37,7 @@
 
     $.ajax({
       url: path,
+      dataType: "html",
       complete: function(xhr) {
         clearTimeout(loaderTimeout);
         $('#sidebar_loader').hide();
@@ -202,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) {
@@ -229,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() {
@@ -267,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();