diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-19 19:25:10 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-19 19:25:10 -0400 |
commit | d4d378bff3a8079e6d665b8c99d9a80937f588cd (patch) | |
tree | bb88cea5dcc5095dffa71d9c9969bb3a9578c63f /src/SMAPI.Web/wwwroot/Content/js | |
parent | 5c819662f88cd7004a85ac0d0e30a79b5dc4be37 (diff) | |
download | SMAPI-d4d378bff3a8079e6d665b8c99d9a80937f588cd.tar.gz SMAPI-d4d378bff3a8079e6d665b8c99d9a80937f588cd.tar.bz2 SMAPI-d4d378bff3a8079e6d665b8c99d9a80937f588cd.zip |
don't add default pagination values to log URL
Diffstat (limited to 'src/SMAPI.Web/wwwroot/Content/js')
-rw-r--r-- | src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index 8886715e..3fb5fd6c 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -245,6 +245,7 @@ smapi.logParser = function (state) { state.localTimeStarted = ("0" + state.logStarted.getHours()).slice(-2) + ":" + ("0" + state.logStarted.getMinutes()).slice(-2); // add the properties we're passing to Vue + const defaultPerPage = 1000; state.totalMessages = state.messages.length; state.filterText = ""; state.filterRegex = null; @@ -254,7 +255,7 @@ smapi.logParser = function (state) { state.useRegex = false; state.useInsensitive = true; state.useWord = false; - state.perPage = 1000; + state.perPage = defaultPerPage; state.page = 1; state.defaultMods = { ...state.showMods }; @@ -682,7 +683,7 @@ smapi.logParser = function (state) { loadFromUrl: function () { const params = new URL(location).searchParams; - state.perPage = helpers.tryParseNumber(params.get("PerPage"), 1000, n => n > 0); + state.perPage = helpers.tryParseNumber(params.get("PerPage"), defaultPerPage, n => n > 0); this.page = helpers.tryParseNumber(params.get("Page"), 1, n => n > 0); state.filterText = params.get("Filter") || ""; @@ -741,8 +742,12 @@ smapi.logParser = function (state) { */ updateUrl: function () { const url = new URL(location); - url.searchParams.set("Page", state.page); - url.searchParams.set("PerPage", state.perPage); + + if (state.page != 1) + url.searchParams.set("Page", state.page); + + if (state.perPage != defaultPerPage) + url.searchParams.set("PerPage", state.perPage); if (!helpers.shallowEquals(this.showMods, state.defaultMods)) url.searchParams.set("Mods", Object.entries(this.showMods).filter(p => p[1]).map(p => p[0]).join("~")); |