diff --git a/404.html b/404.html index 0355506..67967e8 100644 --- a/404.html +++ b/404.html @@ -26,23 +26,11 @@ var l = window.location; l.replace( - l.protocol + - "//" + - l.hostname + - (l.port ? ":" + l.port : "") + - l.pathname - .split("/") - .slice(0, 1 + pathSegmentsToKeep) - .join("/") + - "/?/" + - l.pathname - .slice(1) - .split("/") - .slice(pathSegmentsToKeep) - .join("/") - .replace(/&/g, "~and~") + - (l.search ? "&" + l.search.slice(1).replace(/&/g, "~and~") : "") + - l.hash, + l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + + l.hash ); diff --git a/index.html b/index.html index 5126f80..336406d 100644 --- a/index.html +++ b/index.html @@ -25,24 +25,17 @@ // When the single page app is loaded further down in this file, // the correct url will be waiting in the browser's history for // the single page app to route accordingly. - (function (l) { - if (l.search[1] === "/") { - var decoded = l.search - .slice(1) - .split("&") - .map(function (s) { - return s.replace(/~and~/g, "&"); - }) - .join("?"); - window.history.replaceState( - null, - null, - l.pathname.slice(0, -1) + decoded + l.hash, + (function(l) { + if (l.search[1] === '/' ) { + var decoded = l.search.slice(1).split('&').map(function(s) { + return s.replace(/~and~/g, '&') + }).join('?'); + window.history.replaceState(null, null, + l.pathname.slice(0, -1) + decoded + l.hash ); } - })(window.location); + }(window.location)) -