diff --git a/examples/circuits.html b/examples/circuits.html index 86e98ae..ae465d7 100644 --- a/examples/circuits.html +++ b/examples/circuits.html @@ -19,6 +19,7 @@ Grand prix lookup Posters Kometa + Library
diff --git a/examples/grand-prix.html b/examples/grand-prix.html index 4c7fa6c..0c2d5e4 100644 --- a/examples/grand-prix.html +++ b/examples/grand-prix.html @@ -19,6 +19,7 @@ Grand prix lookup Posters Kometa + Library
diff --git a/examples/index.html b/examples/index.html index da711c2..8850387 100644 --- a/examples/index.html +++ b/examples/index.html @@ -19,6 +19,7 @@ Grand prix lookup Posters Kometa + Library
@@ -88,6 +89,16 @@
  • /kometa/formula-1-metadata.yml
  • + +

    Library

    +

    Browse a Formula 1 library as Plex or Emby shows it: seasons, race weekends and sessions, from the Kometa file and the posters.

    + +

    Choosing which API a page calls

    diff --git a/examples/kometa.html b/examples/kometa.html index 1129269..e7eaee3 100644 --- a/examples/kometa.html +++ b/examples/kometa.html @@ -19,6 +19,7 @@ Grand prix lookup Posters Kometa + Library
    @@ -81,7 +82,7 @@ diff --git a/examples/library.html b/examples/library.html new file mode 100644 index 0000000..052555f --- /dev/null +++ b/examples/library.html @@ -0,0 +1,420 @@ + + + + + + Library · F1 Circuits API examples + + + + + +
    + F1 Circuits API + +
    +
    + +
    +

    Library

    +

    + A Formula 1 library as Plex or Emby shows it with the Kometa file: a season is a show + with its season poster, a race weekend a season of that show with its race poster, a session an episode with its + thumbnail. The whole library comes from one call; each picture is its own call, made when it comes on screen. +

    + +
    +

    The library: one call

    +

    + The file lists every season, its rounds and each poster’s and thumbnail’s address; the race names are read from + the race posters’ addresses, the sessions from the episodes’. The page does not call Jolpica itself. +

    +
    +
    +
    +
    + + +
    +
    + + + + + + + diff --git a/examples/map.html b/examples/map.html index 68ae286..9bf9bb5 100644 --- a/examples/map.html +++ b/examples/map.html @@ -21,6 +21,7 @@ Grand prix lookup Posters Kometa + Library
    diff --git a/examples/posters.html b/examples/posters.html index 4b09b8c..ba1de26 100644 --- a/examples/posters.html +++ b/examples/posters.html @@ -19,6 +19,7 @@ Grand prix lookup Posters Kometa + Library
    @@ -109,20 +110,8 @@ const { h, api, path, call, setRequest, setStatus, showImage, racePicker } = F1; const $ = (id) => document.getElementById(id); - // Kometa's episode numbering per weekend format: the same maps the service renders from. - const STANDARD = [ - ['fp1', 'Free Practice 1'], ['fp2', 'Free Practice 2'], ['fp3', 'Free Practice 3'], - ['pre-qualifying', 'Pre-Qualifying Buildup'], ['qualifying', 'Qualifying'], ['post-qualifying', 'Post-Qualifying'], - ['pre-race', 'Pre-Race Buildup'], ['race', 'Race'], ['post-race', 'Post-Race'], ['highlights', 'Highlights'], - ]; - const SPRINT = [ - ['fp1', 'Free Practice 1'], ['pre-sprint-qualifying', 'Pre-Sprint-Qualifying Buildup'], - ['sprint-qualifying', 'Sprint Qualifying'], ['post-sprint-qualifying', 'Post-Sprint-Qualifying'], - ['pre-sprint', 'Pre-Sprint Buildup'], ['sprint', 'Sprint'], ['post-sprint', 'Post-Sprint'], - ['pre-qualifying', 'Pre-Qualifying Buildup'], ['qualifying', 'Qualifying'], ['post-qualifying', 'Post-Qualifying'], - ['pre-race', 'Pre-Race Buildup'], ['race', 'Race'], ['post-race', 'Post-Race'], ['highlights', 'Highlights'], - ['bonus', 'Bonus Content'], - ]; + const STANDARD = F1.SESSIONS.standard; + const SPRINT = F1.SESSIONS.sprint; const LABEL = Object.fromEntries([...STANDARD, ...SPRINT]); const ALL = Object.keys(LABEL); diff --git a/examples/site.css b/examples/site.css index 3dc88ae..f246bc0 100644 --- a/examples/site.css +++ b/examples/site.css @@ -297,3 +297,59 @@ table.kv th { width: 12rem; } .pages a.page p { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.92rem; } .pages a.page ul { margin: 0; padding-left: 1.1rem; font-size: 0.78rem; } .pages a.page li code { background: none; padding: 0; overflow-wrap: anywhere; } + +/* ---- library ---- */ + +.status.warn::before { content: "! "; color: var(--warn); } +.status.warn { color: var(--warn); } + +.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 1.3rem; margin: 1.5rem 0 0.25rem; } +.crumbs a { text-decoration: none; font-weight: 600; } +.crumbs [aria-current="page"] { font-weight: 700; } +.crumbs .sep { color: var(--muted); } + +.level-head { display: flex; gap: 1.25rem; align-items: flex-start; margin: 0.75rem 0 1rem; } +.level-head .tile { width: 180px; flex: none; } +.level-head h2 { margin-top: 0.25rem; } +.level-head p { margin: 0.3rem 0; color: var(--muted); } + +.tiles { display: grid; gap: 1.25rem 1rem; } +.tiles.posters { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } +.tiles.thumbs { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } + +.tile { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; } +.tile-link { color: var(--text); text-decoration: none; display: flex; flex-direction: column; gap: 0.3rem; } +a.tile-link:hover .tile-frame { outline: 3px solid var(--accent); } +.tile-frame { + position: relative; + background: var(--code-bg); + border: 1px solid var(--line); + border-radius: 8px; + overflow: hidden; + display: grid; + place-items: center; +} +.tile-frame.poster { aspect-ratio: 2 / 3; } +.tile-frame.thumb { aspect-ratio: 16 / 9; } +.tile-frame img { width: 100%; height: 100%; object-fit: cover; display: block; } +.tile-frame .tile-note { font-size: 0.8rem; color: var(--muted); text-align: center; padding: 0.5rem; } +.tile-frame.plain { background: var(--card); padding: 0.75rem; text-align: center; } +.tile-frame.plain strong { display: block; font-size: 1rem; margin-bottom: 0.4rem; } +.tile-frame.plain span { font-size: 0.8rem; color: var(--muted); } +.tile-title { font-weight: 650; line-height: 1.3; } +.tile-sub { font-size: 0.82rem; color: var(--muted); } +.tile .request.compact { padding: 0.25rem 0.35rem; min-height: 0; gap: 0.3rem; } +.tile .request.compact .url { font-size: 0.66rem; } +.tile .request .verb { font-size: 0.62rem; } +.tile .request button, .tile .request a.open { font-size: 0.7rem; padding: 0.1rem 0.4rem; } +.tile .status { font-size: 0.72rem; margin: 0; } + +.spinner { + width: 2.2rem; height: 2.2rem; border-radius: 50%; + border: 4px solid var(--line); border-top-color: var(--accent); + animation: spin 1s linear infinite; flex: none; +} +@keyframes spin { to { transform: rotate(360deg); } } +@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } } +.waiting { display: flex; gap: 1rem; align-items: center; } +.waiting p { margin: 0.2rem 0; } diff --git a/examples/site.js b/examples/site.js index ae9685e..7182355 100644 --- a/examples/site.js +++ b/examples/site.js @@ -535,13 +535,34 @@ return { current }; } + // ---------------------------------------------------------------- sessions of a race weekend + + // Kometa's episode numbering per weekend format: the same maps the service renders from + // (posters_service.py, _SESSION_STD and _SESSION_SPRINT). [slug, label] in episode order. + const SESSIONS = { + standard: [ + ['fp1', 'Free Practice 1'], ['fp2', 'Free Practice 2'], ['fp3', 'Free Practice 3'], + ['pre-qualifying', 'Pre-Qualifying Buildup'], ['qualifying', 'Qualifying'], ['post-qualifying', 'Post-Qualifying'], + ['pre-race', 'Pre-Race Buildup'], ['race', 'Race'], ['post-race', 'Post-Race'], ['highlights', 'Highlights'], + ], + sprint: [ + ['fp1', 'Free Practice 1'], ['pre-sprint-qualifying', 'Pre-Sprint-Qualifying Buildup'], + ['sprint-qualifying', 'Sprint Qualifying'], ['post-sprint-qualifying', 'Post-Sprint-Qualifying'], + ['pre-sprint', 'Pre-Sprint Buildup'], ['sprint', 'Sprint'], ['post-sprint', 'Post-Sprint'], + ['pre-qualifying', 'Pre-Qualifying Buildup'], ['qualifying', 'Qualifying'], ['post-qualifying', 'Post-Qualifying'], + ['pre-race', 'Pre-Race Buildup'], ['race', 'Race'], ['post-race', 'Post-Race'], ['highlights', 'Highlights'], + ['bonus', 'Bonus Content'], + ], + }; + SESSIONS.label = Object.fromEntries([...SESSIONS.standard, ...SESSIONS.sprint]); + window.F1 = { DEFAULT_API, JOLPICA, params, base, api, absolute, path, h, fmtSize, notice, setRequest, setStatus, setHint, call, callJSON, prettyJSON, showJSON, showText, showImage, showGeoJSON, sniff, lineOf, lineLength, circuitTree, layoutPicker, layoutYears, layoutStart, - racePicker, isSprint, jolpicaURL, linkWithKept, + racePicker, isSprint, jolpicaURL, linkWithKept, SESSIONS, }; if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', frame); diff --git a/examples/tracks.html b/examples/tracks.html index b03dee1..eea8801 100644 --- a/examples/tracks.html +++ b/examples/tracks.html @@ -19,6 +19,7 @@ Grand prix lookup Posters Kometa + Library