forked from e621ng/e621ng
[Posts] Fix broken avatars and dtext thumbnails
This commit is contained in:
parent
1f63f4b9d5
commit
2f0bcfeb01
@ -1,12 +1,11 @@
|
||||
import Blacklist from "./blacklists";
|
||||
import LStorage from "./utility/storage";
|
||||
|
||||
const Thumbnails = {};
|
||||
|
||||
Thumbnails.initialize = function () {
|
||||
const postsData = window.___deferred_posts || {};
|
||||
const posts = $(".post-thumb.placeholder, .thumb-placeholder-link");
|
||||
const DAB = LStorage.get("dab") === "1";
|
||||
const replacedPosts = [];
|
||||
|
||||
for (const post of posts) {
|
||||
const $post = $(post);
|
||||
@ -47,21 +46,13 @@ Thumbnails.initialize = function () {
|
||||
})
|
||||
.appendTo(link);
|
||||
|
||||
// Disgusting implementation of the blacklist
|
||||
if (!DAB) {
|
||||
let blacklist_hit_count = 0;
|
||||
for (const entry of Blacklist.entries) {
|
||||
if (!Blacklist.postMatchObject(postData, entry))
|
||||
continue;
|
||||
entry.hits += 1;
|
||||
blacklist_hit_count += 1;
|
||||
}
|
||||
|
||||
if (blacklist_hit_count > 0)
|
||||
thumbnail.addClass("blacklisted");
|
||||
}
|
||||
|
||||
$post.replaceWith(thumbnail);
|
||||
replacedPosts.push(thumbnail);
|
||||
}
|
||||
|
||||
if (replacedPosts.length > 0) {
|
||||
Blacklist.add_posts(replacedPosts);
|
||||
Blacklist.update_visibility();
|
||||
}
|
||||
|
||||
function clearPlaceholder (post) {
|
||||
|
Loading…
Reference in New Issue
Block a user