]> Lady’s Gitweb - x_status_git/blobdiff - index.html
Capture source and use it to generate Atom titles
[x_status_git] / index.html
index b31518373d780680e979d27d779da495b8550818..44698ed810095a5144735f47d9b1b24d65656164 100644 (file)
@@ -8,6 +8,8 @@ body{ Display: Grid; Box-Sizing: Border-Box; Margin: Auto; Padding-Inline: 1REM;
 #topics h2{ Margin-Block-End: 0; Grid-Column: 1 / Span 2; Text-Align: Center }
 #topics h2:Last-Child{ Display: None }
 div.STATUS{ Border: Thin Solid; Padding-Inline: 1REM; Border-Radius: .5REM }
+summary{ Padding-Block: 1REM; Font-Weight: Bold }
+details[open]>summary{ Border-Block-End: Thin Solid }
 footer{ Border-Block-Start: Thin Solid; Padding-Block: 1REM; Font-Size: Smaller; Text-Align: End }
 footer p{ Margin-Block: 0 .5REM }
 footer time:Not([datetime]),
@@ -32,7 +34,7 @@ const renderLatest = (path, container) => fetch(`${path}.jsonld`)
   const { documentElement: article } = parser.parseFromString(src, "application/xhtml+xml")
   const footer = document.createElement("footer")
   const authorshipP = footer.appendChild(document.createElement("p"))
-  const { creator } = status
+  const { creator, title } = status
   if (creator) {
     const authorLink = authorshipP.appendChild(document.createElement("a"))
     authorLink.href = creator["@id"]
@@ -47,7 +49,15 @@ const renderLatest = (path, container) => fetch(`${path}.jsonld`)
   const upLink = nav.appendChild(document.createElement("a"))
   upLink.href = meta["@id"]
   upLink.textContent = `See more ${ status.subject ? `“${status.subject}” posts` : "statuses" }.`
-  container.replaceChildren(document.importNode(article, true), footer) })
+  if (title) {
+    const wrapper = document.createElement("article")
+    const details = wrapper.appendChild(document.createElement("details"))
+    details.setAttribute("open", "")
+    const summary = details.appendChild(document.createElement("summary"))
+    summary.textContent = title
+    details.append(...document.importNode(article, true).childNodes)
+    container.replaceChildren(wrapper, footer) }
+  else container.replaceChildren(document.importNode(article, true), footer) })
 fetch("statuses.jsonld")
 .then($ => $.json())
 .then(meta => renderLatest(meta.current, document.getElementById("status")))
This page took 0.021319 seconds and 4 git commands to generate.