Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove jquery #204

Open
coke opened this issue Nov 1, 2023 · 1 comment
Open

remove jquery #204

coke opened this issue Nov 1, 2023 · 1 comment
Assignees

Comments

@coke
Copy link
Contributor

coke commented Nov 1, 2023

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.

@coke
Copy link
Contributor Author

coke commented Nov 5, 2023

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();

@coke coke added this to the 2023-Quarter 4 milestone Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant