aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-03-17 03:34:53 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-03-17 03:34:53 +0200
commit0b6909371840d482902c9217adf5fab440e196aa (patch)
tree0f8a6b1606ffe104422905ae9652b5a1ead87f1b /src
parent0d04f296f37548a926003ea775e0936348aa7909 (diff)
downloadarching-kaos-web-ui-0b6909371840d482902c9217adf5fab440e196aa.tar.gz
arching-kaos-web-ui-0b6909371840d482902c9217adf5fab440e196aa.tar.bz2
arching-kaos-web-ui-0b6909371840d482902c9217adf5fab440e196aa.zip
Reworked routing
Diffstat (limited to 'src')
-rw-r--r--src/js/arching-kaos-spa-router.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/js/arching-kaos-spa-router.js b/src/js/arching-kaos-spa-router.js
index e5d5d2a..162f1e2 100644
--- a/src/js/arching-kaos-spa-router.js
+++ b/src/js/arching-kaos-spa-router.js
@@ -22,12 +22,15 @@ function locationHashGetter(){
function locationHashOnChange(){
var route = new Object;
- route.id = locationHashGetter();
+ route.full = locationHashGetter();
+ route.args = route.full.split('/');
+ route.menuid = '#'+route.args[1];
+ route.subcommand = route.args[2];
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 if ( (locationHashGetter() !== 'undefined') && ( menuids.includes(route.menuid))){
+ document.querySelector(route.menuid).hidden=false;
} else {
document.querySelector('#not-found-section').hidden=false;
}