]> Lady’s Gitweb - Status/blob - topic.html
Apply basic lady branding
[Status] / topic.html
1 <!dOcTyPe html>
2 <META Charset=utf-8>
3 <TITLE>Topic Feed</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 </STYLE>
9 <H1>Topic Feed</H1>
10 <NAV><P><A HRef=/>Home</A></P><DL></DL></NAV>
11 <SCRIPT Type=module>
12 const nav = document.body.querySelector("nav")
13 const dl = nav.querySelector("dl")
14 const parser = new DOMParser
15 fetch(`${location}.jsonld`)
16 .then($ => $.json())
17 .then(meta => {
18 const topic = meta.subject || meta["@id"].split("/").pop()
19 document.title = topic
20 document.body.querySelector("h1").textContent = "subject" in meta
21 ? `#${topic}`
22 : `@${topic}`
23 if ("subject" in meta) {
24 const a = nav
25 .insertBefore(document.createElement("p"), dl)
26 .appendChild(document.createElement("a"))
27 a.href = "/topics"
28 a.textContent = "Topics" }
29 const { first, prev, next, current, items } = meta
30 if (first && first != location && first != prev) {
31 const a = nav
32 .insertBefore(document.createElement("p"), dl)
33 .appendChild(document.createElement("a"))
34 a.href = first
35 a.textContent = "First Page" }
36 if (prev) {
37 const a = nav
38 .insertBefore(document.createElement("p"), dl)
39 .appendChild(document.createElement("a"))
40 a.href = prev
41 a.textContent = "Previous Page" }
42 let prevDate = undefined
43 for (const status of items) {
44 if (status.created != prevDate) dl.appendChild(document.createElement("dt")).textContent = status.created
45 const a = dl
46 .appendChild(document.createElement("dd"))
47 .appendChild(document.createElement("a"))
48 a.href = status["@id"]
49 const { title } = status
50 if (title) a.textContent = title.length > 28
51 ? "".concat(...title.slice(0, 27), "…")
52 : title
53 else {
54 const summaryText = (() => {
55 try {
56 const d = parser.parseFromString(status.content, "application/xhtml+xml")
57 const div = document.createElement("div")
58 div.appendChild(document.importNode(d.documentElement, true))
59 Object.assign(div.style,
60 { position: "absolute"
61 , top: "-2px"
62 , height: "1px"
63 , width: "1px"
64 , overflow: "hidden" })
65 document.body.appendChild(div)
66 const text = div.innerText
67 document.body.removeChild(div)
68 return text }
69 catch { } })() || "";
70 const chars = Array.from(summaryText.trim().replaceAll(/\s+/gu, " "))
71 a.textContent = chars.length > 28
72 ? "".concat(...chars.slice(0, 27), "…")
73 : summaryText || status.identifier } }
74 if (next) {
75 const a = nav
76 .appendChild(document.createElement("p"))
77 .appendChild(document.createElement("a"))
78 a.href = next
79 a.textContent = "Next Page" }
80 if (current && current != location && current != next) {
81 const a = nav
82 .appendChild(document.createElement("p"))
83 .appendChild(document.createElement("a"))
84 a.href = current
85 a.textContent = "Latest Page" } })
86 </SCRIPT>
This page took 0.106083 seconds and 5 git commands to generate.