also update document head
This commit is contained in:
		
							parent
							
								
									143fadcafb
								
							
						
					
					
						commit
						4f4c939631
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -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")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue