diff --git a/src/bggpipe/static/app.js b/src/bggpipe/static/app.js index 3e3f57d..46005f3 100644 --- a/src/bggpipe/static/app.js +++ b/src/bggpipe/static/app.js @@ -125,9 +125,22 @@ setInterval(() => refreshBadges().catch(() => {}), 5000); /* One-line match summary for a titles/photo table row. Empty when the * row has no BGG data yet, so the mobile stacker can hide the cell. */ +/* Canonical outbound URL for a matched thing. RPG items live on RPGGeek + * (same database, different site) — a /boardgame/ URL is the wrong home + * for them. */ +function bggUrl(id, type) { + return type === "rpgitem" + ? `https://rpggeek.com/rpgitem/${encodeURIComponent(id)}` + : `https://boardgamegeek.com/boardgame/${encodeURIComponent(id)}`; +} + function metaLine(c) { + const name = !c.bgg_name ? "" : c.bgg_id + ? `${esc(c.bgg_name)} ↗` + : esc(c.bgg_name); return [ - c.bgg_name ? esc(c.bgg_name) + (c.bgg_id ? " · " + esc(c.bgg_id) : "") : "", + name, c.version_name ? esc(c.version_name) : "", c.type === "rpgitem" ? `RPG · local only` : "", ].filter(Boolean).join(" · "); diff --git a/src/bggpipe/templates/pages/librarygame.html b/src/bggpipe/templates/pages/librarygame.html index 617cee6..c3f1d0d 100644 --- a/src/bggpipe/templates/pages/librarygame.html +++ b/src/bggpipe/templates/pages/librarygame.html @@ -108,8 +108,8 @@ function render(g) { local ? `not on BGG · local` : "", rpg ? `RPG · local only` : "", g.bgg_id - ? `view on BGG ↗` + ? ` + view on ${rpg ? "RPGGeek" : "BGG"} ↗` : "", ].filter(Boolean).join(" · "); diff --git a/src/bggpipe/templates/pages/review.html b/src/bggpipe/templates/pages/review.html index 07a0db9..5f366f2 100644 --- a/src/bggpipe/templates/pages/review.html +++ b/src/bggpipe/templates/pages/review.html @@ -61,7 +61,9 @@ function matchCard(row, idx) { ${i + 1} ${thumbHtml(c)} ${esc(c.name)} ${esc(c.year ?? "—")} · ${esc(c.type || "?")} - · rank ${esc(c.rank ?? "—")} · owned ${esc(c.owned ?? "—")} + · rank ${esc(c.rank ?? "—")} · owned ${esc(c.owned ?? "—")} + · view ↗ `).join(""); return `
${shots(row.photos || [])}
-

${esc(row.bgg_name || row.title_raw)}

+

${esc(row.bgg_name || row.title_raw)} + ${row.bgg_id ? `versions on BGG ↗` : ""}

which edition${row.photos && row.photos.length ? ` is the copy in ${esc(row.photos.join(", "))}` : ""}? (skippable — u records "unknown", or just move on)

@@ -192,6 +197,9 @@ function render() { if (ACTIVE >= cards.length) ACTIVE = Math.max(0, cards.length - 1); highlight(); + // an outbound "view ↗" inside a pick row must not also cast the vote + m.querySelectorAll("[data-pick] a, [data-pickver] a").forEach(a => + a.onclick = e => e.stopPropagation()); m.querySelectorAll("[data-pick]").forEach(li => li.onclick = () => { const card = li.closest(".card"); decide(card, "pick", Number(li.dataset.pick));