From 683d799c042ee434fb788631fdd028c8db866a33 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 30 Jun 2023 19:25:41 +0200 Subject: [PATCH] check --- test.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test.html b/test.html index 45a8f0c..c8951fc 100644 --- a/test.html +++ b/test.html @@ -63,19 +63,20 @@ function check(tab) { } } function push(tab) { - const tb = tab.split('/').slice(1).join('/') - window.history.pushState(null, null, `?tab=${tb}`) + window.history.pushState(null, null, `?tab=${tab}`) } function update(id) { - push(id) + const tab = id.split('/').slice(1).join('/') + push(tab) } function main() { - const tab = (new URL(document.location)).searchParams.get('tab') + let tab = (new URL(document.location)).searchParams.get('tab') if (tab) { check(tab) } else { - check('1/1') - push('tab/1/1') + tab = '1/1' + check(tab) + push(tab) } }