]> Lady’s Gitweb - x_status_git/blob - index.html
b31518373d780680e979d27d779da495b8550818
[x_status_git] / index.html
1 <!dOcTyPe html>
2 <HTML Lang=en>
3 <TITLE>Index</TITLE>
4 <STYLE>
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 footer{ Border-Block-Start: Thin Solid; Padding-Block: 1REM; Font-Size: Smaller; Text-Align: End }
12 footer p{ Margin-Block: 0 .5REM }
13 footer time:Not([datetime]),
14 footer small{ Font-Size: Inherit; Font-Style: Italic }
15 </STYLE>
16 <H1>Index</H1>
17 <DIV Class=STATUS ID=status>
18 </DIV>
19 <SECTION ID=topics>
20 <H2>Topics</H2>
21 </SECTION>
22 <SCRIPT Type=module>
23 const parser = new DOMParser
24 document.title = location.hostname
25 document.documentElement.querySelector("body>h1").textContent = location.hostname
26 const renderLatest = (path, container) => fetch(`${path}.jsonld`)
27 .then($ => $.json())
28 .then(meta => {
29 const { items } = meta
30 const status = items.pop()
31 const src = status.content
32 const { documentElement: article } = parser.parseFromString(src, "application/xhtml+xml")
33 const footer = document.createElement("footer")
34 const authorshipP = footer.appendChild(document.createElement("p"))
35 const { creator } = status
36 if (creator) {
37 const authorLink = authorshipP.appendChild(document.createElement("a"))
38 authorLink.href = creator["@id"]
39 authorLink.textContent = creator.name
40 authorshipP.appendChild(document.createTextNode(" @ ")) }
41 authorshipP.appendChild(document.createElement("time")).textContent = status.created
42 const nav = footer.appendChild(document.createElement("nav"))
43 const permalink = nav.appendChild(document.createElement("a"))
44 permalink.href = status["@id"]
45 permalink.textContent = "Permalink."
46 nav.appendChild(document.createTextNode(" "))
47 const upLink = nav.appendChild(document.createElement("a"))
48 upLink.href = meta["@id"]
49 upLink.textContent = `See more ${ status.subject ? `“${status.subject}” posts` : "statuses" }.`
50 container.replaceChildren(document.importNode(article, true), footer) })
51 fetch("statuses.jsonld")
52 .then($ => $.json())
53 .then(meta => renderLatest(meta.current, document.getElementById("status")))
54 fetch("topics.jsonld")
55 .then($ => $.json())
56 .then(meta => {
57 const topics = document.getElementById("topics")
58 for (const topicID of meta.items.map($ => $["@id"] ?? $)) {
59 const section = topics.appendChild(document.createElement("section"))
60 fetch(`${topicID}.jsonld`)
61 .then($ => $.json())
62 .then(topic => {
63 section.appendChild(document.createElement("h3")).textContent = topic.subject
64 const div = section.appendChild(document.createElement("div"))
65 div.className = "STATUS"
66 renderLatest(new URL(topic["@id"]).pathname, div)
67 }) } })
68 </SCRIPT>
This page took 0.051875 seconds and 3 git commands to generate.