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
This commit is contained in:
2026-11-27 15:04:38 +01:00
parent d087b8a4f3
commit 49a2ebcf15
13 changed files with 1246 additions and 13 deletions
+167
View File
@@ -0,0 +1,167 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Licences · F1 Circuits API examples</title>
<meta name="description" content="Every source the F1 Circuits posters are made from, its licence and the credit drawn on every picture; the licences of the posters, the track files and the GPS traces.">
<link rel="icon" href="data:,">
<link rel="stylesheet" href="site.css">
</head>
<body>
<header class="site">
<a class="brand" href="index.html">F1 <span>Circuits</span> API</a>
<nav aria-label="Examples">
<a href="index.html">Overview</a>
<a href="circuits.html">Circuit browser</a>
<a href="tracks.html">Track images</a>
<a href="map.html">GPS traces</a>
<a href="grand-prix.html">Grand prix lookup</a>
<a href="posters.html">Posters</a>
<a href="builder.html">Poster builder</a>
<a href="kometa.html">Kometa</a>
<a href="library.html">Library</a>
<a href="picker.html">Photo picker</a>
<a href="licences.html" aria-current="page">Licences</a>
</nav>
<div id="api-base"></div>
</header>
<main>
<h1>Licences</h1>
<p class="lead">
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 <code>X-Credits</code> header,
and listed here. A picture’s licence follows its sources, and is sent in its <code>X-License</code> header. Its
<code>Link: &lt;/licences&gt;; rel="license"</code> header points to this list.
</p>
<section class="card" id="call">
<h2>The sources</h2>
<p>What <code>/licences</code> answers, as a table. A credit with <code>&lt;author&gt;</code> and
<code>&lt;licence&gt;</code> is filled in with the photo’s own; one with <code>&lt;year&gt;</code> with the mosaic’s
year. The last column is the licence a picture made from that source gets.</p>
<div class="request"></div>
<div class="status"></div>
<div id="sources"></div>
<details class="result-raw"><summary>The answer as it came</summary><div class="result"></div></details>
</section>
<section class="card">
<h2>What the API offers, and under which licence</h2>
<div id="outputs"></div>
<p class="hint">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.</p>
</section>
<section class="card">
<h2>Formula 1</h2>
<p>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.</p>
</section>
</main>
<footer class="pager">
<a rel="prev" href="picker.html">← Photo picker</a>
<a class="home" href="index.html">All examples</a>
<span></span>
</footer>
<footer class="disclaimer">
<p>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.</p>
<p><a href="licences.html">Licences and credits</a>: 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).</p>
</footer>
<script src="site.js"></script>
<script>
(function () {
const { h, api, callJSON, notice } = F1;
const $ = (id) => document.getElementById(id);
const CC = (code) => `https://creativecommons.org/licenses/${code}/4.0/`;
// The rule as the lead settled it (2026-11-27): shown only where /licences does not say it, and marked so.
const STATED = {
pictures: {
rule: 'A picture’s licence follows the sources it is made from.',
licences: [
{ licence: 'CC BY-SA 4.0', licence_url: CC('by-sa'), when: 'made from a CC BY-SA photo' },
{ licence: 'CC BY-NC-SA 4.0', licence_url: CC('by-nc-sa'), when: 'made from EOX’s mosaics after 2016' },
{ licence: 'CC BY 4.0', licence_url: CC('by'), when: 'otherwise' },
],
},
tracks: { licence: 'MIT', licence_url: null },
};
/** The licence a picture from a source gets, by the rule, for a source whose entry does not say it. */
const BY_RULE = {
commons: 'CC BY-SA 4.0 from a CC BY-SA photo, else CC BY 4.0',
eox: 'CC BY-NC-SA 4.0',
jolpica: 'does not set a picture’s licence',
traces: 'does not set a picture’s licence',
};
const link = (href, text) => (href ? h('a', { href, target: '_blank', rel: 'noopener' }, text || href) : text || '–');
/** A credit form, its placeholders marked. */
function credit(text) {
const code = h('code');
for (const part of String(text || '').split(/(<[a-z]+>)/)) {
if (!part) continue;
code.append(/^<[a-z]+>$/.test(part) ? h('em', { title: 'Filled in per picture' }, part) : part);
}
return code;
}
function sourcesTable(sources) {
return h('table', { class: 'sources' },
h('thead', {}, h('tr', {}, ...['Source', 'Used for', 'Licence', 'Credit', 'Terms', 'A picture from it'].map((t) => h('th', {}, t)))),
h('tbody', {}, ...sources.map((s) => h('tr', { id: `source-${s.id}` },
h('td', {}, h('b', {}, s.name || s.id), h('br'), h('small', {}, h('code', {}, s.id))),
h('td', {}, s.used_for || '–'),
h('td', {}, link(s.licence_url, s.licence)),
h('td', {}, credit(s.credit)),
h('td', {}, s.terms ? link(s.terms, new URL(s.terms, location.href).host || s.terms) : '–'),
h('td', {}, s.picture_licence || h('span', { title: 'The answer does not say it; derived from the rule' },
BY_RULE[s.id] || 'CC BY 4.0', h('br'), h('small', {}, h('em', {}, 'by the rule'))))))));
}
function outputs(answer) {
const pictures = (answer && answer.pictures) || STATED.pictures;
const tracks = (answer && answer.tracks) || STATED.tracks;
const missing = [!(answer && answer.pictures) && 'the pictures’ licence', !(answer && answer.tracks) && 'the track files’ licence'].filter(Boolean);
const rows = [
...(pictures.licences || []).map((l, i) => h('tr', {},
i === 0 ? h('td', { rowspan: pictures.licences.length }, 'Race posters, season posters and session thumbnails') : null,
h('td', {}, link(l.licence_url, l.licence)),
h('td', {}, l.when || '–'))),
h('tr', {}, h('td', {}, 'Track files (SVG, PNG, GeoJSON) and the GPS traces'), h('td', {}, link(tracks.licence_url, tracks.licence)),
h('td', {}, 'LICENSE.md in the repository')),
];
$('outputs').replaceChildren(
missing.length ? notice('error', `/licences did not say ${missing.join(' or ')}, so this shows the rule as it was decided, not what the service says.`) : '',
h('p', {}, pictures.rule || ''),
h('table', {},
h('thead', {}, h('tr', {}, h('th', {}, 'What'), h('th', {}, 'Licence'), h('th', {}, 'When'))),
h('tbody', {}, ...rows)));
}
(async () => {
const answer = await callJSON($('call'), api('/licences'));
if (!answer) {
$('sources').replaceChildren(notice('error', 'The sources cannot be listed: /licences did not answer (see above). The service may not serve it yet.'));
outputs(null);
return;
}
if (!Array.isArray(answer.sources)) {
$('sources').replaceChildren(notice('error', 'The answer has no list of sources (no "sources" array).'));
} else {
$('sources').replaceChildren(sourcesTable(answer.sources));
}
outputs(answer);
})();
})();
</script>
</body>
</html>