Add unified channel feed

This commit is contained in:
2026-01-08 22:53:30 -05:00
parent 63fe922860
commit 30503628b5
14 changed files with 1319 additions and 1 deletions

View File

@@ -45,6 +45,10 @@
const aboutBtn = document.getElementById("aboutBtn");
const aboutPanel = document.getElementById("aboutPanel");
const aboutCloseBtn = document.getElementById("aboutCloseBtn");
const rssButton = document.getElementById("rssButton");
const rssFeedLink = document.getElementById("rssFeedLink");
const channelListLink = document.getElementById("channelListLink");
const channelCount = document.getElementById("channelCount");
const resultsDiv = document.getElementById("results");
const metaDiv = document.getElementById("meta");
const metricsContainer = document.getElementById("metrics");
@@ -406,6 +410,57 @@
}
}
async function loadChannelListInfo() {
if (!rssFeedLink && !channelListLink && !channelCount) return;
try {
const res = await fetch("/api/channel-list");
const payload = await res.json();
if (rssFeedLink) {
const feedUrl = payload.rss_feed_url || "";
if (feedUrl) {
rssFeedLink.href = feedUrl;
rssFeedLink.textContent = feedUrl;
} else {
rssFeedLink.textContent = "Unavailable";
rssFeedLink.removeAttribute("href");
}
}
if (rssButton) {
const feedUrl = payload.rss_feed_url || "";
if (feedUrl) {
rssButton.href = feedUrl;
rssButton.classList.remove("is-disabled");
rssButton.removeAttribute("aria-disabled");
} else {
rssButton.removeAttribute("href");
rssButton.classList.add("is-disabled");
rssButton.setAttribute("aria-disabled", "true");
}
}
if (channelCount) {
const count = Array.isArray(payload.channels) ? payload.channels.length : 0;
channelCount.textContent = count ? `${count} channels` : "No channels loaded";
}
if (channelListLink && payload.error) {
channelListLink.textContent = "Channel list unavailable";
}
} catch (err) {
console.error("Failed to load channel list", err);
if (rssFeedLink) {
rssFeedLink.textContent = "Unavailable";
rssFeedLink.removeAttribute("href");
}
if (rssButton) {
rssButton.removeAttribute("href");
rssButton.classList.add("is-disabled");
rssButton.setAttribute("aria-disabled", "true");
}
if (channelCount) {
channelCount.textContent = "Channel list unavailable";
}
}
}
function updateUrl(q) {
const next = new URL(window.location.href);
if (q) {
@@ -1732,6 +1787,7 @@ window.addEventListener("popstate", () => {
setFromQuery();
loadMetrics();
loadYears();
loadChannelListInfo();
loadChannels().then(() => runSearch(currentPage));
})();

View File

@@ -21,6 +21,22 @@
</div>
</div>
<div class="window-body">
<div class="window-actions">
<a
id="rssButton"
class="rss-button"
href="/rss"
target="_blank"
rel="noopener"
title="Unified RSS feed"
aria-label="Unified RSS feed"
>
<svg class="rss-button__icon" viewBox="0 0 24 24" aria-hidden="true">
<path d="M6 18a2 2 0 1 0 0 4a2 2 0 0 0 0-4zm-4 6a4 4 0 0 1 4-4a4 4 0 0 1 4 4h-2a2 2 0 0 0-2-2a2 2 0 0 0-2 2zm0-8v-2c6.627 0 12 5.373 12 12h-2c0-5.523-4.477-10-10-10zm0-4V4c11.046 0 20 8.954 20 20h-2c0-9.941-8.059-18-18-18z"/>
</svg>
<span class="rss-button__label">RSS</span>
</a>
</div>
<p>Enter a phrase to query title, description, and transcript text.</p>
<fieldset>
@@ -129,6 +145,15 @@
<p>Use the toggles to choose exact, fuzzy, or phrase matching. Query string mode accepts raw Lucene syntax.</p>
<p>Results are ranked by your chosen sort order; the timeline summarizes the same query.</p>
<p>You can download transcripts, copy MLA citations, or explore references via the graph button.</p>
<div class="about-panel__section">
<div class="about-panel__label">Unified RSS feed</div>
<a id="rssFeedLink" href="#" target="_blank" rel="noopener">Loading…</a>
</div>
<div class="about-panel__section">
<div class="about-panel__label">Channel list</div>
<a id="channelListLink" href="/api/channel-list" target="_blank" rel="noopener">View JSON</a>
<div id="channelCount" class="about-panel__meta"></div>
</div>
</div>
</div>

View File

@@ -510,6 +510,22 @@ body.modal-open {
color: #000;
}
.about-panel__section {
margin-top: 8px;
padding-top: 6px;
border-top: 1px solid #c0c0c0;
}
.about-panel__label {
font-weight: bold;
margin-bottom: 2px;
}
.about-panel__meta {
font-size: 10px;
color: #555;
}
.about-panel__header button {
border: none;
background: transparent;
@@ -549,6 +565,50 @@ body.modal-open {
box-sizing: border-box;
}
.window-actions {
display: flex;
justify-content: flex-end;
margin-bottom: 6px;
}
.rss-button {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 6px;
border: 1px solid;
border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
background: ButtonFace;
color: #000;
text-decoration: none;
font-size: 11px;
cursor: pointer;
}
.rss-button:hover {
background: #f3f3f3;
}
.rss-button:active {
border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
}
.rss-button.is-disabled {
opacity: 0.5;
cursor: default;
pointer-events: none;
}
.rss-button__icon {
width: 14px;
height: 14px;
fill: #f38b00;
}
.rss-button__label {
font-weight: bold;
}
/* Badges */
.badge-row {
margin-top: 6px;