make query strings work with pagejs
This commit is contained in:
@@ -81,7 +81,7 @@
|
|||||||
if (urlQueryString.has('lang')) {
|
if (urlQueryString.has('lang')) {
|
||||||
urlQueryString.delete('lang');
|
urlQueryString.delete('lang');
|
||||||
var newUrl = [location.protocol, '//', location.host, location.pathname].join('') +
|
var newUrl = [location.protocol, '//', location.host, location.pathname].join('') +
|
||||||
urlQueryString.toString() +
|
(urlQueryString.toString() !== '' ? '?' + urlQueryString.toString() : '') +
|
||||||
window.location.hash;
|
window.location.hash;
|
||||||
window.location = newUrl;
|
window.location = newUrl;
|
||||||
return;
|
return;
|
||||||
|
5
node_modules/page/page.js
generated
vendored
5
node_modules/page/page.js
generated
vendored
@@ -1126,8 +1126,11 @@ pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
|
|||||||
Context.prototype.save = function() {
|
Context.prototype.save = function() {
|
||||||
var page = this.page;
|
var page = this.page;
|
||||||
if (hasHistory) {
|
if (hasHistory) {
|
||||||
|
var pathWithoutQuerystring = this.path.replace('?' + this.querystring, '');
|
||||||
|
pathWithoutQuerystring = pathWithoutQuerystring === '' ? '/' : pathWithoutQuerystring;
|
||||||
|
|
||||||
page._window.history.replaceState(this.state, this.title,
|
page._window.history.replaceState(this.state, this.title,
|
||||||
page._hashbang && this.path !== '/' ? '#!' + this.path : this.canonicalPath);
|
page._hashbang && pathWithoutQuerystring !== '/' || this.querystring !== '' ? page._window.location.pathname + '#!' + this.path : this.canonicalPath);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user