Skip to content

Commit

Permalink
Use shortened URL in pushState
Browse files Browse the repository at this point in the history
Earlier we were using the full URL, now only query string is passed in pushState, much cleaner!
  • Loading branch information
juuz0 committed Jun 24, 2022
1 parent 7f409e3 commit dcd2a49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions static/skin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
params = new URLSearchParams(window.location.search);
if (filterType) {
params.set(filterType, filterValue);
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
window.history.pushState({}, null, `?${params.toString()}`);
setCookie(filterCookieName, params.toString());
}
updateFilterColors();
Expand Down Expand Up @@ -468,8 +468,8 @@
const tagElement = document.getElementsByClassName('tagFilterLabel')[0];
tagElement.addEventListener('click', () => removeTagElement(true));
if (filters) {
const currentLink = window.location.href;
const newLink = `${window.location.href.split('?')[0]}?${params.toString()}`;
const currentLink = window.location.search;
const newLink = `?${params.toString()}`;
if (currentLink != newLink) {
window.history.pushState({}, null, newLink);
}
Expand Down

0 comments on commit dcd2a49

Please sign in to comment.