wip
This commit is contained in:
parent
b804078f3c
commit
90d094a93f
1 changed files with 18 additions and 9 deletions
25
test.html
25
test.html
|
@ -54,19 +54,28 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function update(id) {
|
function check(tab) {
|
||||||
let tabs = id.split('/').slice(1)
|
const tabs = tab.split('/')
|
||||||
window.history.pushState(null, null, `?tab=${tabs.join('/')}`)
|
|
||||||
}
|
|
||||||
function main() {
|
|
||||||
let tab = (new URL(document.location)).searchParams.get('tab')
|
|
||||||
if (tab) {
|
|
||||||
let path = 'tab'
|
let path = 'tab'
|
||||||
let tabs = tab.split('/')
|
|
||||||
for (tab of tabs) {
|
for (tab of tabs) {
|
||||||
path = `${path}/${tab}`
|
path = `${path}/${tab}`
|
||||||
document.getElementById(path).checked = true
|
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) {
|
||||||
|
push(id)
|
||||||
|
}
|
||||||
|
function main() {
|
||||||
|
const tab = (new URL(document.location)).searchParams.get('tab')
|
||||||
|
if (tab) {
|
||||||
|
check(tab)
|
||||||
|
} else {
|
||||||
|
check('1/1')
|
||||||
|
push('tab/1/1')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue