diff --git a/static/js/collapse.js b/static/js/collapse.js
index 9bf7b97..a7f4630 100644
--- a/static/js/collapse.js
+++ b/static/js/collapse.js
@@ -9,7 +9,11 @@
(function () {
'use strict';
- var PREFIX = 'section-collapsed:';
+ /* Keys are namespaced by pathname: Pandoc auto-slugs (#introduction,
+ #background) recur across essays, and an un-namespaced key would
+ collapse the same-named section on every page. */
+ var PREFIX = 'section-collapsed:' + location.pathname + ':';
+ var store = window.lnUtils && window.lnUtils.safeStorage;
function initHeading(heading) {
var level = parseInt(heading.tagName[1], 10);
@@ -41,7 +45,7 @@
// Restore persisted state without transition flash.
var key = PREFIX + heading.id;
- var collapsed = localStorage.getItem(key) === '1';
+ var collapsed = store ? store.get(key) === '1' : false;
function setCollapsed(c, animate) {
if (!animate) wrapper.style.transition = 'none';
@@ -80,7 +84,7 @@
void wrapper.offsetHeight; // force reflow
}
setCollapsed(!isCollapsed, true);
- localStorage.setItem(key, isCollapsed ? '0' : '1');
+ if (store) store.set(key, isCollapsed ? '0' : '1');
});
// After open animation: release the height cap so late-rendering
diff --git a/static/js/search-filters.js b/static/js/search-filters.js
index 7d56d94..38e5625 100644
--- a/static/js/search-filters.js
+++ b/static/js/search-filters.js
@@ -113,12 +113,17 @@
/* ---- URL extraction ---- */
/* Normalise a URL to a pathname for lookup in epistemicMeta.
- Pagefind results use full URLs; semantic results use relative paths. */
+ Pagefind results use full URLs; semantic results use relative paths.
+ epistemicMeta keys are emitted as routed paths (".../index.html"),
+ while result links use the clean directory form (".../"), so the
+ trailing-slash form must be expanded before lookup. */
function normUrl(href) {
if (!href) return null;
try {
var u = new URL(href, window.location.origin);
- return u.pathname;
+ var p = u.pathname;
+ if (p.charAt(p.length - 1) === '/') p += 'index.html';
+ return p;
} catch (e) {
return href;
}
diff --git a/static/js/viz.js b/static/js/viz.js
index e15c00c..3e6c9b8 100644
--- a/static/js/viz.js
+++ b/static/js/viz.js
@@ -94,6 +94,9 @@
function isDark() {
var t = document.documentElement.dataset.theme;
if (t === 'dark') return true;
+ /* cappuccino is a dark-brown theme (light text on #553a28) — charts
+ need the dark palette or axis labels become unreadable. */
+ if (t === 'cappuccino') return true;
if (t === 'light') return false;
return window.matchMedia('(prefers-color-scheme: dark)').matches;
}
diff --git a/templates/score-reader-default.html b/templates/score-reader-default.html
index 91ada76..f757f32 100644
--- a/templates/score-reader-default.html
+++ b/templates/score-reader-default.html
@@ -7,6 +7,9 @@
+
+