// Delegated listeners, not inline onclick="" attributes: production's // Content Security Policy (config/settings/prod.py, script-src 'self') // blocks inline event handlers, which silently turned the title click into // a plain link to the detail page and the new-articles banner into a no-op. function toggleArticle(link) { var row = link.closest("li.article-row"); var body = row.querySelector(".article-inline-body"); var wasOpen = row.classList.contains("is-expanded"); document.querySelectorAll("li.article-row.is-expanded").forEach(function (openRow) { openRow.classList.remove("is-expanded"); var openBody = openRow.querySelector(".article-inline-body"); if (openBody) { openBody.hidden = true; } }); if (!wasOpen) { row.classList.add("is-expanded"); body.hidden = false; if (!body.dataset.loaded) { body.dataset.loaded = "1"; htmx.ajax("GET", link.dataset.inlineUrl, { target: body, swap: "innerHTML" }).then( function () { row.classList.add("is-read"); } ); } } } document.addEventListener("click", function (event) { var link = event.target.closest("a.article-title[data-inline-url]"); if (link) { // Leave modified clicks alone so "open in new tab" still works. if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) { return; } event.preventDefault(); toggleArticle(link); return; } var banner = event.target.closest(".new-articles-banner"); if (banner) { // Reloading keeps the current filter/tag/feed in the URL; from any // other page (settings, search) go to the stream instead. if (location.pathname === banner.dataset.streamUrl) { location.reload(); } else { location.href = banner.dataset.streamUrl; } } });