diff --git a/ascii/index.html b/ascii/index.html index 826c683..22b4660 100644 --- a/ascii/index.html +++ b/ascii/index.html @@ -51,24 +51,7 @@ - + \ No newline at end of file diff --git a/js/ascii.js b/js/ascii.js new file mode 100644 index 0000000..5bdc302 --- /dev/null +++ b/js/ascii.js @@ -0,0 +1,20 @@ +(async function () { + const el = document.getElementById('ascii-art'); + + try { + const res = await fetch('./ascii.txt', { cache: 'no-store' }); + if (!res.ok) throw new Error('fetch failed: ' + res.status); + + const raw = await res.text(); + + const ansi_up = new AnsiUp(); + const html = ansi_up.ansi_to_html(raw); + + el.innerHTML = html; + el.removeAttribute('aria-busy'); + + } catch (err) { + el.textContent = "couldn't load ascii.txt :("; + console.error(err); + } +})(); \ No newline at end of file