This commit is contained in:
Marc Beninca 2023-06-30 19:20:26 +02:00
parent b804078f3c
commit 90d094a93f

View file

@ -54,19 +54,28 @@
</div>
<script>
function check(tab) {
const tabs = tab.split('/')
let path = 'tab'
for (tab of tabs) {
path = `${path}/${tab}`
document.getElementById(path).checked = true
}
}
function push(tab) {
const tb = tab.split('/').slice(1).join('/')
window.history.pushState(null, null, `?tab=${tb}`)
}
function update(id) {
let tabs = id.split('/').slice(1)
window.history.pushState(null, null, `?tab=${tabs.join('/')}`)
push(id)
}
function main() {
let tab = (new URL(document.location)).searchParams.get('tab')
const tab = (new URL(document.location)).searchParams.get('tab')
if (tab) {
let path = 'tab'
let tabs = tab.split('/')
for (tab of tabs) {
path = `${path}/${tab}`
document.getElementById(path).checked = true
}
check(tab)
} else {
check('1/1')
push('tab/1/1')
}
}
</script>