Uhhh how about this?

This commit is contained in:
Clove 2026-06-27 05:52:51 +01:00
parent 4abddba24c
commit 6d0361fede
2 changed files with 19 additions and 22 deletions

View File

@ -15,7 +15,7 @@
<link rel="canonical" href="https://c.stupid.cat/ascii"> <link rel="canonical" href="https://c.stupid.cat/ascii">
<meta name="theme-color" content="#f5c2e7"> <meta name="theme-color" content="#f5c2e7">
<script src="https://cdn.jsdelivr.net/npm/ansi_up/ansi_up.js"></script> <script src="https://cdn.jsdelivr.net/npm/ansi_up@6.0.0/ansi_up.min.js"></script>
</head> </head>
<body> <body>
@ -51,7 +51,24 @@
</main> </main>
<script src="/js/core.js" data-cat="/assets/oneko/classics/classic.png"></script> <script src="/js/core.js" data-cat="/assets/oneko/classics/classic.png"></script>
<script src="/js/ascii.js"></script> <script>
(async function () {
const el = document.getElementById('ascii-art');
try {
const res = await fetch('/ascii.txt', { cache: 'no-store' });
if (!res.ok) throw new Error(res.status);
const raw = await res.text();
const ansi_up = new AnsiUp();
el.innerHTML = ansi_up.ansi_to_html(raw);
} catch (err) {
el.textContent = "couldn't load ascii.txt :(";
console.error(err);
}
})();</script>
</body> </body>
</html> </html>

View File

@ -1,20 +0,0 @@
(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);
}
})();