Merge pull request #5283 from Chic-Tweetz/reader-favicons

favicon in reader
This commit is contained in:
Oliver Blanthorn 2025-11-15 16:28:21 +00:00 committed by GitHub
commit 030ef4d2ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -6223,6 +6223,7 @@ export async function readerurl() {
document.querySelectorAll(".TridactylStatusIndicator").forEach(ind => ind.parentNode.removeChild(ind))
const article = new Readability(document.cloneNode(true) as any as Document).parse()
article["link"] = window.location.href
article["favicon"] = (await ownTab()).favIconUrl
return browser.runtime.getURL("static/reader.html#" + btoa(encodeURIComponent(JSON.stringify(article))))
}

View file

@ -45,6 +45,12 @@ async function updatePage() {
} else {
document.getElementById("tricanonlink")?.remove()
}
if (article.favicon !== undefined) {
const icon = document.createElement("link")
icon.rel = "icon"
icon.href = article.favicon
document.head.appendChild(icon)
}
}
window.addEventListener("load", updatePage)