ménage let/const & console.log

This commit is contained in:
2026-09-05 17:53:40 +02:00
parent 8f6907d5a6
commit 58380ed71e
5 changed files with 43 additions and 119 deletions
+19 -9
View File
@@ -1,12 +1,20 @@
import { getDocumentShaderSource } from './cuteTexture.js';
export async function loadStatus(){
let res = await fetch('/status/index.html');
const uri = new URL('/status', document.baseURI);
let html_text = await res.text()
let html = new DOMParser().parseFromString(html_text, "text/html");
let shaderSource = getDocumentShaderSource(html);
const html = await (await fetch(uri, {cache: 'no-store'})).text();
const remoteDoc = new DOMParser().parseFromString(html, "text/html");
const base = remoteDoc.createElement('base');
base.href = uri.toString();
remoteDoc.head.prepend(base);
//console.log('selected file:', remoteDoc);
let shaderSource = getDocumentShaderSource(remoteDoc);
let target = document.querySelector('#statuSection');
@@ -14,14 +22,16 @@ export async function loadStatus(){
hiddenBtn.style.visibility = 'collapse';
let status = html.querySelector('#lolStatus');
console.log('current status:', status.innerText);
let status = remoteDoc.querySelector('#lolStatus');
//console.log('current status:', status);
let isOpen = status.innerText.includes('ouvert');
let icon = html.querySelector('link[rel="icon"]');
let style = html.querySelector('link[data-import="status-style"]');
//console.log("selected style: ", style);
let icon = remoteDoc.querySelector('link[rel="icon"]');
let style = remoteDoc.querySelector('link[data-import="status-style"]');
let styleFile = style.href.split('/').at(-1);
style.href = uri + '/' + styleFile;
//console.log("selected style: ", style.href);
document.head.append(icon);
document.head.append(style);