summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2024-08-21 03:31:41 +0300
committerMarin Ivanov <[email protected]>2024-08-21 03:31:41 +0300
commit8354a7fae28e0bcc7a0eb1b6337f6da0d0769c94 (patch)
treed57e9875407b723f6d7f6e2d27dfad0f74f22517
parent193f4933a8a83ee191b5d3bb8b8b8237dc03bf7d (diff)
force app to be at /
-rw-r--r--app.js6
-rw-r--r--ka.js2
2 files changed, 4 insertions, 4 deletions
diff --git a/app.js b/app.js
index b6e7bfc..49fd24b 100644
--- a/app.js
+++ b/app.js
@@ -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(
diff --git a/ka.js b/ka.js
index 95634cc..843a152 100644
--- a/ka.js
+++ b/ka.js
@@ -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();