diff options
Diffstat (limited to 'src/js/arching-kaos-spa-router.js')
-rw-r--r-- | src/js/arching-kaos-spa-router.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/js/arching-kaos-spa-router.js b/src/js/arching-kaos-spa-router.js index 650a828..03eac11 100644 --- a/src/js/arching-kaos-spa-router.js +++ b/src/js/arching-kaos-spa-router.js @@ -1,4 +1,3 @@ - /* * A new feature for a new future: * @@ -11,3 +10,29 @@ * the "route" we got from `location.search`. * */ + +function locationHashSetter(value){ + window.location.hash = value; + locationHashOnChange(); +} + +function locationHashGetter(){ + return window.location.hash; +} + +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); + } else { + menuinit(); + } +} |