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 45c4cd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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
2 changes: 1 addition & 1 deletion test/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ R"EXPECTEDRESULT( src="/ROOT/skin/jquery-ui/external/jquery/jquery.js?cache
src: url("/ROOT/skin/fonts/Roboto.ttf?cacheid=84d10248") format("truetype");
<script src="/ROOT/skin/isotope.pkgd.min.js?cacheid=2e48d392" defer></script>
<script src="/ROOT/skin/iso6391To3.js?cacheid=ecde2bb3"></script>
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=0d938055" defer></script>
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=9e54956e" defer></script>
)EXPECTEDRESULT"
},
{
Expand Down

0 comments on commit 45c4cd6

Please sign in to comment.