Load examples as blobs (CORS)
Browse files215 unmodified lines216217218219219220221222223224225226215 unmodified lines for (const e of index.examples) { const f = document.createElement("figure"); f.innerHTML = `<img src="${e.file}" alt="${e.category} ${e.label}" loading="lazy"><figcaption>${e.category} · ${e.label}</figcaption>`; f.onclick = () => { window.scrollTo({ top: 0, behavior: "smooth" }); setImage(e.file, e.category); }; f.onclick = async () => { // fetch -> blob URL: LFS files are served from a CDN origin (would taint the canvas) window.scrollTo({ top: 0, behavior: "smooth" }); const blob = await (await fetch(e.file)).blob(); setImage(URL.createObjectURL(blob), e.category); }; $("examples").appendChild(f); } const drop = $("drop"), file = $("file");app.js+5-1