Show a role's copies: ×N beside the company in the feed, Also posted and A copy of in the reader

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-29 23:05:07 +02:00
1 parent 55e353e764
commit 374f74b742
2 files changed
+51

No files matched your search

+34
View File
@@ -860,6 +860,31 @@
+ words.map((w) => `<span class="badge">${esc(w)}</span>`).join("");
}
/* How many postings the row stands for, when a board or another host
lists the same role more than once (`dupes`); the reader lists them. */
function dupes(role) {
const n = (role.copies || 0) + 1;
return n > 1 ? `<span class="dupes" title="Posted ${n} times">×${n}</span>` : "";
}
/* The other postings of this role, each a link to where it is posted,
labelled by host and place, as newsdesk's "Also covered by". */
function alsoPosted(r) {
const copies = (Array.isArray(r.copies) ? r.copies : [])
.filter((c) => safeUrl(c.original_url));
if (!copies.length) return "";
return `<div class="also">
<h2 class="reader-label">Also posted</h2>
${copies.map((c) => {
const url = safeUrl(c.original_url);
const when = c.posted_at ? ago(c.posted_at) : "";
return `<a href="${esc(url)}" target="_blank" rel="noopener">
<b>${esc(c.host || host(url))}</b>
${esc([c.place, when].filter(Boolean).join(" · ") || host(url))} ↗</a>`;
}).join("")}
</div>`;
}
function drawRow(el, role) {
const scored = role.score !== null && role.score !== undefined;
const pct = scored ? Math.round(Math.min(1, Math.max(0, role.score)) * 100) : 0;
@@ -871,6 +896,7 @@
<a class="headline" href="${esc(pathFor(role.uid))}">${esc(role.title || "(untitled)")}</a>
<div class="meta">
${role.company ? companyName(role) : ""}
${dupes(role)}
${role.place ? `<span>${esc(role.place)}</span>` : ""}
${badges(role)}
<span title="Posted">${ago(role.posted_at)}</span>
@@ -1244,6 +1270,8 @@
${tagChips(r.tags)}
</div>
<h1>${esc(r.title || "")}</h1>
${loaded && r.dup_of ? `<p class="reader-note reader-copy">A copy of
<a href="${esc(pathFor(r.dup_of))}">the posting the list shows</a>.</p>` : ""}
${pay ? `<p class="reader-salary">${esc(pay.range)}</p>
${pay.detail ? `<p class="muted small">${esc(pay.detail)}</p>` : ""}
${pay.note ? `<p class="muted small">${esc(pay.note)}</p>` : ""}` : ""}
@@ -1259,6 +1287,7 @@
<div class="prose">${body}</div>
${out ? `<p class="reader-out"><a href="${esc(out)}" target="_blank" rel="noopener"
>Read it on ${esc(host(out) || "the board")} ↗</a></p>` : ""}
${loaded ? alsoPosted(r) : ""}
</div>
<div class="reader-foot">
<button type="button" class="step-prev" ${state.selected <= 0 ? "disabled" : ""}>← Previous</button>
@@ -1280,6 +1309,11 @@
el.querySelector('[data-tool="fetch"]')?.addEventListener("click",
(e) => fetchText(e.currentTarget));
el.querySelector(".reader-out a")?.addEventListener("click", () => markRead(r.uid));
el.querySelector(".reader-copy a")?.addEventListener("click", (e) => {
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) return;
e.preventDefault();
openReader(r.dup_of);
});
el.querySelector(".reader-body").scrollTop = scrolled;
}