5 html{ Color: #E3E3E3; Background: #
700020; Font-Family: UI-Rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', 'Arial Rounded MT Bold', Calibri, Sans-Serif; Line-Height:
1.5; Text-Shadow: Calc(
1EM /
12) Calc(
1EM /
12) #
000000 }
6 body{ Display: Grid; Box-Sizing: Border-Box; Margin: Auto; Padding-Inline:
1CH; Min-Block-Size:
100VH; Inline-Size:
100%; Max-Inline-Size:
48REM; Align-Content: Center; Justify-Content: Stretch }
7 :Any-Link{ Color: #
87E6DD }
8 article{ Border: Thin Solid; Padding-Inline:
1REM; Border-Radius:
.5REM; Color: #F3DEE3; Background: #
1A1A1A; Font-Size: Larger; Text-Shadow: None }
9 article :Any-Link{ Color: #D6B7BF }
10 summary{ Padding-Block:
1REM; Font-Weight: Bold }
11 details[open]
>summary{ Border-Block-End: Thin Solid }
12 header{ Padding-Block:
1REM; Text-Align: Start }
13 footer{ Padding-Block:
1REM; Text-Align: End }
14 footer p{ Margin-Block:
0 .5REM }
15 footer time:Not([datetime]),
16 footer small{ Font-Size: Inherit; Font-Style: Italic }
20 const parser = new DOMParser
21 const index = `${new URL(
".", location).toString().slice(
0, -
1)}.jsonld`
25 const { items } = meta
26 if (items.find($ =
> new URL($[
"@id"]).pathname === location.pathname)) return meta
27 else return fetch(index, { cache:
"reload" }).then($ =
> $.json()) })
29 const { items, subject } = meta
30 const n = items.findIndex($ =
> new URL($[
"@id"]).pathname === location.pathname)
31 const status = items[n]
32 const src = status.content
33 const { documentElement: article } = parser.parseFromString(src,
"application/xhtml+xml")
34 const { creator, created, title } = status
35 document.title = creator
36 ? `Status by ${creator.name} @ ${status.created}`
37 : `Status @ ${created}`
38 const header = document.createElement(
"header")
39 const footer = document.createElement(
"footer")
40 const headerChildren =
44 subjectLink.textContent = subject
45 subjectLink.href = meta[
"@id"]
46 return subjectLink })(document.createElement(
"a"))
50 const authorLink = document.createElement(
"@id" in creator ?
"a" :
"span")
51 if (authorLink.localName ==
"a") authorLink.href = creator[
"@id"]
52 authorLink.textContent = creator.name
53 headerChildren.push(
" by ", authorLink,
"…") }
54 else headerChildren.push(
"…")
55 header.append(...headerChildren)
56 const timestampP = footer.appendChild(document.createElement(
"p"))
57 timestampP.appendChild(document.createElement(
"time")).textContent = created
59 .appendChild(document.createElement(
"p"))
60 .appendChild(document.createElement(
"small"))
61 .textContent = status.identifier
62 const nav = footer.appendChild(document.createElement(
"nav"))
63 nav.appendChild(document.createTextNode(
"Up: "))
64 const upLink = nav.appendChild(document.createElement(
"a"))
65 upLink.href = meta[
"@id"]
66 upLink.textContent = meta.subject || meta[
"@id"].split(
"/").pop()
68 nav.appendChild(document.createTextNode(
"; Previous: "))
69 const prevLink = nav.appendChild(document.createElement(
"a"))
70 prevLink.href = items[n -
1][
"@id"]
71 const { title: prevTitle } = items[n -
1]
72 if (prevTitle) prevLink.textContent = prevTitle.length
> 28
73 ?
"".concat(...prevTitle.slice(
0,
27),
"…")
76 const prevText = (() =
> {
78 const prevD = parser.parseFromString(items[n -
1].content,
"application/xhtml+xml")
79 const div = document.createElement(
"div")
80 div.appendChild(document.importNode(prevD.documentElement, true))
81 Object.assign(div.style,
82 { position:
"absolute"
86 , overflow:
"hidden" })
87 document.body.appendChild(div)
88 const text = div.innerText
89 document.body.removeChild(div)
91 catch { } })() ?? items[n +
1].created;
92 const prevChars = Array.from(prevText.trim().replaceAll(/\s+/gu,
" "))
93 prevLink.textContent = prevChars.length
> 28
94 ?
"".concat(...prevChars.slice(
0,
27),
"…")
96 if (n < items.length -
1) {
97 nav.appendChild(document.createTextNode(
"; Next: "))
98 const nextLink = nav.appendChild(document.createElement(
"a"))
99 nextLink.href = items[n +
1][
"@id"]
100 const { title: nextTitle } = items[n +
1]
101 if (nextTitle) nextLink.textContent = nextTitle.length
> 28
102 ?
"".concat(...nextTitle.slice(
0,
27),
"…")
105 const nextText = (() =
> {
107 const nextD = parser.parseFromString(items[n +
1].content,
"application/xhtml+xml")
108 const div = document.createElement(
"div")
109 div.appendChild(document.importNode(nextD.documentElement, true))
110 Object.assign(div.style,
111 { position:
"absolute"
115 , overflow:
"hidden" })
116 document.body.appendChild(div)
117 const text = div.innerText
118 document.body.removeChild(div)
120 catch { } })() ?? items[n +
1].created;
121 const nextChars = Array.from(nextText.trim().replaceAll(/\s+/gu,
" "))
122 nextLink.textContent = nextChars.length
> 28
123 ?
"".concat(...nextChars.slice(
0,
27),
"…")
125 nav.appendChild(document.createTextNode(
"."))
127 const wrapper = document.createElement(
"article")
128 const details = wrapper.appendChild(document.createElement(
"details"))
129 details.setAttribute(
"open",
"")
130 const summary = details.appendChild(document.createElement(
"summary"))
131 summary.textContent = title
132 details.append(...document.importNode(article, true).childNodes)
133 document.body.replaceChildren(header, wrapper, footer) }
134 else document.body.replaceChildren(header, document.importNode(article, true), footer) })