1
Fork 0

e621: avoid race condition where we look too soon for avatars to fetch

This commit is contained in:
Conduitry 2020-04-12 21:01:46 -04:00
parent b4ace0c52d
commit 951987e2bc

View file

@ -150,6 +150,9 @@ const augment_results = (container, posts, link_params) => {
}
// fetch avatars and thumbnails in comments blocked by global blacklist
while (document.querySelector('.post-thumb.placeholder')) {
await new Promise(res => setTimeout(res, 100));
}
for (const el of document.querySelectorAll('.post-thumbnail[data-status=active] img[src^="/images/"]')) {
el.src = get_preview_url((await make_request(`/posts/${el.closest('.post-thumbnail').dataset.id}.json`)).post);
}