Merge branch 'wp-j-dupes-ui'
This commit is contained in:
commit
e1c197b488
2 files changed
+51
No files matched your search
@@ -763,6 +763,9 @@ body[data-reader="open"] .row[data-open="true"] {
|
||||
}
|
||||
.meta .badge.closed, .reader-meta .badge.closed { color: var(--error); border-color: var(--error); }
|
||||
.meta .gated { color: var(--error); }
|
||||
/* How many postings a row stands for (roles.js `dupes`), newsdesk's "+N more
|
||||
outlets": beside the company and in the accent, not a badge. */
|
||||
.dupes { color: var(--accent); white-space: nowrap; }
|
||||
|
||||
.excerpt {
|
||||
font-family: var(--read);
|
||||
@@ -928,6 +931,20 @@ body[data-reader="open"] .company-strip { display: none; }
|
||||
}
|
||||
.prose p { margin: 0 0 1.05rem; }
|
||||
.reader-out { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
|
||||
.reader-note a { color: var(--accent); }
|
||||
.reader-copy { margin-top: .8rem; }
|
||||
/* The other postings of the role (roles.js `alsoPosted`), newsdesk's "Also
|
||||
covered by": the host over the place, one link each. */
|
||||
.also { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
|
||||
.also a {
|
||||
display: block; margin-bottom: .55rem;
|
||||
color: var(--dim); font-size: .92rem; text-decoration: none;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.also a b { display: block; color: var(--faint); font-size: .78rem; font-weight: 600; }
|
||||
@media (hover: hover) {
|
||||
.also a:hover { color: var(--fg); }
|
||||
}
|
||||
|
||||
/* The step through the list, for the pointer that has no `j` and `k`. At the
|
||||
foot of the pane because that is where a thumb already is. Shown only by
|
||||
|
||||
@@ -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))}">a posting</a> the feed lists once.</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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user