#topics h2{ Margin-Block-End: 0; Grid-Column: 1 / Span 2; Text-Align: Center }
#topics h2:Last-Child{ Display: None }
div.STATUS{ Border: Thin Solid; Padding-Inline: 1REM; Border-Radius: .5REM }
+summary{ Padding-Block: 1REM; Font-Weight: Bold }
+details[open]>summary{ Border-Block-End: Thin Solid }
footer{ Border-Block-Start: Thin Solid; Padding-Block: 1REM; Font-Size: Smaller; Text-Align: End }
footer p{ Margin-Block: 0 .5REM }
footer time:Not([datetime]),
footer small{ Font-Size: Inherit; Font-Style: Italic }
+svg{ Display: Inline-Block; Vertical-Align: Middle; Block-Size: 1EM; Inline-Size: 1EM; Fill: #FFF }
</STYLE>
<H1>Index</H1>
<DIV Class=STATUS ID=status>
<SECTION ID=topics>
<H2>Topics</H2>
</SECTION>
+<DIV Hidden><SVG ID=feedicon Version=1.1 ViewBox="0 0 256 256"><RECT Width=256 Height=256 RX=55 RY=55 X=0 Y=0 Fill=CurrentColor /><RECT Width=236 Height=236 RX=47 RY=47 X=10 Y=10 Style="Fill: Inherit" /><CIRCLE CX=68 CY=189 R=24 Fill=CurrentColor /><PATH D="M 160 213 h -34 a 82 82 0 0 0 -82 -82 v -34 a 116 116 0 0 1 116 116 z" Fill=CurrentColor /><PATH D="M 184 213 A 140 140 0 0 0 44 73 V 38 a 175 175 0 0 1 175 175 z" Fill=CurrentColor /></SVG>
<SCRIPT Type=module>
const parser = new DOMParser
document.title = location.hostname
document.documentElement.querySelector("body>h1").textContent = location.hostname
-const renderLatest = (path, container) => fetch(`${path}.jsonld`)
-.then($ => $.json())
-.then(meta => {
- const { items } = meta
+const renderLatest = (meta, container) => {
+ const { feed, items } = meta
const status = items.pop()
const src = status.content
const { documentElement: article } = parser.parseFromString(src, "application/xhtml+xml")
const footer = document.createElement("footer")
const authorshipP = footer.appendChild(document.createElement("p"))
- const { creator } = status
+ const { creator, title } = status
if (creator) {
const authorLink = authorshipP.appendChild(document.createElement("a"))
authorLink.href = creator["@id"]
authorshipP.appendChild(document.createTextNode(" @ ")) }
authorshipP.appendChild(document.createElement("time")).textContent = status.created
const nav = footer.appendChild(document.createElement("nav"))
+ const atomLink = nav.appendChild(document.createElement("a"))
+ atomLink.href = feed
+ const atomSVG = document.createElementNS("http://www.w3.org/2000/svg", "svg")
+ atomSVG.setAttribute("version", "1.1")
+ atomSVG.setAttribute("viewBox", "0 0 256 256")
+ const atomUse = atomSVG.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "use"))
+ atomUse.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#feedicon")
+ atomLink.append(atomSVG, " Atom feed.")
+ nav.appendChild(document.createTextNode(" "))
const permalink = nav.appendChild(document.createElement("a"))
permalink.href = status["@id"]
permalink.textContent = "Permalink."
nav.appendChild(document.createTextNode(" "))
const upLink = nav.appendChild(document.createElement("a"))
upLink.href = meta["@id"]
- upLink.textContent = `See more ${ status.subject ? `“${status.subject}” posts` : "statuses" }.`
- container.replaceChildren(document.importNode(article, true), footer) })
+ upLink.textContent = `See more ${ status.subject ? `${status.subject}` : "status" } updates.`
+ if (title) {
+ const wrapper = document.createElement("article")
+ const details = wrapper.appendChild(document.createElement("details"))
+ details.setAttribute("open", "")
+ const summary = details.appendChild(document.createElement("summary"))
+ summary.textContent = title
+ details.append(...document.importNode(article, true).childNodes)
+ container.replaceChildren(wrapper, footer) }
+ else container.replaceChildren(document.importNode(article, true), footer) }
fetch("statuses.jsonld")
.then($ => $.json())
-.then(meta => renderLatest(meta.current, document.getElementById("status")))
+.then(meta => fetch(`${meta.current}.jsonld`))
+.then($ => $.json())
+.then(meta => renderLatest(meta, document.getElementById("status")))
fetch("topics.jsonld")
.then($ => $.json())
.then(meta => {
section.appendChild(document.createElement("h3")).textContent = topic.subject
const div = section.appendChild(document.createElement("div"))
div.className = "STATUS"
- renderLatest(new URL(topic["@id"]).pathname, div)
- }) } })
+ renderLatest(topic, div) }) } })
</SCRIPT>