- const prevText = (() => {
- try {
- const prevD = parser.parseFromString(items[n - 1].content, "application/xhtml+xml")
- const div = document.createElement("div")
- div.appendChild(document.importNode(prevD.documentElement, true))
- Object.assign(div.style,
- { position: "absolute"
- , top: "-2px"
- , height: "1px"
- , width: "1px"
- , overflow: "hidden" })
- document.body.appendChild(div)
- const text = div.innerText
- document.body.removeChild(div)
- return text }
- catch { } })() ?? items[n + 1].created;
- const prevChars = Array.from(prevText.trim().replaceAll(/\s+/gu, " "))
- prevLink.textContent = prevChars.length > 28
- ? "".concat(...prevChars.slice(0, 27), "…")
- : prevText }
+ const { title: prevTitle } = items[n - 1]
+ if (prevTitle) prevLink.textContent = prevTitle.length > 28
+ ? "".concat(...prevTitle.slice(0, 27), "…")
+ : prevTitle
+ else {
+ const prevText = (() => {
+ try {
+ const prevD = parser.parseFromString(items[n - 1].content, "application/xhtml+xml")
+ const div = document.createElement("div")
+ div.appendChild(document.importNode(prevD.documentElement, true))
+ Object.assign(div.style,
+ { position: "absolute"
+ , top: "-2px"
+ , height: "1px"
+ , width: "1px"
+ , overflow: "hidden" })
+ document.body.appendChild(div)
+ const text = div.innerText
+ document.body.removeChild(div)
+ return text }
+ catch { } })() ?? items[n + 1].created;
+ const prevChars = Array.from(prevText.trim().replaceAll(/\s+/gu, " "))
+ prevLink.textContent = prevChars.length > 28
+ ? "".concat(...prevChars.slice(0, 27), "…")
+ : prevText } }