]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index.js
Force the X-Page-Title value to be treated as UTF-8
[rails.git] / app / assets / javascripts / index.js
index 3ce1a02da3d0a2ada5f01f9d9f79df19e18fea2e..1cbd97f86351e442f210d320e41167c5f42b1969 100644 (file)
@@ -46,7 +46,8 @@
         var content = $(xhr.responseText);
 
         if (xhr.getResponseHeader('X-Page-Title')) {
-          document.title = xhr.getResponseHeader('X-Page-Title');
+          var title = xhr.getResponseHeader('X-Page-Title');
+          document.title = decodeURIComponent(escape(title));
         }
 
         $('head')
@@ -235,16 +236,16 @@ $(document).ready(function () {
     return page;
   };
 
-  OSM.Browse = function(map) {
+  OSM.Browse = function(map, type) {
     var page = {};
 
-    page.pushstate = page.popstate = function(path, type, id) {
+    page.pushstate = page.popstate = function(path, id) {
       OSM.loadSidebarContent(path, function() {
-        page.load(path, type, id);
+        page.load(path, id);
       });
     };
 
-    page.load = function(path, type, id) {
+    page.load = function(path, id) {
       map.addObject({type: type, id: parseInt(id)});
     };
 
@@ -266,8 +267,11 @@ $(document).ready(function () {
     "/history/nearby":             history,
     "/history":                    history,
     "/user/:display_name/history": history,
-    "/note/:id":                  OSM.Note(map),
-    "/:type/:id(/history)":       OSM.Browse(map)
+    "/note/:id":                   OSM.Note(map),
+    "/node/:id(/history)":         OSM.Browse(map, 'node'),
+    "/way/:id(/history)":          OSM.Browse(map, 'way'),
+    "/relation/:id(/history)":     OSM.Browse(map, 'relation'),
+    "/changeset/:id":              OSM.Browse(map, 'changeset')
   });
 
   OSM.router.load();