mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
lang: make loadLangSelector respect existing params
This commit is contained in:
parent
dd5eecf9f9
commit
a3a22d353c
@ -68,6 +68,8 @@ export const loadLangSelector = (page: string) => {
|
||||
t12.checked = false;
|
||||
}
|
||||
}
|
||||
let queryString = new URLSearchParams(window.location.search);
|
||||
if (queryString.has("lang")) queryString.delete("lang");
|
||||
_get("/lang/" + page, null, (req: XMLHttpRequest) => {
|
||||
if (req.readyState == 4) {
|
||||
if (req.status != 200) {
|
||||
@ -77,7 +79,9 @@ export const loadLangSelector = (page: string) => {
|
||||
const list = document.getElementById("lang-list") as HTMLDivElement;
|
||||
let innerHTML = '';
|
||||
for (let code in req.response) {
|
||||
innerHTML += `<a href="?lang=${code}" class="button w-100 al justify-start ~neutral mb-2 lang-link">${req.response[code]}</a>`;
|
||||
queryString.set("lang", code);
|
||||
innerHTML += `<a href="?${queryString.toString()}" class="button w-100 al justify-start ~neutral mb-2 lang-link">${req.response[code]}</a>`;
|
||||
queryString.delete("lang");
|
||||
}
|
||||
list.innerHTML = innerHTML;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user