aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-09-11 21:45:02 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-09-11 21:45:02 +0300
commit63530324338de5e25853eaf8d7a85dbd8ca724ee (patch)
treed7a0f089c8aaaac1e0284a996b0cc2ea68c8f90a
parentb31ed4141f8fb0afccb8ae59bdd3614806f0e656 (diff)
downloadarching-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
-rw-r--r--src/js/app.js3
-rw-r--r--src/js/arching-kaos-spa-router.js20
2 files changed, 9 insertions, 14 deletions
diff --git a/src/js/app.js b/src/js/app.js
index c3e4c06..e246a19 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -19,8 +19,7 @@ window.addEventListener('resize', () => {
// And call
menuinit();
-// We bring up the default pane ( #welcome-section )
-document.querySelector('#welcome-section').hidden=false;
+locationHashOnChange();
progressPlaceholder.value = '0';
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;
}
}