mirror of https://github.com/kiwix/libkiwix.git
Use shortened URL in pushState
Earlier we were using the full URL, now only query string is passed in pushState, much cleaner!
This commit is contained in:
parent
947744caea
commit
37b39430d1
|
@ -282,7 +282,7 @@
|
||||||
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
|
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
|
||||||
divTag.getElementsByTagName('a')[0].onclick = (event) => {
|
divTag.getElementsByTagName('a')[0].onclick = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?lang=`);
|
window.history.pushState({}, null, `?lang=`);
|
||||||
setCookie(filterCookieName, 'lang=');
|
setCookie(filterCookieName, 'lang=');
|
||||||
resetAndFilter();
|
resetAndFilter();
|
||||||
document.querySelectorAll('.filter').forEach(filter => {
|
document.querySelectorAll('.filter').forEach(filter => {
|
||||||
|
@ -355,7 +355,7 @@
|
||||||
params = new URLSearchParams(window.location.search);
|
params = new URLSearchParams(window.location.search);
|
||||||
if (filterType) {
|
if (filterType) {
|
||||||
params.set(filterType, filterValue);
|
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());
|
setCookie(filterCookieName, params.toString());
|
||||||
}
|
}
|
||||||
updateFilterColors();
|
updateFilterColors();
|
||||||
|
@ -429,7 +429,7 @@
|
||||||
filter.addEventListener('change', () => {resetAndFilter(filter.name, filter.value)});
|
filter.addEventListener('change', () => {resetAndFilter(filter.name, filter.value)});
|
||||||
});
|
});
|
||||||
if (filters) {
|
if (filters) {
|
||||||
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
|
window.history.pushState({}, null, `?${params.toString()}`);
|
||||||
}
|
}
|
||||||
updateVisibleParams();
|
updateVisibleParams();
|
||||||
document.getElementById('kiwixSearchForm').onsubmit = (event) => {event.preventDefault()};
|
document.getElementById('kiwixSearchForm').onsubmit = (event) => {event.preventDefault()};
|
||||||
|
|
|
@ -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");
|
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/isotope.pkgd.min.js?cacheid=2e48d392" defer></script>
|
||||||
<script src="/ROOT/skin/iso6391To3.js?cacheid=ecde2bb3"></script>
|
<script src="/ROOT/skin/iso6391To3.js?cacheid=ecde2bb3"></script>
|
||||||
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=31ffa1f7" defer></script>
|
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=a4b8af39" defer></script>
|
||||||
)EXPECTEDRESULT"
|
)EXPECTEDRESULT"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue