check
This commit is contained in:
parent
90d094a93f
commit
683d799c04
1 changed files with 7 additions and 6 deletions
13
test.html
13
test.html
|
@ -63,19 +63,20 @@ function check(tab) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function push(tab) {
|
function push(tab) {
|
||||||
const tb = tab.split('/').slice(1).join('/')
|
window.history.pushState(null, null, `?tab=${tab}`)
|
||||||
window.history.pushState(null, null, `?tab=${tb}`)
|
|
||||||
}
|
}
|
||||||
function update(id) {
|
function update(id) {
|
||||||
push(id)
|
const tab = id.split('/').slice(1).join('/')
|
||||||
|
push(tab)
|
||||||
}
|
}
|
||||||
function main() {
|
function main() {
|
||||||
const tab = (new URL(document.location)).searchParams.get('tab')
|
let tab = (new URL(document.location)).searchParams.get('tab')
|
||||||
if (tab) {
|
if (tab) {
|
||||||
check(tab)
|
check(tab)
|
||||||
} else {
|
} else {
|
||||||
check('1/1')
|
tab = '1/1'
|
||||||
push('tab/1/1')
|
check(tab)
|
||||||
|
push(tab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue