]> Lady’s Gitweb - Status/blob - status.html
Add Lady’s Computer button to pages
[Status] / status.html
1 <!dOcTyPe hTmL>
2 <HTML Lang=en>
3 <TITLE>Status</TITLE>
4 <STYLE>
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 body>footer:Last-Of-Type{ Border-Block-Start: Thin Solid }
15 footer p{ Margin-Block: 0 .5REM }
16 footer time:Not([datetime]),
17 footer small{ Font-Size: Inherit; Font-Style: Italic }
18 </STYLE>
19 <BODY>
20 <FOOTER>
21 <A HRef=https://www.ladys.computer/><IMG Width=88 Height=31 Style="Display: Block; Margin: Auto; Image-Rendering: Pixelated" Src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAAAfCAMAAABUFvrSAAAAAXNSR0IArs4c6QAAADBQTFRF////AAAAGhoaPj4+aGhok5OTvr6+cAAgmSJEs4qW897jH31jLLONOua1UwB0j2YApwkwfQAAAalJREFUSIm1lgGzgiAQhHM1o3sx/f9/++SOg+OAbJpxx0gxP9blxG7LRbot+xW6JzBmCvtjf/yiZwbPzidweE6Vxh6foVPwXsAVUvZAVME8ig51Di6OAao8KCXv8fkQII0D31ttHkyFwrzDK3cQkfSFZQnSwIHbWd1cFA2lgrk3dYVUYdJ04M1od471rvMXWTAKeJmAa3GvHZgJxHlwS1C7EvFHMPB6yWf1USikoFMshEI+cfyX1TmGcUgmEOSIZfIyd+D4lYUOnBlE1HpXMJdbwg7KLWWcDS8+Cp06WN8aO/QBCclu94BwxuwZGDjWSLXojOqzF/RgUBXJb18V02WqYddBesdZLgogRoeKpieiGboDr0aN43Qpb1EaOTo+0iawjsTtN4+0gGM2JrBYkAXcjvT1WnEC5nuI0g7A29rq1HG1qo71wK/H9/f7WC5X3pr1eASO9f5tFIOMD3BdlAvYRpEnr0TxtDMJM6cevLkgvOOm2mDKW9mQ0Trw9NWkNdW8Ru2B3P8PL9PBpVaAP/n1y7S/9LMy+DH9QQLTLxLwVX+xtkt0gC/SP0CwO6Ncy8sUAAAAAElFTkSuQmCC" Alt="Lady’s Computer"></A>
22 </FOOTER>
23 <SCRIPT Type=module>
24 const parser = new DOMParser
25 const index = `${new URL(".", location).toString().slice(0, -1)}.jsonld`
26 fetch(index)
27 .then($ => $.json())
28 .then(meta => {
29 const { items } = meta
30 if (items.find($ => new URL($["@id"]).pathname === location.pathname)) return meta
31 else return fetch(index, { cache: "reload" }).then($ => $.json()) })
32 .then(meta => {
33 const { items, subject } = meta
34 const n = items.findIndex($ => new URL($["@id"]).pathname === location.pathname)
35 const status = items[n]
36 const src = status.content
37 const { documentElement: article } = parser.parseFromString(src, "application/xhtml+xml")
38 const { creator, created, title } = status
39 document.title = creator
40 ? `Status by ${creator.name} @ ${status.created}`
41 : `Status @ ${created}`
42 const header = document.createElement("header")
43 const footer = document.createElement("footer")
44 const headerChildren =
45 [ "A(n) "
46 , subject
47 ? (subjectLink => {
48 subjectLink.textContent = subject
49 subjectLink.href = meta["@id"]
50 return subjectLink })(document.createElement("a"))
51 : "status"
52 , " update" ]
53 if (creator) {
54 const authorLink = document.createElement("@id" in creator ? "a" : "span")
55 if (authorLink.localName == "a") authorLink.href = creator["@id"]
56 authorLink.textContent = creator.name
57 headerChildren.push(" by ", authorLink, "…") }
58 else headerChildren.push("…")
59 header.append(...headerChildren)
60 const timestampP = footer.appendChild(document.createElement("p"))
61 timestampP.appendChild(document.createElement("time")).textContent = created
62 footer
63 .appendChild(document.createElement("p"))
64 .appendChild(document.createElement("small"))
65 .textContent = status.identifier
66 const nav = footer.appendChild(document.createElement("nav"))
67 nav.appendChild(document.createTextNode("Up: "))
68 const upLink = nav.appendChild(document.createElement("a"))
69 upLink.href = meta["@id"]
70 upLink.textContent = meta.subject || meta["@id"].split("/").pop()
71 if (n > 0) {
72 nav.appendChild(document.createTextNode("; Previous: "))
73 const prevLink = nav.appendChild(document.createElement("a"))
74 prevLink.href = items[n - 1]["@id"]
75 const { title: prevTitle } = items[n - 1]
76 if (prevTitle) prevLink.textContent = prevTitle.length > 28
77 ? "".concat(...prevTitle.slice(0, 27), "…")
78 : prevTitle
79 else {
80 const prevText = (() => {
81 try {
82 const prevD = parser.parseFromString(items[n - 1].content, "application/xhtml+xml")
83 const div = document.createElement("div")
84 div.appendChild(document.importNode(prevD.documentElement, true))
85 Object.assign(div.style,
86 { position: "absolute"
87 , top: "-2px"
88 , height: "1px"
89 , width: "1px"
90 , overflow: "hidden" })
91 document.body.appendChild(div)
92 const text = div.innerText
93 document.body.removeChild(div)
94 return text }
95 catch { } })() ?? items[n + 1].created;
96 const prevChars = Array.from(prevText.trim().replaceAll(/\s+/gu, " "))
97 prevLink.textContent = prevChars.length > 28
98 ? "".concat(...prevChars.slice(0, 27), "…")
99 : prevText } }
100 if (n < items.length - 1) {
101 nav.appendChild(document.createTextNode("; Next: "))
102 const nextLink = nav.appendChild(document.createElement("a"))
103 nextLink.href = items[n + 1]["@id"]
104 const { title: nextTitle } = items[n + 1]
105 if (nextTitle) nextLink.textContent = nextTitle.length > 28
106 ? "".concat(...nextTitle.slice(0, 27), "…")
107 : nextTitle
108 else {
109 const nextText = (() => {
110 try {
111 const nextD = parser.parseFromString(items[n + 1].content, "application/xhtml+xml")
112 const div = document.createElement("div")
113 div.appendChild(document.importNode(nextD.documentElement, true))
114 Object.assign(div.style,
115 { position: "absolute"
116 , top: "-2px"
117 , height: "1px"
118 , width: "1px"
119 , overflow: "hidden" })
120 document.body.appendChild(div)
121 const text = div.innerText
122 document.body.removeChild(div)
123 return text }
124 catch { } })() ?? items[n + 1].created;
125 const nextChars = Array.from(nextText.trim().replaceAll(/\s+/gu, " "))
126 nextLink.textContent = nextChars.length > 28
127 ? "".concat(...nextChars.slice(0, 27), "…")
128 : nextText } }
129 nav.appendChild(document.createTextNode("."))
130 if (title) {
131 const wrapper = document.createElement("article")
132 const details = wrapper.appendChild(document.createElement("details"))
133 details.setAttribute("open", "")
134 const summary = details.appendChild(document.createElement("summary"))
135 summary.textContent = title
136 details.append(...document.importNode(article, true).childNodes)
137 document.body.replaceChildren(header, wrapper, footer, document.body.querySelector("footer")) }
138 else document.body.replaceChildren(header, document.importNode(article, true), footer, document.body.querySelector("footer")) })
139 </SCRIPT>
This page took 0.060252 seconds and 5 git commands to generate.