Open the posting_url over the original_url in the reader, its Also posted list and the o key
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b98561f64a
commit
cb5f9e5e74
1 file changed
+12
-5
+12
-5
@@ -903,16 +903,23 @@
|
||||
return n > 1 ? `<span class="dupes" title="Posted ${n} times">×${n}</span>` : "";
|
||||
}
|
||||
|
||||
/* Where a role's posting is: the ad's own page once it is known
|
||||
(`posting_url`, found for a Jobindex role when its text is fetched), else
|
||||
the link the board listed. Either way only an http(s) link. */
|
||||
function linkOf(x) {
|
||||
return safeUrl(x?.posting_url) || safeUrl(x?.original_url);
|
||||
}
|
||||
|
||||
/* 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));
|
||||
.filter((c) => linkOf(c));
|
||||
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 url = linkOf(c);
|
||||
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>
|
||||
@@ -925,7 +932,7 @@
|
||||
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 own = linkOf(r);
|
||||
const out = [];
|
||||
for (const p of Array.isArray(r.places) ? r.places : []) {
|
||||
const url = p.url ? safeUrl(p.url) : own;
|
||||
@@ -1312,7 +1319,7 @@
|
||||
el.dataset.uid = state.readingUid;
|
||||
if (r.title) document.title = `${r.title} — roledesk`;
|
||||
|
||||
const out = safeUrl(r.original_url);
|
||||
const out = linkOf(r);
|
||||
const text = (r.article_text || r.description || "").trim();
|
||||
const body = error
|
||||
? `<p class="reader-note">This role could not be loaded: ${esc(error)}</p>`
|
||||
@@ -1502,7 +1509,7 @@
|
||||
const uid = state.readingUid || state.items[state.selected]?.uid;
|
||||
const role = state.reading?.uid === uid ? state.reading
|
||||
: state.items.find((r) => r.uid === uid);
|
||||
const url = safeUrl(role?.original_url);
|
||||
const url = linkOf(role);
|
||||
if (!url) return;
|
||||
window.open(url, "_blank", "noopener");
|
||||
markRead(uid);
|
||||
|
||||
Reference in new issue
Block a user