# #optimization

Just fixed the flickering issue by inlining the required JavaScript, which is a really small snippet. If you’re curious about the code I’m using to toggle between the dark and light themes, following the user’s choice and falling back to the OS settings, here it is:

const mql = window.matchMedia('(prefers-color-scheme: dark)');

function toggleT (to) {
localStorage.setItem('t', to);
theme(mql);
}

function theme (query) {
const userOption = localStorage.getItem('t');

document.body.id = userOption === null
? (query.matches ? 'dark' : '')
: (userOption === 'd' ? 'dark' : '');
}

theme(mql);


Jan-Lukas Else 22 Jan 2020 10:28

I don’t show webmention content at all. 😅 Instead I just show a link to the “interaction”. That removes a lot of complexity with parsing, storing etc. but probably isn’t as intuitive: it requires opening the “interactions” section below the post and visiting the link.

I enjoy showing the webmention and the context (reply to what? repost of what? like of what?) because, as you know, the content on the Internet is ephemeral and if I don’t store it, I don’t have assurance that it will remain available. And that’s the main reason why I show the webmentions.

In any case, it’s not the webmentions that worry me, but the post contexts that I show on replies, likes and reposts… Need to decide on that: either remove the pictures, or store them.