From 49a2ebcf15e1357ecfba50d752c6987fa06dab0b Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 27 Nov 2026 15:04:24 +0100 Subject: [PATCH] Add the photo picker, poster builder and licences pages A pick is a repository edit, so the picker shows the Commons candidates cropped to the poster's frame, natural or bw as the service treats them, beside the picks of the circuit's other layouts, and gives the entry to copy (the picks file's "$comment" kept first). The builder sends every option of docs/posters.md as a query parameter, renders only on request and shows the answer's X-Credits and X-License. The licences page shows /licences: each source, its credit and the licence a picture made from it gets. Every page now carries the Formula 1 disclaimer at its foot, as F1's guidelines ask of an unofficial site, and the posters page lists the backgrounds the design keeps (no Esri). Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh --- examples/builder.html | 359 +++++++++++++++++++++++++++ examples/circuits.html | 10 + examples/grand-prix.html | 10 + examples/index.html | 34 ++- examples/kometa.html | 12 +- examples/library.html | 12 +- examples/licences.html | 167 +++++++++++++ examples/map.html | 10 + examples/picker.html | 519 +++++++++++++++++++++++++++++++++++++++ examples/posters.html | 20 +- examples/site.css | 80 ++++++ examples/site.js | 16 +- examples/tracks.html | 10 + 13 files changed, 1246 insertions(+), 13 deletions(-) create mode 100644 examples/builder.html create mode 100644 examples/licences.html create mode 100644 examples/picker.html diff --git a/examples/builder.html b/examples/builder.html new file mode 100644 index 0000000..a494a40 --- /dev/null +++ b/examples/builder.html @@ -0,0 +1,359 @@ + + + + + + Poster builder · F1 Circuits API examples + + + + + +
+ F1 Circuits API + +
+
+ +
+

Poster builder

+

+ Every poster route takes the same options as query parameters. Tick an option to send it; an option left out takes + its default. The address below follows every change, and the picture is rendered only when you press the button, + because the server draws it and may fetch map tiles first. +

+ +
+

1. Which picture

+
+ +
+
+
+ + +
+
+
+
+ +
+

2. The options

+

An unknown option or value is answered 422, naming it. The credit line is drawn on every picture + whatever the options; no option takes it off.

+
+
+ +
+

3. The picture

+
+ +
+
+
Not rendered yet.
+
+
+
+
+ + + + + + + + diff --git a/examples/circuits.html b/examples/circuits.html index ae465d7..68f31c5 100644 --- a/examples/circuits.html +++ b/examples/circuits.html @@ -18,8 +18,11 @@ GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -89,6 +92,13 @@ All examples + diff --git a/examples/licences.html b/examples/licences.html new file mode 100644 index 0000000..0ba37b6 --- /dev/null +++ b/examples/licences.html @@ -0,0 +1,167 @@ + + + + + + Licences · F1 Circuits API examples + + + + + +
+ F1 Circuits API + +
+
+ +
+

Licences

+

+ Every picture the API makes is drawn from sources whose licences allow keeping a copy, and each says where it comes + from: the credit of every source it was made from is drawn at its foot, sent in its X-Credits header, + and listed here. A picture’s licence follows its sources, and is sent in its X-License header. Its + Link: </licences>; rel="license" header points to this list. +

+ +
+

The sources

+

What /licences answers, as a table. A credit with <author> and + <licence> is filled in with the photo’s own; one with <year> with the mosaic’s + year. The last column is the licence a picture made from that source gets.

+
+
+
+
The answer as it came
+
+ +
+

What the API offers, and under which licence

+
+

A race name and its date on a picture are single facts: they do not set its licence. The Kometa + file says in its first lines that its race schedules come from Jolpica, under CC BY-NC-SA 4.0.

+
+ +
+

Formula 1

+

This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE, + FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One + Licensing B.V.

+
+
+ + + + + + + + diff --git a/examples/map.html b/examples/map.html index 9bf9bb5..931a0e4 100644 --- a/examples/map.html +++ b/examples/map.html @@ -20,8 +20,11 @@ GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -65,6 +68,13 @@ All examples + diff --git a/examples/picker.html b/examples/picker.html new file mode 100644 index 0000000..00a574d --- /dev/null +++ b/examples/picker.html @@ -0,0 +1,519 @@ + + + + + + Photo picker · F1 Circuits API examples + + + + + +
+ F1 Circuits API + +
+
+ + + + +
+

Photo picker

+

+ A race poster over bg=satellite uses a layout’s picked Wikimedia Commons photo when it has one, and a + season poster shows that season’s cars only from a picked photo. This page shows the candidates + tools/commons_candidates.py found, cropped to the poster’s frame as the service crops them, in natural + colour or black and white. Choosing one gives the entry to copy into the picks file. The page writes nothing to the + server: a pick is a change to the repository. +

+

+ Only CC0, public domain, CC BY and CC BY-SA files are listed, with Commons’ quality marks first, then size, then + landscape. A search also finds ground photos, maps and the odd helicopter, so look at each one before you pick it. +

+ +
+

1. The lists

+

The candidates come with the site; the picks are read from the repository, beside the page’s folder. + Run python3 -m http.server in the working copy and open /examples/picker.html there to + have both, or load a picks file from disk below.

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+

2. What to pick for

+
+ + + +
+
+ +
+
+
+
+ + + +
+

Picks of the circuit’s other layouts

+
+

Candidates

+
+
+
+ + + + + + + + diff --git a/examples/posters.html b/examples/posters.html index ba1de26..1ba06eb 100644 --- a/examples/posters.html +++ b/examples/posters.html @@ -18,8 +18,11 @@ GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -44,14 +47,14 @@

Race poster

-

/posters/race/{race name}/{season}.png?bg={background}, 1000×1500: the round, the race’s name, the track and its date over a map of the circuit.

+

/posters/race/{race name}/{season}.png?bg={background}, 1000×1500: the round, the race’s name, the track and its date over a map of the circuit. Every other option is on the poster builder.

@@ -101,7 +104,14 @@ +
+

This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE, + FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One + Licensing B.V.

+

Licences and credits: every source the pictures are made from, the licence each + picture takes from its sources, and the licence of the track files and the GPS traces (MIT).

diff --git a/examples/site.css b/examples/site.css index f246bc0..d8239d3 100644 --- a/examples/site.css +++ b/examples/site.css @@ -44,6 +44,9 @@ * { box-sizing: border-box; } +/* An element hidden by the page stays hidden, whatever display its class gives it. */ +[hidden] { display: none !important; } + body { margin: 0; background: var(--bg); @@ -353,3 +356,80 @@ a.tile-link:hover .tile-frame { outline: 3px solid var(--accent); } @media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } } .waiting { display: flex; gap: 1rem; align-items: center; } .waiting p { margin: 0.2rem 0; } + +/* ---- the Formula 1 disclaimer, at the foot of every page ---- */ + +footer.disclaimer { + max-width: 1200px; + margin: 0 auto; + padding: 0 1.5rem 2.5rem; + font-size: 0.78rem; + color: var(--muted); +} +footer.disclaimer p { margin: 0.3rem 0; max-width: 60rem; } + +/* ---- segmented toggles (picker, builder) ---- */ + +.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; } +.seg button { border: none; border-radius: 0; border-right: 1px solid var(--line); } +.seg button:last-child { border-right: none; } +.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); } + +/* ---- photo picker ---- */ + +.photos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } +.photos.thumb { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } +.photo-card { + border: 1px solid var(--line); + border-radius: var(--radius); + padding: 0.5rem; + display: flex; + flex-direction: column; + gap: 0.35rem; + min-width: 0; + background: var(--card); +} +.photo-card.chosen { outline: 3px solid var(--accent); } +.photo-card.picked { border-color: var(--ok); border-width: 2px; } +.photo-frame { background: #000; border-radius: 6px; overflow: hidden; aspect-ratio: 2 / 3; } +.photos.thumb .photo-frame { aspect-ratio: 16 / 9; } +.photo-frame img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; } +.treat-bw .photo-frame img { filter: url(#bw); } +.photo-card .name { font-weight: 650; font-size: 0.85rem; line-height: 1.3; overflow-wrap: anywhere; } +.photo-card .meta { font-size: 0.78rem; color: var(--muted); line-height: 1.4; } +.photo-card .meta b { color: var(--text); font-weight: 600; } +.photo-card .tags { display: flex; flex-wrap: wrap; gap: 0.25rem; } +.tag { font-size: 0.7rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.45rem; color: var(--muted); } +.tag.mark { border-color: var(--ok); color: var(--ok); } +.tag.warn { border-color: var(--warn); color: var(--warn); } +.photo-card .actions { display: flex; gap: 0.5rem; align-items: center; margin-top: auto; font-size: 0.8rem; } +.photo-card .actions button { font-size: 0.8rem; padding: 0.2rem 0.6rem; } +.photos.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } + +.copy-block { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.6rem 0; } +.copy-block .head { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; } +.copy-block .head span { font-size: 0.85rem; color: var(--muted); } + +/* ---- poster builder ---- */ + +.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem 1.25rem; } +.option { border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; display: flex; flex-direction: column; gap: 0.35rem; } +.option .opt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; } +.option .opt-head code { font-weight: 700; } +.option .opt-head small { color: var(--muted); font-size: 0.75rem; text-align: right; } +.option .opt-body { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; align-items: center; font-size: 0.88rem; } +.option .opt-body label { display: inline-flex; align-items: center; gap: 0.3rem; } +.option.set { border-color: var(--accent); } +.option select { max-width: 100%; min-width: 0; } +.option .opt-body > select { flex: 1; } +.option input[type="color"] { padding: 0.1rem; width: 3rem; height: 2rem; } +.option input[type="range"] { flex: 1; min-width: 8rem; } +.credits { margin-top: 0.75rem; } +.credits table th { width: 9rem; } +.credits td code { white-space: normal; overflow-wrap: anywhere; } +details.result-raw { margin-top: 0.75rem; } +details.result-raw summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; margin-bottom: 0.5rem; } +table.sources td code { white-space: normal; overflow-wrap: anywhere; } +table.sources th:nth-child(3), table.sources td:nth-child(3) { min-width: 9rem; } +table.sources th:nth-child(4), table.sources td:nth-child(4) { width: 34%; } +.card > div + p.hint { margin-top: 0.75rem; } diff --git a/examples/site.js b/examples/site.js index 7182355..9a98990 100644 --- a/examples/site.js +++ b/examples/site.js @@ -182,7 +182,7 @@ return null; } setStatus(statusEl, 'ok', summary); - return { status: res.status, type, blob, ms, size: blob.size, url }; + return { status: res.status, type, blob, ms, size: blob.size, url, headers: res.headers }; } /** Fetches JSON for a card and shows it in its `.result`; returns the parsed value or null. */ @@ -243,10 +243,13 @@ return pre; } - /** What the first bytes of a body are: 'png', 'svg', 'json' or 'unknown'. */ + /** What the first bytes of a body are: 'png', 'jpg', 'webp', 'svg', 'json' or 'unknown'. */ async function sniff(blob) { const head = new Uint8Array(await blob.slice(0, 256).arrayBuffer()); if (head[0] === 0x89 && head[1] === 0x50 && head[2] === 0x4e && head[3] === 0x47) return 'png'; + if (head[0] === 0xff && head[1] === 0xd8 && head[2] === 0xff) return 'jpg'; + const ascii = (from, to) => String.fromCharCode(...head.slice(from, to)); + if (ascii(0, 4) === 'RIFF' && ascii(8, 12) === 'WEBP') return 'webp'; const text = new TextDecoder().decode(head).trimStart(); if (text.startsWith('GPS traces Grand prix lookup Posters + Poster builder Kometa Library + Photo picker + Licences
@@ -80,6 +83,13 @@ All examples +
+

This website is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE, + FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One + Licensing B.V.

+

Licences and credits: every source the pictures are made from, the licence each + picture takes from its sources, and the licence of the track files and the GPS traces (MIT).

+