]> Lady’s Gitweb - Status/blob - index.html
Improve styling on topic pages
[Status] / index.html
1 <!dOcTyPe html>
2 <HTML Lang=en>
3 <TITLE>Index</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 #topics{ Display: Grid; Margin-Block: 1REM; Grid: Auto-Flow / 1FR 1FR; Gap: 0 1REM }
9 #topics h2{ Margin-Block-End: 0; Grid-Column: 1 / Span 2; Text-Align: Center }
10 #topics h2:Last-Child{ Display: None }
11 div.STATUS{ Border: Thin Solid; Padding-Inline: 1REM; Border-Radius: .5REM; Color: #F3DEE3; Background: #1A1A1A; Font-Size: Larger; Text-Shadow: None }
12 div.STATUS :Any-Link{ Color: #D6B7BF }
13 summary{ Padding-Block: 1REM; Font-Weight: Bold }
14 details[open]>summary{ Border-Block-End: Thin Solid }
15 footer{ Border-Block-Start: Thin Solid; Padding-Block: 1REM; Font-Size: Smaller; Text-Align: End }
16 footer p{ Margin-Block: 0 .5REM }
17 footer time:Not([datetime]),
18 footer small{ Font-Size: Inherit; Font-Style: Italic }
19 svg{ Display: Inline-Block; Vertical-Align: Middle; Block-Size: 1EM; Inline-Size: 1EM; Color: #F3DEE3; Fill: #1A1A1A }
20 :Any-Link svg{ Color: #D6B7BF }
21 svg#feedicon{ Color: #EAB783; Fill: #D11800 }
22 </STYLE>
23 <H1>Index</H1>
24 <DIV Class=STATUS ID=status>
25 </DIV>
26 <SECTION ID=topics>
27 <H2>Topics</H2>
28 </SECTION>
29 <DIV Hidden><SVG ID=feedicon Version=1.1 ViewBox="0 0 256 256"><RECT Width=256 Height=256 RX=55 RY=55 X=0 Y=0 Fill=CurrentColor /><RECT Width=236 Height=236 RX=47 RY=47 X=10 Y=10 Style="Fill: Inherit" /><CIRCLE CX=68 CY=189 R=24 Fill=CurrentColor /><PATH D="M 160 213 h -34 a 82 82 0 0 0 -82 -82 v -34 a 116 116 0 0 1 116 116 z" Fill=CurrentColor /><PATH D="M 184 213 A 140 140 0 0 0 44 73 V 38 a 175 175 0 0 1 175 175 z" Fill=CurrentColor /></SVG>
30 <SCRIPT Type=module>
31 const parser = new DOMParser
32 document.title = location.hostname
33 document.documentElement.querySelector("body>h1").textContent = location.hostname
34 const renderLatest = (meta, container) => {
35 const { feed, items } = meta
36 const status = items.pop()
37 const src = status.content
38 const { documentElement: article } = parser.parseFromString(src, "application/xhtml+xml")
39 const footer = document.createElement("footer")
40 const authorshipP = footer.appendChild(document.createElement("p"))
41 const { creator, title } = status
42 if (creator) {
43 const authorLink = authorshipP.appendChild(document.createElement("a"))
44 authorLink.href = creator["@id"]
45 authorLink.textContent = creator.name
46 authorshipP.appendChild(document.createTextNode(" @ ")) }
47 authorshipP.appendChild(document.createElement("time")).textContent = status.created
48 const nav = footer.appendChild(document.createElement("nav"))
49 const atomLink = nav.appendChild(document.createElement("a"))
50 atomLink.href = feed
51 const atomSVG = document.createElementNS("http://www.w3.org/2000/svg", "svg")
52 atomSVG.setAttribute("version", "1.1")
53 atomSVG.setAttribute("viewBox", "0 0 256 256")
54 const atomUse = atomSVG.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "use"))
55 atomUse.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#feedicon")
56 atomLink.append(atomSVG, " Atom feed.")
57 nav.appendChild(document.createTextNode(" "))
58 const permalink = nav.appendChild(document.createElement("a"))
59 permalink.href = status["@id"]
60 permalink.textContent = "Permalink."
61 nav.appendChild(document.createTextNode(" "))
62 const upLink = nav.appendChild(document.createElement("a"))
63 upLink.href = meta["@id"]
64 upLink.textContent = `See more ${ status.subject ? `${status.subject}` : "status" } updates.`
65 if (title) {
66 const wrapper = document.createElement("article")
67 const details = wrapper.appendChild(document.createElement("details"))
68 details.setAttribute("open", "")
69 const summary = details.appendChild(document.createElement("summary"))
70 summary.textContent = title
71 details.append(...document.importNode(article, true).childNodes)
72 container.replaceChildren(wrapper, footer) }
73 else container.replaceChildren(document.importNode(article, true), footer) }
74 fetch("statuses.jsonld")
75 .then($ => $.json())
76 .then(meta => fetch(`${meta.current}.jsonld`))
77 .then($ => $.json())
78 .then(meta => renderLatest(meta, document.getElementById("status")))
79 fetch("topics.jsonld")
80 .then($ => $.json())
81 .then(meta => {
82 const topics = document.getElementById("topics")
83 for (const topicID of meta.items.map($ => $["@id"] ?? $)) {
84 const section = topics.appendChild(document.createElement("section"))
85 fetch(`${topicID}.jsonld`)
86 .then($ => $.json())
87 .then(topic => {
88 section.appendChild(document.createElement("h3")).textContent = topic.subject
89 const div = section.appendChild(document.createElement("div"))
90 div.className = "STATUS"
91 renderLatest(topic, div) }) } })
92 </SCRIPT>
This page took 0.144713 seconds and 5 git commands to generate.