client/posts: display thumbnail while original image is loading

This commit is contained in:
Eva 2023-05-22 09:29:56 +02:00
parent f956d8033c
commit 5877ad9463

View file

@ -119,7 +119,18 @@ class PostContentControl {
post: this._post, post: this._post,
autoplay: settings.get().autoplayVideos, autoplay: settings.get().autoplayVideos,
}); });
if (settings.get().transparencyGrid) { if (["image", "flash"].includes(this._post.type)) {
newNode.style.backgroundImage = "url("+this._post.thumbnailUrl+")";
}
if (this._post.type == "image") {
newNode.firstElementChild.addEventListener("load", (e) => {
if (settings.get().transparencyGrid) {
newNode.classList.add("transparency-grid");
} else {
newNode.style.backgroundImage = "";
}
});
} else if (settings.get().transparencyGrid) {
newNode.classList.add("transparency-grid"); newNode.classList.add("transparency-grid");
} }
if (this._postContentNode) { if (this._postContentNode) {