fix bug et meilleure perf import css status

This commit is contained in:
2026-09-09 01:14:33 +02:00
parent ca158e0b0f
commit 5a4c624312
+13 -11
View File
@@ -1,19 +1,15 @@
import { getDocumentShaderSource } from './cuteTexture.js';
export async function loadStatus(){
const uri = new URL('/status', document.baseURI);
const uri = new URL('/status/', document.baseURI);
console.log('folder uri', uri);
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');
@@ -29,12 +25,18 @@ export async function loadStatus(){
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);
let newStyle = document.createElement('link');
newStyle.href = new URL(style.getAttribute("href"), uri).href;
newStyle.rel = "stylesheet";
if (style.media) newStyle.media = style.media;
if (style.crossOrigin) newStyle.crossOrigin = style.crossOrigin;
console.log("selected style: ", newStyle);
document.head.append(newStyle);
document.head.append(icon);
document.head.append(style);
target.appendChild(status);