make query strings work with pagejs

This commit is contained in:
s2
2020-01-03 21:51:13 +01:00
parent 45810382b9
commit 0ca3ee9c07
2 changed files with 7 additions and 4 deletions

View File

@@ -81,7 +81,7 @@
if (urlQueryString.has('lang')) {
urlQueryString.delete('lang');
var newUrl = [location.protocol, '//', location.host, location.pathname].join('') +
urlQueryString.toString() +
(urlQueryString.toString() !== '' ? '?' + urlQueryString.toString() : '') +
window.location.hash;
window.location = newUrl;
return;

9
node_modules/page/page.js generated vendored
View File

@@ -1126,8 +1126,11 @@ pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
Context.prototype.save = function() {
var page = this.page;
if (hasHistory) {
page._window.history.replaceState(this.state, this.title,
page._hashbang && this.path !== '/' ? '#!' + this.path : this.canonicalPath);
var pathWithoutQuerystring = this.path.replace('?' + this.querystring, '');
pathWithoutQuerystring = pathWithoutQuerystring === '' ? '/' : pathWithoutQuerystring;
page._window.history.replaceState(this.state, this.title,
page._hashbang && pathWithoutQuerystring !== '/' || this.querystring !== '' ? page._window.location.pathname + '#!' + this.path : this.canonicalPath);
}
};
@@ -1189,7 +1192,7 @@ pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
m = this.regexp.exec(decodeURIComponent(pathname));
if (!m) return false;
delete params[0]
for (var i = 1, len = m.length; i < len; ++i) {