also update document head

This commit is contained in:
Cadence Ember 2025-11-04 23:35:58 +13:00
parent 143fadcafb
commit 4f4c939631

View file

@ -25,9 +25,6 @@ async function cont() {
xhr.upload.addEventListener("progress", event => {
if (event.lengthComputable) {
progress.value = (event.loaded / event.total) * uploadFraction
console.log(
`Uploaded ${((event.loaded / event.total) * 100).toFixed(2)}%`,
)
}
})
@ -35,15 +32,19 @@ async function cont() {
xhr.addEventListener("progress", event => {
if (event.lengthComputable) {
progress.value = (event.loaded / event.total) * (1 - uploadFraction) + uploadFraction
console.log(
`Downloaded ${((event.loaded / event.total) * 100).toFixed(2)}%`,
)
}
})
xhr.addEventListener("load", () => {
console.log(xhr)
document.body = xhr.responseXML.body
document.title = xhr.responseXML.title
for (const e of xhr.responseXML.head.children) {
if (["LINK"].includes(e.tagName)) {
const imported = document.importNode(e, true)
document.head.appendChild(imported)
}
}
})
xhr.open("POST", "/api/render/wiki")