mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/posts: skip thumbnail placeholder if fullsize image is in cache
This commit is contained in:
@ -211,6 +211,15 @@ function getPrettyName(tag) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
function isMediaCached(post) {
|
||||
if (post.type !== "image") {
|
||||
return false;
|
||||
}
|
||||
const img = new Image()
|
||||
img.src = post.contentUrl;
|
||||
return img.complete;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
range: range,
|
||||
formatRelativeTime: formatRelativeTime,
|
||||
@ -229,4 +238,5 @@ module.exports = {
|
||||
escapeSearchTerm: escapeSearchTerm,
|
||||
dataURItoBlob: dataURItoBlob,
|
||||
getPrettyName: getPrettyName,
|
||||
isMediaCached: isMediaCached,
|
||||
};
|
||||
|
Reference in New Issue
Block a user