mirror of
https://github.com/rvtr/wiki.git
synced 2025-10-31 06:31:13 -04:00
Close FAQ if clicking when already open
This commit is contained in:
parent
f66f7ef948
commit
f9c6125579
@ -1,7 +1,16 @@
|
||||
function setFaq(tab) {
|
||||
let url = new URL(window.location);
|
||||
url.searchParams.set("faq", tab);
|
||||
history.pushState({}, "", url);
|
||||
if(document.getElementById(`faq-${tab}`).checked) {
|
||||
let url = new URL(window.location);
|
||||
url.searchParams.delete("faq");
|
||||
history.pushState({}, "", url);
|
||||
// TODO: This is dumb, try do it better
|
||||
window.setTimeout(() => document.getElementById(`faq-${tab}`).checked = false, 100);
|
||||
} else {
|
||||
let url = new URL(window.location);
|
||||
url.searchParams.set("faq", tab);
|
||||
history.pushState({}, "", url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Try get FAQ from URL
|
||||
|
||||
Loading…
Reference in New Issue
Block a user