Uhhh how about this?
This commit is contained in:
parent
4abddba24c
commit
6d0361fede
|
|
@ -15,7 +15,7 @@
|
|||
<link rel="canonical" href="https://c.stupid.cat/ascii">
|
||||
<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>
|
||||
|
||||
<body>
|
||||
|
|
@ -51,7 +51,24 @@
|
|||
</main>
|
||||
|
||||
<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>
|
||||
|
||||
</html>
|
||||
20
js/ascii.js
20
js/ascii.js
|
|
@ -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);
|
||||
}
|
||||
})();
|
||||
Loading…
Reference in New Issue