1function check(tab) {
2 const tabs = tab.split('/')
3 let path = 'tab'
4 for (tab of tabs) {
5 path = `${path}/${tab}`
6 document.getElementById(path).checked = true
7 }
8}
9function push(tab) {
10 window.history.pushState(null, null, `?tab=${tab}`)
11}
12function update(id) {
13 const tab = id.split('/').slice(1).join('/')
14 push(tab)
15}
16function main() {
17 let tab = (new URL(document.location)).searchParams.get('tab')
18 if (tab) {
19 check(tab)
20 } else {
21 tab = '1/1'
22 check(tab)
23 push(tab)
24 }
25}
26
27function swap() {
28 document.body.classList.toggle('dark')
29}