]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/router.js
Convert search to pushState
[rails.git] / app / assets / javascripts / router.js
index 7b2e9954622d40255298a839c177354ea1fb2578..654ec860b549b2483d2a8fea51a46edc9bc5eec7 100644 (file)
@@ -11,7 +11,7 @@ OSM.Router = function(rts) {
         .replace(namedParam, function(match, optional){
           return optional ? match : '([^\/]+)';
         })
-        .replace(splatParam, '(.*?)') + '(?:$|[?#])');
+        .replace(splatParam, '(.*?)') + '(?:\\?.*)?$');
 
     var route = {};
 
@@ -44,14 +44,14 @@ OSM.Router = function(rts) {
     }
   };
 
-  var currentPath = window.location.pathname,
+  var currentPath = window.location.pathname + window.location.search,
     currentRoute = routes.recognize(currentPath);
 
   currentRoute.run('load', currentPath);
 
   if (window.history && window.history.pushState) {
     $(window).on('popstate', function() {
-      var path = window.location.pathname;
+      var path = window.location.pathname + window.location.search;
       if (path === currentPath) return;
       currentRoute.run('unload');
       currentPath = path;