Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 32 additions & 18 deletions docs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ function isUpcoming(a, b, gender = "both") {
const u = upcomingInfo(a, b, gender);
return !!u && u[0] >= S.today;
}
// Folded, a cell is both archives at once, so a date in either one is a date for the cell.
const isUpcomingEither = (a, b) => isUpcoming(a, b, "men") || isUpcoming(a, b, "women");

// Has this team played anyone at all in the active archive? An entire empty row is a
// different fact from "these two have never met", and the site says so.
Expand Down Expand Up @@ -718,9 +720,12 @@ function draw() {
} else if (ink === "combined") {
const sil = silent.both, pre = predebut.both;
col = metCategory(a, b) ? combinedColor(a, b)
: (sil[r] || sil[c]) ? nodataCol
: (pre[r] || pre[c]) ? predebutCol
: neverCol;
// Never met in either game, and a date on the calendar to change that: the same
// rule the unfolded halves use, asked of the pairing rather than one archive.
: (S.showUpcoming && atPresent && isUpcomingEither(a, b)) ? upcomingCol
: (sil[r] || sil[c]) ? nodataCol
: (pre[r] || pre[c]) ? predebutCol
: neverCol;
} else {
const g = inkGender(ink, r, c);
const sil = silent[g], pre = predebut[g];
Expand Down Expand Up @@ -1180,15 +1185,25 @@ function pairSummary(aId, bId, gender = "both") {
return { title: A.name, lines: [`${A.confed}${A.defunct ? " · defunct" : ""}`], self: true };
}
const title = `${A.name} v ${B.name}`;
if (gender === "both") { // no half in hand: report the two archives
const say = g => `${archiveWord(g)}: ${archiveSummary(A, B, g).lines[0]}`;
return { title, lines: [say("men"), say("women")] };
if (gender === "both") { // the folded sheet: one cell, both archives
const lines = [`${archiveWord("men")}: ${archiveSummary(A, B, "men").lines[0]}`,
`${archiveWord("women")}: ${archiveSummary(A, B, "women").lines[0]}`];
// When and where, which is the one thing neither of those lines has room for.
for (const g of ["men", "women"]) {
const up = upcomingInfo(A.id, B.id, g);
if (up && present()) lines.push(`${up[0]} · ${up[1]}`);
}
return { title, lines };
}
/* The cell's own archive leads and keeps its detail — the years a pair has met between,
or the date a first meeting is booked for. Losing that second line to the mirror is
how a highlighted fixture stopped being able to say when. The mirror follows it. */
const sum = archiveSummary(A, B, gender);
const other = gender === "men" ? "women" : "men";
return { ...sum, title,
lines: [`${archiveWord(gender)}: ${sum.lines[0]}`,
`${archiveWord(other)}: ${archiveSummary(A, B, other).lines[0]}`] };
const lines = [`${archiveWord(gender)}: ${sum.lines[0]}`];
if (sum.lines[1]) lines.push(sum.lines[1]);
lines.push(`${archiveWord(other)}: ${archiveSummary(A, B, other).lines[0]}`);
return { ...sum, title, lines };
}
const genderWord = (gender = "both") =>
(gender === "both" ? "senior" : gender === "men" ? "men's" : "women's");
Expand All @@ -1207,7 +1222,7 @@ function summaryHtml(sum) {
const cls = sum.upcoming ? "up" : sum.silent ? "silent" : sum.predebut ? "pre" : "n";
return `<div class="vs">${esc(sum.title)}</div>`
+ `<div class="${cls}">${esc(sum.lines[0] || "")}</div>`
+ (sum.lines[1] ? `<div class="dim">${esc(sum.lines[1])}</div>` : "");
+ sum.lines.slice(1).map(l => `<div class="dim">${esc(l)}</div>`).join("");
}

function showTooltip(rc, mx, my) {
Expand Down Expand Up @@ -1758,7 +1773,7 @@ function renderFixtures() {
<h2>Never met. Scheduled to.</h2>
<p>Every pairing below would be a first meeting in the history of the game — two
national teams that have never played each other, with a date. This feed covers
<b>both</b> games, whichever dataset the grid is set to${esc(isFiltered() ? ", filtered to the teams in the panel" : "")}.
<b>both</b> games${esc(isFiltered() ? ", filtered to the teams in the panel" : "")}.
<a href="feed.xml">Subscribe by RSS</a> or <a href="feed.json">JSON</a>.</p>
</div>`
+ groups.map(gr =>
Expand Down Expand Up @@ -2376,13 +2391,12 @@ function setFolded(folded) {
b.setAttribute("aria-selected", on ? "true" : "false");
b.tabIndex = on ? 0 : -1;
});
/* Never-played and upcoming are single-archive ideas. Each half of the unfolded sheet
has one archive, so they mean something there; the folded sheet is the two read
together and answers with its own four-way key instead. */
for (const id of ["opt-highlight", "opt-upcoming"]) {
const el = $(id);
if (el) el.disabled = folded;
}
/* Never-played moves the meetings ramp, and the folded sheet has no ramp — it carries
the four-way key, whose colours are fixed. Upcoming is not like that: a pairing that
has never met in either game and has a date booked is exactly what the folded sheet is
for, so it stays live on both. */
const highlight = $("opt-highlight");
if (highlight) highlight.disabled = folded;
// The keyboard focus may be sitting on the half that has just folded away; the same
// pairing is waiting for it across the crease.
if (folded && S.focus && S.focus.c < S.focus.r) S.focus = { r: S.focus.c, c: S.focus.r };
Expand Down
3 changes: 3 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ <h2 class="sr-only">Legend</h2>
<span><i class="sw" id="sw-men"></i> men's only</span>
<span><i class="sw" id="sw-women"></i> women's only</span>
<span><i class="sw" id="sw-neither"></i> neither</span>
<span><i class="sw" id="sw-up-folded"></i> upcoming</span>
<span><i class="sw" id="sw-pre-folded"></i> not yet debuted</span>
<span><i class="sw" id="sw-none-folded"></i> never played anyone</span>
</div>
<p class="hint">The two halves laid on top of each other: each cell is one pairing,
answered by both archives at once.</p>
Expand Down
4 changes: 4 additions & 0 deletions docs/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ body[data-never="1"] #sw-never { background: var(--never-hi); border-color: var(
#sw-men { background: var(--men-only); }
#sw-women { background: var(--women-only); }
#sw-neither { background: var(--never); border: 1px solid var(--grid-strong); }
/* The three empties the folded sheet can also paint, which its key never named. */
#sw-up-folded { background: var(--upcoming); }
#sw-pre-folded { background: var(--predebut); border: 1px solid var(--grid); }
#sw-none-folded { background: var(--nodata); border: 1px solid var(--nodata-line); }
.split-key { display: flex; gap: 10px; align-items: flex-start; }
.split-key svg { flex: none; border: 1px solid var(--grid-strong); border-radius: 2px; }
.split-key .hint { margin: 0; line-height: 1.5; }
Expand Down
Loading