X-Git-Url: https://git.ladys.computer/x_status_git/blobdiff_plain/3394dfeb4194ca630becdb4d34538a3370d47ca8..5d3d36f31fdfd8ad151fa2b2c4ca0f6e1301db8e:/index.html?ds=sidebyside diff --git a/index.html b/index.html index 44698ed..4be8239 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,7 @@ footer{ Border-Block-Start: Thin Solid; Padding-Block: 1REM; Font-Size: Smaller; footer p{ Margin-Block: 0 .5REM } footer time:Not([datetime]), footer small{ Font-Size: Inherit; Font-Style: Italic } +svg{ Display: Inline-Block; Vertical-Align: Middle; Block-Size: 1EM; Inline-Size: 1EM; Fill: #FFF } </STYLE> <H1>Index</H1> <DIV Class=STATUS ID=status> @@ -21,14 +22,13 @@ footer small{ Font-Size: Inherit; Font-Style: Italic } <SECTION ID=topics> <H2>Topics</H2> </SECTION> +<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> <SCRIPT Type=module> const parser = new DOMParser document.title = location.hostname document.documentElement.querySelector("body>h1").textContent = location.hostname -const renderLatest = (path, container) => fetch(`${path}.jsonld`) -.then($ => $.json()) -.then(meta => { - const { items } = meta +const renderLatest = (meta, container) => { + const { feed, items } = meta const status = items.pop() const src = status.content const { documentElement: article } = parser.parseFromString(src, "application/xhtml+xml") @@ -42,13 +42,22 @@ const renderLatest = (path, container) => fetch(`${path}.jsonld`) authorshipP.appendChild(document.createTextNode(" @ ")) } authorshipP.appendChild(document.createElement("time")).textContent = status.created const nav = footer.appendChild(document.createElement("nav")) + const atomLink = nav.appendChild(document.createElement("a")) + atomLink.href = feed + const atomSVG = document.createElementNS("http://www.w3.org/2000/svg", "svg") + atomSVG.setAttribute("version", "1.1") + atomSVG.setAttribute("viewBox", "0 0 256 256") + const atomUse = atomSVG.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "use")) + atomUse.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#feedicon") + atomLink.append(atomSVG, " Atom feed.") + nav.appendChild(document.createTextNode(" ")) const permalink = nav.appendChild(document.createElement("a")) permalink.href = status["@id"] permalink.textContent = "Permalink." nav.appendChild(document.createTextNode(" ")) const upLink = nav.appendChild(document.createElement("a")) upLink.href = meta["@id"] - upLink.textContent = `See more ${ status.subject ? `“${status.subject}” posts` : "statuses" }.` + upLink.textContent = `See more ${ status.subject ? `${status.subject}` : "status" } updates.` if (title) { const wrapper = document.createElement("article") const details = wrapper.appendChild(document.createElement("details")) @@ -57,10 +66,12 @@ const renderLatest = (path, container) => fetch(`${path}.jsonld`) summary.textContent = title details.append(...document.importNode(article, true).childNodes) container.replaceChildren(wrapper, footer) } - else container.replaceChildren(document.importNode(article, true), footer) }) + else container.replaceChildren(document.importNode(article, true), footer) } fetch("statuses.jsonld") .then($ => $.json()) -.then(meta => renderLatest(meta.current, document.getElementById("status"))) +.then(meta => fetch(`${meta.current}.jsonld`)) +.then($ => $.json()) +.then(meta => renderLatest(meta, document.getElementById("status"))) fetch("topics.jsonld") .then($ => $.json()) .then(meta => { @@ -73,6 +84,5 @@ fetch("topics.jsonld") section.appendChild(document.createElement("h3")).textContent = topic.subject const div = section.appendChild(document.createElement("div")) div.className = "STATUS" - renderLatest(new URL(topic["@id"]).pathname, div) - }) } }) + renderLatest(topic, div) }) } }) </SCRIPT>