From 92d27365cadbd98e6d709673cd0729de8793c494 Mon Sep 17 00:00:00 2001 From: jade (winter) Date: Fri, 5 Dec 2025 00:34:03 +0000 Subject: initial commit --- index.php | 36 +++++++ lib/bbcnext.php | 109 +++++++++++++++++++++ lib/rms.php | 10 ++ search.php | 3 + theme/Brutalist/main.css | 198 +++++++++++++++++++++++++++++++++++++ theme/Default/main.css | 250 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 606 insertions(+) create mode 100644 index.php create mode 100644 lib/bbcnext.php create mode 100644 lib/rms.php create mode 100644 search.php create mode 100644 theme/Brutalist/main.css create mode 100644 theme/Default/main.css diff --git a/index.php b/index.php new file mode 100644 index 0000000..b4a98e7 --- /dev/null +++ b/index.php @@ -0,0 +1,36 @@ + [ + 'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36', +]]); +?> + + + + + + + + + + + + +
+ RMS Frontend +
+ + +
+
+ +
+ +
+ + diff --git a/lib/bbcnext.php b/lib/bbcnext.php new file mode 100644 index 0000000..988d248 --- /dev/null +++ b/lib/bbcnext.php @@ -0,0 +1,109 @@ +data); +} + +function next_renderExperience(array $modules) { + foreach ($modules as $m) { + next_renderModule($m); + } +} + +function next_renderModule(stdClass $module) { + $type = strtr($module->type, '_', '-'); + $titleTag = $type == 'inline-header-module' ? 'h1' : 'h2'; + echo "<$type id=\"$module->id\" module-style=\"$module->style\">"; + echo "<$titleTag>" + . htmlspecialchars($module->title ?? '[no title]') + . ""; + if (isset($module->description)) { + echo '' + . htmlspecialchars($module->description) + . ''; + } + echo ''; + if (!is_array($module->data)) { + next_renderItem($module->data); + } else { + foreach ($module->data as $item) { + next_renderItem($item); + } + } + echo ""; +} + +function next_renderItem(stdClass $item) { + $type = strtr($item->type, '_', '-'); + $primaryTag = $type == 'segment-item' ? 'primary-title' : 'h3'; + echo "<$type id=\"$item->id\">"; + echo ''; + echo "<$primaryTag>" + . htmlspecialchars($item->titles?->primary ?? '[no primary]') + . ""; + if (isset($item->network)) { + echo '' + . htmlspecialchars($item->network->short_title) + . ''; + } + echo ''; + if (isset($item->titles->secondary)) { + echo '' + . htmlspecialchars($item->titles->secondary) + . ''; + } + if (isset($item->titles->tertiary)) { + echo '' + . htmlspecialchars($item->titles->tertiary) + . ''; + } + echo ''; + if (isset($item->synopses?->short, $item->synopses?->medium)) { + echo '
' + . htmlspecialchars($item->synopses->short) + . '' + . htmlspecialchars($item->synopses->long ?? $item->synopses->medium) + . '
'; + } elseif (isset($item->synopses?->short)) { + echo '' . htmlspecialchars($item->synopses->short) + . ''; + } + + if (isset($item->item)) { + next_renderItem($item->item); + } + + if (isset($item->offset)) { + echo '' + . gmdate('H:i:s', $item->offset->start) + . ''; + echo '' + . gmdate('H:i:s', $item->offset->end) + . ''; + } + + if ($type == 'container-item') { + $href = '?path=' . RMS_SOUNDS_CONTAINER . '/' . $item->urn; + echo "View"; + } elseif ($type == 'playable-item') { + $pid = explode(':', $item->urn)[4]; + $href = '?path=' . RMS_SOUNDS_PLAYABLE . '/' . $pid; + echo "Listen"; + } + + foreach ($item->uris ?? [] as $uri) { + if ($uri->type != 'link') continue; + echo '' + . htmlspecialchars($uri->label) . ''; + } + + if (isset($item->download) && $item->download->type == 'non_drm') { + $variant = $item->download->quality_variants->high; + echo '' + . "Download ($variant->label)"; + } + + echo ""; +} diff --git a/lib/rms.php b/lib/rms.php new file mode 100644 index 0000000..1e76d53 --- /dev/null +++ b/lib/rms.php @@ -0,0 +1,10 @@ + * { + padding: 8px; + } + + a { + background: linear-gradient(to right, #ca9a7a, #963); + display: block; + color: white; + font-weight: bold; + width: max-content; + font-size: 0; + &::after { + font-size: 16pt; + content: 'BBC Sounds'; + } + } +} + +inline-display-module { + display: flex; + flex-direction: column; + + h2 { + text-align: center; + margin: 0; + background: linear-gradient(to bottom, #ffeeca, #efba99); + padding: 8px; + border-top: 1px solid #daaa55; + margin-top: 16px; + } + + item-titles { + display: grid; + background: linear-gradient(to bottom, #fefefe, #efefef); + padding: 8px; + gap: 4px; + border-top: 2px solid #eee; + border-bottom: 1px solid #eee; + } + item-first-titles { + grid-row: 1; + display: grid; + grid-auto-flow: column; + grid-auto-columns: 1fr auto; + align-items: baseline; + } + h3 { + margin: 0; + } + + item-network { + grid-row: 1; + grid-column: 2; + } + secondary-title { + font-weight: bold; + grid-row: 2; + grid-column: 1; + } + tertiary-title { + grid-row: 3; + grid-column: 1; + } + + module-description, synopsis { + white-space: pre-wrap; + margin: 8px; + display: block; + } + + details { + summary { + list-style: none; + &::after { + font-weight: bold; + content: ' More…'; + } + } + &[open] summary { + font-size: 0; + &::after { + font-size: 10pt; + content: 'Less…'; + } + } + } + + a { + display: block; + background: #efefef; + padding: 4px; + text-align: center; + font-weight: bold; + } +} + +inline-header-module { + display: block; + padding: 16px; + text-align: center; + module-items { + display: none; + } +} + +#listen_sign_in_upsell { +h2 { margin-top: 0; } +module-description::after { + display: block; + margin-top: 8px; + content: "Please note this is an unofficial frontend to BBC services and is not affiliated with or endorsed by the BBC in any way."; +} +} +inline-display-module:first-child h2 { margin-top: 0; } + +#listen_live { +overflow-x: scroll; + +module-description { + display: none; +} + +h2 { + position: sticky; + left: 0; +} + +playable-item { + display: block; + border-right: 1px solid #ccc; + width: 300px; + background: #eee; +} + +module-items { + display: flex; + flex-direction: row; + overflow-x: scroll; + border-bottom: 1px solid #ccc; + width: max-content; +} +} + +#single_item_promo { +margin: 32px; +border: 1px solid #963; +border-radius: 4px; +overflow: clip; +> module-items > display-item > item-titles { + background: #ffeecb; + border: none; +} +h2 { display: none; } +} + +#categories { +display: flex; + +container-item { + display: flex; + align-items: baseline; + background: #efefef; + border-top: 1px solid #fec; + border-bottom: 1px solid #aaa; + + item-titles { + background: none; + border: none; + } + + a { + font-size: 0; + &::after { + font-size: 10pt; + content: "view category »" + } + } +} +} + +segment-item { + display: grid; + grid-template-columns: 1fr auto auto; + align-items: baseline; + padding: 0 8px 0 0; + background: linear-gradient(to bottom, #fff, #f8f8f8); + border-bottom: 1px solid #ccc; + + item-titles { + background: none; + border: none; + } + + primary-title { + grid-row: 1; + grid-column: 1; + } + secondary-title { + grid-row: 2; + grid-column: 1; + } + tertiary-title { + white-space: pre-wrap; + font-size: 8pt; + } + offset-start { + grid-row: 1; + grid-column: 2; + &::after { + content: '—'; + } + } + offset-end { + grid-row: 1; + grid-column: 3; + } +} -- cgit v1.3