mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
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:
committed by
Veloman Yunkan
parent
947744caea
commit
37b39430d1
@ -282,7 +282,7 @@
|
||||
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
|
||||
divTag.getElementsByTagName('a')[0].onclick = (event) => {
|
||||
event.preventDefault();
|
||||
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?lang=`);
|
||||
window.history.pushState({}, null, `?lang=`);
|
||||
setCookie(filterCookieName, 'lang=');
|
||||
resetAndFilter();
|
||||
document.querySelectorAll('.filter').forEach(filter => {
|
||||
@ -355,7 +355,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();
|
||||
@ -429,7 +429,7 @@
|
||||
filter.addEventListener('change', () => {resetAndFilter(filter.name, filter.value)});
|
||||
});
|
||||
if (filters) {
|
||||
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
|
||||
window.history.pushState({}, null, `?${params.toString()}`);
|
||||
}
|
||||
updateVisibleParams();
|
||||
document.getElementById('kiwixSearchForm').onsubmit = (event) => {event.preventDefault()};
|
||||
|
Reference in New Issue
Block a user