diff --git a/public/app.jss b/public/app.jss
index 4f3d0e2..0393ac2 100644
--- a/public/app.jss
+++ b/public/app.jss
@@ -17,12 +17,12 @@ const els = {
let indexData = null;
let sidebarOpen = false;
let currentParent = null;
-let indexFiles = null;
+let indexFiles = null; // Cached
async function init() {
try {
indexData = await (await fetch("index.json")).json();
- indexFiles = indexData.flat.filter(f => f.isIndex);
+ indexFiles = indexData.flat.filter(f => f.isIndex); // Cache
populateNav();
populateSections();
populateTags();
@@ -92,7 +92,7 @@ function wireUI() {
if (els.sectionSelect.value !== "all") loadDefaultForSection(els.sectionSelect.value);
});
- [els.tagSelect, els.sortSelect, els.searchMode].forEach(el => el.addEventListener("change", renderList));
+ [els.tagSelect, els.sortNou, els.searchMode].forEach(el => el.addEventListener("change", renderList));
els.searchBox.addEventListener("input", renderList);
els.content.addEventListener("click", (e) => {
@@ -143,6 +143,7 @@ function loadDefaultForSection(section) {
location.hash = `#/${pinned.path}`;
}
+// NESTED HORIZON: Deep-Aware Sub-Navigation
function renderSubNav(parent) {
const subnav = els.subNav;
subnav.innerHTML = "";
@@ -167,6 +168,7 @@ async function handleHash() {
els.viewer.innerHTML = "";
const rel = location.hash.replace(/^#\//, "");
const parts = rel.split("/").filter(Boolean);
+
const currentParentPath = parts.slice(0, -1).join("/") || parts[0] || null;
if (currentParentPath !== currentParent) {
@@ -184,6 +186,7 @@ async function handleHash() {
if (rel.endsWith('/')) {
const currentPath = parts.join("/");
+
const indexFile = indexFiles.find(f => {
const dir = f.path.split("/").slice(0, -1).join("/");
return dir === currentPath;
@@ -196,7 +199,7 @@ async function handleHash() {
const html = marked.parse(src || `# ${currentPath.split("/").pop()}\n\nNo content yet.`);
els.viewer.innerHTML = `
No content yet.
`; @@ -210,7 +213,8 @@ async function handleHash() { els.viewer.innerHTML = `No content yet.
`; } } - } else { + } + else { const file = indexData.flat.find(f => f.path === rel); if (!file) { els.viewer.innerHTML = "Not found.
"; @@ -225,13 +229,14 @@ async function renderMarkdown(rel) { els.viewer.innerHTML = `