Add title and author to reader mode

This commit is contained in:
Oliver Blanthorn 2023-04-04 16:15:20 +02:00
parent 04df34d9c7
commit a06d6849c0
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -5998,6 +5998,18 @@ export async function reader2() {
stylelink.rel = "stylesheet"
stylelink.href = browser.runtime.getURL("static/css/reader.css")
document.head.appendChild(stylelink)
if (article.title !== undefined) {
const header = document.createElement("header")
const title = document.createElement("h1")
title.textContent = article.title
header.appendChild(title)
if (article.byline !== undefined) {
const author = document.createElement("p")
author.textContent = article.byline
header.appendChild(author)
}
document.body.insertBefore(header, document.body.firstChild)
}
}
/**