diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2023-09-11 21:45:02 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2023-09-11 21:45:02 +0300 |
commit | 63530324338de5e25853eaf8d7a85dbd8ca724ee (patch) | |
tree | d7a0f089c8aaaac1e0284a996b0cc2ea68c8f90a /src/js/arching-kaos-spa-router.js | |
parent | b31ed4141f8fb0afccb8ae59bdd3614806f0e656 (diff) | |
download | arching-kaos-web-ui-63530324338de5e25853eaf8d7a85dbd8ca724ee.tar.gz arching-kaos-web-ui-63530324338de5e25853eaf8d7a85dbd8ca724ee.tar.bz2 arching-kaos-web-ui-63530324338de5e25853eaf8d7a85dbd8ca724ee.zip |
Changed way we init and handle location
Diffstat (limited to 'src/js/arching-kaos-spa-router.js')
-rw-r--r-- | src/js/arching-kaos-spa-router.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/js/arching-kaos-spa-router.js b/src/js/arching-kaos-spa-router.js index 03eac11..e5d5d2a 100644 --- a/src/js/arching-kaos-spa-router.js +++ b/src/js/arching-kaos-spa-router.js @@ -21,18 +21,14 @@ function locationHashGetter(){ } function locationHashOnChange(){ - if ( window.location.hash !== 'undefined' ){ - var route = new Object; - route.id = window.location.hash; - console.log(route); - menuinit(); - if ( menuids.includes(route.id.replace('/','')) ){ - document.querySelector(route.id.replace('/','')).hidden=false; - } else { - document.querySelector('#not-found-section').hidden=false; - } - //menusel(route); + var route = new Object; + route.id = locationHashGetter(); + menuinit(); + if ( (locationHashGetter() !== 'undefined') && (locationHashGetter() === '') ){ + document.querySelector('#welcome-section').hidden=false; + } else if ( (locationHashGetter() !== 'undefined') && ( menuids.includes(route.id.replace('/',''))) ){ + document.querySelector(route.id.replace('/','')).hidden=false; } else { - menuinit(); + document.querySelector('#not-found-section').hidden=false; } } |