Skip to content

Commit b63e3c3

Browse files
TMHSDigitalclaude
andcommitted
site: homepage and Copy fixes from both reviews
- A malformed #entry- link no longer stops the homepage script. - Starter table links save the scroll position, like the cards. - When the clipboard is refused, Copy all credits selects a block of just the credit lines instead of the whole list with its labels. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wc67NX9MM964uaVGn4bpZJ
1 parent 1b677aa commit b63e3c3

5 files changed

Lines changed: 27 additions & 4 deletions

File tree

‎site/lib/lib.test.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ fsTest.rmSync(tmpRoot, { recursive: true, force: true });
359359
const lfsCredit = llmsFullTxt({ entries: llmsEntries, site, categories: cats, bodies: new Map(), stacks: [{ meta: { id: "s2", title: "Make Y", task: "A task.", walked: "2026-09-01" }, picked: [{ need: "Art", entry: { ...base, id: "b1", name: "Beta" } }] }] });
360360
has("full carries the credit line text", lfsCredit, 'Credits to ship:\n- Beta: Art by "X" </script>');
361361

362+
/* deferred minors, batch C ------------------------------------------------- */
363+
has("copy all targets a block of just the credit lines", spage, 'data-target="credits-all"');
364+
has("that block is hidden until the fallback needs it", spage, '<pre class="attribution-string copy-all-text" id="credits-all" hidden>Art by &quot;A&quot; &lt;x&gt;\nMusic by B</pre>');
365+
362366
/* report (keep last) ------------------------------------------------------ */
363367
if (failures.length) {
364368
console.error(`lib.test failed (${failures.length}):`);

‎site/lib/stack-page.mjs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ function owesHtml(owed) {
4848
.join("\n");
4949
const all = copyAllText(owed);
5050
const allButton = all
51-
? `<p class="copy-all"><button type="button" class="btn-ghost" data-copy="${esc(all)}" data-target="credits-list" hidden>Copy all credits</button>
52-
<span class="copy-status" role="status" aria-live="polite"></span></p>`
51+
? `<p class="copy-all"><button type="button" class="btn-ghost" data-copy="${esc(all)}" data-target="credits-all" hidden>Copy all credits</button>
52+
<span class="copy-status" role="status" aria-live="polite"></span></p>
53+
<pre class="attribution-string copy-all-text" id="credits-all" hidden>${esc(all)}</pre>`
5354
: "";
5455
groups.push(`<div class="owes-group"><h3>Credits to ship</h3><ul class="credit-list" id="credits-list">${items}</ul>${allButton}</div>`);
5556
}

‎site/public/app.js‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@
3333

3434
// Old permalinks (#entry-<id>) now have real pages.
3535
const legacy = location.hash.match(/^#entry-(.+)$/);
36-
if (legacy && byId[decodeURIComponent(legacy[1])]) {
37-
location.replace(`entry/${encodeURIComponent(decodeURIComponent(legacy[1]))}/`);
36+
let legacyId = null;
37+
try {
38+
legacyId = legacy ? decodeURIComponent(legacy[1]) : null;
39+
} catch {
40+
// A malformed escape is not an entry; the page loads as usual.
41+
}
42+
if (legacyId && byId[legacyId]) {
43+
location.replace(`entry/${encodeURIComponent(legacyId)}/`);
3844
return;
3945
}
4046
const PERSPECTIVE_LABELS = {
@@ -526,6 +532,11 @@
526532
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
527533
if (e.target.closest("a.entry-link")) rememberScroll();
528534
});
535+
// Starter rows link to entry pages too.
536+
$("#starter-table").addEventListener("click", (e) => {
537+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
538+
if (e.target.closest("a")) rememberScroll();
539+
});
529540

530541
$("#active-filters").addEventListener("click", (e) => {
531542
const btn = e.target.closest("[data-clear]");

‎site/public/stack.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
} catch {
1111
// Clipboard access can be refused; select the text so it can be
1212
// copied by hand rather than failing silently.
13+
// Copy all's target is a hidden block of just the credit lines.
1314
const target = document.getElementById(btn.getAttribute("data-target"));
15+
target.hidden = false;
1416
const range = document.createRange();
1517
range.selectNodeContents(target);
1618
const sel = getSelection();

‎site/public/styles.css‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,3 +1235,8 @@ input:focus-visible {
12351235
.used-in {
12361236
margin: 0 0 1rem;
12371237
}
1238+
1239+
.copy-all-text {
1240+
margin: 0.5rem 0 0;
1241+
white-space: pre-wrap;
1242+
}

0 commit comments

Comments
 (0)