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