Merge branch 'feat-black-posts' into 中出し

This commit is contained in:
Anonymous 2022-01-12 21:40:37 +01:00
commit 04e7ca19b1
3 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name PNGExtraEmbed2 // @name PNGExtraEmbed2
// @namespace https://coom.tech/ // @namespace https://coom.tech/
// @version 0.160 // @version 0.162
// @description uhh // @description uhh
// @author You // @author You
// @match https://boards.4channel.org/* // @match https://boards.4channel.org/*

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name PNGExtraEmbed2 // @name PNGExtraEmbed2
// @namespace https://coom.tech/ // @namespace https://coom.tech/
// @version 0.160 // @version 0.162
// @description uhh // @description uhh
// @author You // @author You
// @match https://boards.4channel.org/* // @match https://boards.4channel.org/*
@ -17139,8 +17139,13 @@
res2 = res2?.filter((e) => e); res2 = res2?.filter((e) => e);
if (!res2 || res2.length == 0) if (!res2 || res2.length == 0)
return; return;
let test = res2?.flatMap((e) => e[0].map((k) => [k, e[1]])); let filtered = res2?.filter((e) => e != null);
processAttachments(post, res2?.flatMap((e) => e[0].map((k) => { if (filtered.length === 0) {
console.warn("ImageProcessors returned empty for post.");
console.warn(post);
return;
}
processAttachments(post, filtered.flatMap((e) => e[0].map((k) => {
if (k?.isBlacklisted === true) { if (k?.isBlacklisted === true) {
post.querySelector(".reply")?.classList.add("hasblack"); post.querySelector(".reply")?.classList.add("hasblack");
} }

View File

@ -179,10 +179,15 @@ const processPost = async (post: HTMLDivElement) => {
if (!res2 || res2.length == 0) if (!res2 || res2.length == 0)
return; return;
let test = res2?.flatMap(e => e![0].map(k => [k, e![1]] as [EmbeddedFile, EMBED_TYPES]));
// processAttachments(post, res2?.flatMap(e => e![0].map(k => [k, e![1]] as [EmbeddedFile, boolean]))); // processAttachments(post, res2?.flatMap(e => e![0].map(k => [k, e![1]] as [EmbeddedFile, boolean])));
processAttachments(post, res2?.flatMap(e => let filtered = res2?.filter(e => e != null) as [EmbeddedFile[], EMBED_TYPES][];
e![0].map(k => { if(filtered.length === 0){
console.warn("ImageProcessors returned empty for post.")
console.warn(post)
return;
}
processAttachments(post, filtered.flatMap(e =>
e[0].map(k => {
if(k?.isBlacklisted === true){ if(k?.isBlacklisted === true){
post.querySelector('.reply')?.classList.add('hasblack'); post.querySelector('.reply')?.classList.add('hasblack');
} }