Fold per-place copies of one host into one role that lists every place with its own link
The reader shows every place, each linked to its copy, and the teaser marked as a short description when there is no text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3adafd8950
commit
3d1fed7c0e
6 files changed
+336
-16
No files matched your search
@@ -942,6 +942,7 @@ body[data-reader="open"] .company-strip { display: none; }
|
||||
line-height: 1.4;
|
||||
}
|
||||
.also a b { display: block; color: var(--faint); font-size: .78rem; font-weight: 600; }
|
||||
.also span { display: block; margin-bottom: .55rem; color: var(--dim); font-size: .92rem; line-height: 1.4; }
|
||||
@media (hover: hover) {
|
||||
.also a:hover { color: var(--fg); }
|
||||
}
|
||||
|
||||
+42
-2
@@ -885,6 +885,42 @@
|
||||
</div>`;
|
||||
}
|
||||
|
||||
/* The role's places in the host's order, one entry for each place text a
|
||||
link opens: the copies' own links, and the role's link for its own. */
|
||||
function placeEntries(r) {
|
||||
const seen = new Set();
|
||||
const own = safeUrl(r.original_url);
|
||||
const out = [];
|
||||
for (const p of Array.isArray(r.places) ? r.places : []) {
|
||||
const url = p.url ? safeUrl(p.url) : own;
|
||||
const key = `${p.url || ""}\u0001${p.position}\u0001${p.text}`;
|
||||
if (!p.text || seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
out.push({ text: p.text, url });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/* The place line of the reader: the first place and "+N" for the others,
|
||||
as the feed's row shows it. */
|
||||
function placeLine(r) {
|
||||
const texts = [...new Set(placeEntries(r).map((e) => e.text))];
|
||||
return texts.length > 1 ? `${texts[0]} +${texts.length - 1}` : r.place || texts[0] || "";
|
||||
}
|
||||
|
||||
/* Every place of a role that has several, each a link to its own posting,
|
||||
laid out as "Also posted". */
|
||||
function placesList(r) {
|
||||
const entries = placeEntries(r);
|
||||
if (new Set(entries.map((e) => e.text)).size < 2) return "";
|
||||
return `<div class="also places">
|
||||
<h2 class="reader-label">Places</h2>
|
||||
${entries.map((e) => e.url
|
||||
? `<a href="${esc(e.url)}" target="_blank" rel="noopener">${esc(e.text)} ↗</a>`
|
||||
: `<span>${esc(e.text)}</span>`).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;
|
||||
@@ -1243,7 +1279,10 @@
|
||||
: !loaded
|
||||
? `<p class="reader-note">Loading…</p>`
|
||||
: text ? paragraphs(text)
|
||||
: `<p class="reader-note">The board gave no description for this one.</p>`;
|
||||
: (r.teaser || "").trim()
|
||||
? `<p class="reader-note reader-teaser">A short description from the board's
|
||||
list; the board gave no full text.</p>${paragraphs(r.teaser.trim())}`
|
||||
: `<p class="reader-note">The board gave no description for this one.</p>`;
|
||||
const pay = payDisplay(r);
|
||||
const careers = safeUrl(companies.get(r.company_key)?.careers_url);
|
||||
const waiting = state.summarising === state.readingUid;
|
||||
@@ -1264,7 +1303,7 @@
|
||||
${careers ? `<a class="reader-careers" href="${esc(careers)}" target="_blank" rel="noopener"
|
||||
title="The company's careers page">Careers ↗</a>` : ""}
|
||||
<span class="affinity-slot"></span>
|
||||
${r.place ? `<span>${esc(r.place)}</span>` : ""}
|
||||
${placeLine(r) ? `<span>${esc(placeLine(r))}</span>` : ""}
|
||||
${r.first_seen ? `<span title="First seen">${ago(r.first_seen)}</span>` : ""}
|
||||
${badges(r)}
|
||||
${tagChips(r.tags)}
|
||||
@@ -1287,6 +1326,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 ? placesList(r) : ""}
|
||||
${loaded ? alsoPosted(r) : ""}
|
||||
</div>
|
||||
<div class="reader-foot">
|
||||
|
||||
Reference in new issue
Block a user