5 body{ Display: Grid; Box-Sizing: Border-Box; Margin: Auto; Padding-Inline:
1REM; Min-Block-Size:
100VH; Inline-Size:
100%; Max-Inline-Size:
45REM; Align-Content: Center; Justify-Content: Stretch; Font-Family: Sans-Serif }
6 #status{ Font-Size: Larger }
7 #topics{ Display: Grid; Margin-Block:
1REM; Grid: Auto-Flow /
1FR
1FR; Gap:
0 1REM }
8 #topics h2{ Margin-Block-End:
0; Grid-Column:
1 / Span
2; Text-Align: Center }
9 #topics h2:Last-Child{ Display: None }
10 div.STATUS{ Border: Thin Solid; Padding-Inline:
1REM; Border-Radius:
.5REM }
11 summary{ Padding-Block:
1REM; Font-Weight: Bold }
12 details[open]
>summary{ Border-Block-End: Thin Solid }
13 footer{ Border-Block-Start: Thin Solid; Padding-Block:
1REM; Font-Size: Smaller; Text-Align: End }
14 footer p{ Margin-Block:
0 .5REM }
15 footer time:Not([datetime]),
16 footer small{ Font-Size: Inherit; Font-Style: Italic }
17 svg{ Display: Inline-Block; Vertical-Align: Middle; Block-Size:
1EM; Inline-Size:
1EM; Fill: #FFF }
20 <DIV Class=STATUS ID=status
>
25 <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>
27 const parser = new DOMParser
28 document.title = location.hostname
29 document.documentElement.querySelector("body
>h1").textContent = location.hostname
30 const renderLatest = (meta, container) =
> {
31 const { feed, items } = meta
32 const status = items.pop()
33 const src = status.content
34 const { documentElement: article } = parser.parseFromString(src, "application/xhtml+xml")
35 const footer = document.createElement("footer")
36 const authorshipP = footer.appendChild(document.createElement("p"))
37 const { creator, title } = status
39 const authorLink = authorshipP.appendChild(document.createElement("a"))
40 authorLink.href = creator["@id"]
41 authorLink.textContent = creator.name
42 authorshipP.appendChild(document.createTextNode(" @ ")) }
43 authorshipP.appendChild(document.createElement("time")).textContent = status.created
44 const nav = footer.appendChild(document.createElement("nav"))
45 const atomLink = nav.appendChild(document.createElement("a"))
47 const atomSVG = document.createElementNS("http://www.w3.org/
2000/svg", "svg")
48 atomSVG.setAttribute("version", "
1.1")
49 atomSVG.setAttribute("viewBox", "
0 0 256 256")
50 const atomUse = atomSVG.appendChild(document.createElementNS("http://www.w3.org/
2000/svg", "use"))
51 atomUse.setAttributeNS("http://www.w3.org/
1999/xlink", "xlink:href", "#feedicon")
52 atomLink.append(atomSVG, " Atom feed.")
53 nav.appendChild(document.createTextNode(" "))
54 const permalink = nav.appendChild(document.createElement("a"))
55 permalink.href = status["@id"]
56 permalink.textContent = "Permalink."
57 nav.appendChild(document.createTextNode(" "))
58 const upLink = nav.appendChild(document.createElement("a"))
59 upLink.href = meta["@id"]
60 upLink.textContent = `See more ${ status.subject ? `${status.subject}` : "status" } updates.`
62 const wrapper = document.createElement("article")
63 const details = wrapper.appendChild(document.createElement("details"))
64 details.setAttribute("open", "")
65 const summary = details.appendChild(document.createElement("summary"))
66 summary.textContent = title
67 details.append(...document.importNode(article, true).childNodes)
68 container.replaceChildren(wrapper, footer) }
69 else container.replaceChildren(document.importNode(article, true), footer) }
70 fetch("statuses.jsonld")
72 .then(meta =
> fetch(`${meta.current}.jsonld`))
74 .then(meta =
> renderLatest(meta, document.getElementById("status")))
75 fetch("topics.jsonld")
78 const topics = document.getElementById("topics")
79 for (const topicID of meta.items.map($ =
> $["@id"] ?? $)) {
80 const section = topics.appendChild(document.createElement("section"))
81 fetch(`${topicID}.jsonld`)
84 section.appendChild(document.createElement("h3")).textContent = topic.subject
85 const div = section.appendChild(document.createElement("div"))
86 div.className = "STATUS"
87 renderLatest(topic, div) }) } })