diff options
| author | Marin Ivanov <[email protected]> | 2024-08-21 03:31:41 +0300 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2024-08-21 03:31:41 +0300 |
| commit | 8354a7fae28e0bcc7a0eb1b6337f6da0d0769c94 (patch) | |
| tree | d57e9875407b723f6d7f6e2d27dfad0f74f22517 | |
| parent | 193f4933a8a83ee191b5d3bb8b8b8237dc03bf7d (diff) | |
force app to be at /
| -rw-r--r-- | app.js | 6 | ||||
| -rw-r--r-- | ka.js | 2 |
2 files changed, 4 insertions, 4 deletions
@@ -73,7 +73,7 @@ return (h) => nav( labelfor("showmenu", span("☰"), " Menu"), input("checkbox").$attr("id", "showmenu"), - ...navs.map(([href,txt]) => ahref(href,txt).$cls(href===h?"active":"")) + ...navs.map(([href,txt]) => ahref(href,txt).$cls(href.substring(1)===h?"active":"")) ); } function CRouter(routes) { @@ -120,8 +120,8 @@ ) } let navbar = CNav([ - ["#", "Home"], - ...entries(config.sections).map(([id, x]) => [`#/${id}`, x.title]), + ["/#", "Home"], + ...entries(config.sections).map(([id, x]) => [`/#/${id}`, x.title]), ]); let router = CRouter({ "/": () => div( @@ -52,7 +52,7 @@ let {entries,fromEntries} = Object; mount = (root, app) => { function reload() { - let h = doc.location.hash || "#"; + let h = (location.pathname==='/')?(location.hash || "#"):"##"; root.replaceChildren(...app(h)); }; reload(); |
