Browse Source

Forgot to change thirdeye module

pull/46/head
coomdev 2 years ago
parent
commit
5f5d00f148
  1. 2
      main.meta.js
  2. 9
      main.user.js
  3. 3
      src/main.ts
  4. 4
      src/thirdeye.ts

2
main.meta.js

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

9
main.user.js

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name PNGExtraEmbed // @name PNGExtraEmbed
// @namespace https://coom.tech/ // @namespace https://coom.tech/
// @version 0.116 // @version 0.117
// @description uhh // @description uhh
// @author You // @author You
// @match https://boards.4channel.org/* // @match https://boards.4channel.org/*
@ -11699,7 +11699,7 @@
let cachedFile; let cachedFile;
const prev = result[0].preview_url; const prev = result[0].preview_url;
const full = result[0].full_url; const full = result[0].full_url;
return { return [{
source: result[0].source, source: result[0].source,
page: { title: booru, url: result[0].page }, page: { title: booru, url: result[0].page },
filename: fn.substring(0, 33) + result[0].ext, filename: fn.substring(0, 33) + result[0].ext,
@ -11709,7 +11709,7 @@
cachedFile = await (await GM_fetch(full || prev, void 0, lsn)).arrayBuffer(); cachedFile = await (await GM_fetch(full || prev, void 0, lsn)).arrayBuffer();
return cachedFile; return cachedFile;
} }
}; }];
}; };
var has_embed4 = async (b, fn) => { var has_embed4 = async (b, fn) => {
if (import_buffer4.Buffer.from(fn, "hex").equals(b)) if (import_buffer4.Buffer.from(fn, "hex").equals(b))
@ -16642,7 +16642,7 @@
res2 = res2?.filter((e) => e); res2 = res2?.filter((e) => e);
if (!res2 || res2.length == 0) if (!res2 || res2.length == 0)
return; 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 () => { var startup = async () => {
if (typeof window["FCX"] != "undefined") if (typeof window["FCX"] != "undefined")
@ -16681,6 +16681,7 @@
isCatalog: !!document.querySelector(".catalog-small") || !!location.pathname.match(/\/catalog$/) isCatalog: !!document.querySelector(".catalog-small") || !!location.pathname.match(/\/catalog$/)
}); });
const n = 7; const n = 7;
console.log(posts);
const range = ~~(posts.length / n) + 1; const range = ~~(posts.length / n) + 1;
await Promise.all([...new Array(n + 1)].map(async (e, i) => { await Promise.all([...new Array(n + 1)].map(async (e, i) => {
const postsslice = posts.slice(i * range, (i + 1) * range); const postsslice = posts.slice(i * range, (i + 1) * range);

3
src/main.ts

@ -136,7 +136,7 @@ const processPost = async (post: HTMLDivElement) => {
res2 = res2?.filter(e => e); res2 = res2?.filter(e => e);
if (!res2 || res2.length == 0) if (!res2 || res2.length == 0)
return; 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 () => { const startup = async () => {
@ -189,6 +189,7 @@ const startup = async () => {
// await processPost(posts[i] as any); // await processPost(posts[i] as any);
const n = 7; const n = 7;
console.log(posts);
const range = ~~(posts.length / n) + 1; const range = ~~(posts.length / n) + 1;
await Promise.all([...new Array(n + 1)].map(async (e, i) => { await Promise.all([...new Array(n + 1)].map(async (e, i) => {
const postsslice = posts.slice(i * range, (i + 1) * range); const postsslice = posts.slice(i * range, (i + 1) * range);

4
src/thirdeye.ts

@ -148,7 +148,7 @@ const extract = async (b: Buffer, fn?: string) => {
let cachedFile: ArrayBuffer; let cachedFile: ArrayBuffer;
const prev = result[0].preview_url; const prev = result[0].preview_url;
const full = result[0].full_url; const full = result[0].full_url;
return { return [{
source: result[0].source, source: result[0].source,
page: { title: booru, url: result[0].page }, page: { title: booru, url: result[0].page },
filename: fn!.substring(0, 33) + result[0].ext, 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 cachedFile = (await (await GM_fetch(full || prev, undefined, lsn)).arrayBuffer()); // prefer full
return cachedFile; return cachedFile;
} }
} as EmbeddedFile; } as EmbeddedFile];
}; };
const has_embed = async (b: Buffer, fn?: string) => { const has_embed = async (b: Buffer, fn?: string) => {

Loading…
Cancel
Save