Open coke opened 12 months ago
Voldenet on IRC posted this potential replacement:
async function renderFeed() {
const fragment = document.createDocumentFragment();
try {
const feed = await fetch('recent-blog-posts.json').then(x => x.json());
for (const item of feed) {
const li = document.createElement('li');
const a = document.createElement('a');
li.appendChild(a);
a.href = item.link;
a.appendChild(document.createTextNode(item.title));
fragment.appendChild(li);
}
} catch (e) {
const li = document.createElement('li');
li.innerHTML = '<i>Failed to fetch recent blogs</i>';
fragment.appendChild(li);
}
return fragment;
}
async function attachPosts() {
const el = document.getElementById("recent_blog_posts");
if (!el) return;
el.appendChild(await renderFeed());
}
attachPosts();
We are doing very little with it, and bootstrap doesn't need it to function.
It's doing some apparently unneeded work on the footer's CSS (I don't see a difference in chrome when I disable it), and pulling in the latest blog entries, which we can do with straight JS.