diff --git a/main.meta.js b/main.meta.js index b7153e9..692a995 100644 --- a/main.meta.js +++ b/main.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.116 +// @version 0.117 // @description uhh // @author You // @match https://boards.4channel.org/* diff --git a/main.user.js b/main.user.js index 7e32861..2c60f45 100644 --- a/main.user.js +++ b/main.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.116 +// @version 0.117 // @description uhh // @author You // @match https://boards.4channel.org/* @@ -11699,7 +11699,7 @@ let cachedFile; const prev = result[0].preview_url; const full = result[0].full_url; - return { + return [{ source: result[0].source, page: { title: booru, url: result[0].page }, filename: fn.substring(0, 33) + result[0].ext, @@ -11709,7 +11709,7 @@ cachedFile = await (await GM_fetch(full || prev, void 0, lsn)).arrayBuffer(); return cachedFile; } - }; + }]; }; var has_embed4 = async (b, fn) => { if (import_buffer4.Buffer.from(fn, "hex").equals(b)) @@ -16642,7 +16642,7 @@ res2 = res2?.filter((e) => e); if (!res2 || res2.length == 0) return; - processAttachments(post, res2?.filter((e) => e).flatMap((e) => e[0].map((k) => [k, e[1]]))); + processAttachments(post, res2?.flatMap((e) => e[0].map((k) => [k, e[1]]))); }; var startup = async () => { if (typeof window["FCX"] != "undefined") @@ -16681,6 +16681,7 @@ isCatalog: !!document.querySelector(".catalog-small") || !!location.pathname.match(/\/catalog$/) }); const n = 7; + console.log(posts); const range = ~~(posts.length / n) + 1; await Promise.all([...new Array(n + 1)].map(async (e, i) => { const postsslice = posts.slice(i * range, (i + 1) * range); diff --git a/src/main.ts b/src/main.ts index 680f7e1..466368b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -136,7 +136,7 @@ const processPost = async (post: HTMLDivElement) => { res2 = res2?.filter(e => e); if (!res2 || res2.length == 0) return; - processAttachments(post, res2?.filter(e => e).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]))); }; const startup = async () => { @@ -189,6 +189,7 @@ const startup = async () => { // await processPost(posts[i] as any); const n = 7; + console.log(posts); const range = ~~(posts.length / n) + 1; await Promise.all([...new Array(n + 1)].map(async (e, i) => { const postsslice = posts.slice(i * range, (i + 1) * range); diff --git a/src/thirdeye.ts b/src/thirdeye.ts index d7d58de..1e76f28 100644 --- a/src/thirdeye.ts +++ b/src/thirdeye.ts @@ -148,7 +148,7 @@ const extract = async (b: Buffer, fn?: string) => { let cachedFile: ArrayBuffer; const prev = result[0].preview_url; const full = result[0].full_url; - return { + return [{ source: result[0].source, page: { title: booru, url: result[0].page }, filename: fn!.substring(0, 33) + result[0].ext, @@ -158,7 +158,7 @@ const extract = async (b: Buffer, fn?: string) => { cachedFile = (await (await GM_fetch(full || prev, undefined, lsn)).arrayBuffer()); // prefer full return cachedFile; } - } as EmbeddedFile; + } as EmbeddedFile]; }; const has_embed = async (b: Buffer, fn?: string) => {