diff --git a/extheader.js b/extheader.js index 8fa00c8..475129e 100644 --- a/extheader.js +++ b/extheader.js @@ -12,6 +12,13 @@ export const extheader = `// ==UserScript== // @match https://boards.4channel.org/* // @match https://boards.4chan.org/* // @match https://desuarchive.org/* +// @match https://archived.moe/* +// @match https://archive.nyafuu.org/* +// @match https://arch.b4k.co/* +// @match https://archive.wakarimasen.moe/* +// @match https://fireden.net/* +// @match https://thebarchive.com/* +// @match https://archiveofsins.com/* // @require https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest diff --git a/main.meta.js b/main.meta.js index 9b32afd..a84cdb0 100644 --- a/main.meta.js +++ b/main.meta.js @@ -1,12 +1,19 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.152 +// @version 0.154 // @description uhh // @author You // @match https://boards.4channel.org/* // @match https://boards.4chan.org/* // @match https://desuarchive.org/* +// @match https://archived.moe/* +// @match https://archive.nyafuu.org/* +// @match https://arch.b4k.co/* +// @match https://archive.wakarimasen.moe/* +// @match https://fireden.net/* +// @match https://thebarchive.com/* +// @match https://archiveofsins.com/* // @require https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest diff --git a/main.user.js b/main.user.js index fc47d21..86b6a1d 100644 --- a/main.user.js +++ b/main.user.js @@ -1,12 +1,19 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.152 +// @version 0.154 // @description uhh // @author You // @match https://boards.4channel.org/* // @match https://boards.4chan.org/* // @match https://desuarchive.org/* +// @match https://archived.moe/* +// @match https://archive.nyafuu.org/* +// @match https://arch.b4k.co/* +// @match https://archive.wakarimasen.moe/* +// @match https://fireden.net/* +// @match https://thebarchive.com/* +// @match https://archiveofsins.com/* // @require https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest @@ -18418,7 +18425,7 @@ getMD5: (post) => post.querySelector("img[data-md5]")?.getAttribute("data-md5") || "", getInfoBox: (post) => post.querySelector("span.file-info") }; - var DesuArchive = { + var FoolFuuka = { getFileThumbnail: (post) => post.classList.contains("post_is_op") ? post.querySelector(".thread_image_link") : post.querySelector(".thread_image_box"), getPost: (post) => post.querySelector(".post_wrapper"), postsWithFiles: (h) => [...(h || document).querySelectorAll('article[class*="has_image"]')], @@ -18438,8 +18445,8 @@ var getQueryProcessor = (is4chanX) => { if (["boards.4chan.org", "boards.4channel.org"].includes(location.host)) return is4chanX ? X4chan : V4chan; - if (location.host == "desuarchive.org") - return DesuArchive; + if (document.querySelector('meta[name="generator"]')?.getAttribute("content")?.startsWith("FoolFuuka")) + return FoolFuuka; }; // src/main.ts @@ -18696,10 +18703,10 @@ }; document.addEventListener("4chanXInitFinished", () => startup(true)); document.addEventListener("4chanParsingDone", () => startup(false), { once: true }); - if (location.host == "desuarchive.org") { + if (GM.info.script.matches.slice(2).some((m) => m.includes(location.host))) { window.addEventListener("load", () => { startup(false); - }); + }, { once: true }); } document.addEventListener("4chanThreadUpdated", (e) => { document.dispatchEvent(new CustomEvent("ThreadUpdate", { diff --git a/src/main.ts b/src/main.ts index d80f8d2..46d0d63 100644 --- a/src/main.ts +++ b/src/main.ts @@ -359,10 +359,10 @@ const startup = async (is4chanX = true) => { document.addEventListener('4chanXInitFinished', () => startup(true)); document.addEventListener('4chanParsingDone', () => startup(false), { once: true }); -if (location.host == "desuarchive.org") { +if (GM.info.script.matches.slice(2).some(m => m.includes(location.host))) { window.addEventListener('load', () => { startup(false); - }); + }, { once: true }); } document.addEventListener('4chanThreadUpdated', ((e: CustomEvent<{ count: number }>) => { diff --git a/src/websites/index.ts b/src/websites/index.ts index 581135a..289594b 100644 --- a/src/websites/index.ts +++ b/src/websites/index.ts @@ -43,7 +43,7 @@ export const X4chan: QueryProcessor = { getInfoBox: post => post.querySelector("span.file-info")! }; -export const DesuArchive: QueryProcessor = { +export const FoolFuuka: QueryProcessor = { getFileThumbnail: post => post.classList.contains('post_is_op') ? post.querySelector('.thread_image_link')! : post.querySelector('.thread_image_box')!, getPost: (post) => post.querySelector('.post_wrapper')!, postsWithFiles: (h) => [...(h || document).querySelectorAll('article[class*="has_image"]')] as HTMLElement[], @@ -64,6 +64,6 @@ export const DesuArchive: QueryProcessor = { export const getQueryProcessor = (is4chanX: boolean) => { if (['boards.4chan.org', 'boards.4channel.org'].includes(location.host)) return is4chanX ? X4chan : V4chan; - if (location.host == "desuarchive.org") - return DesuArchive; -}; \ No newline at end of file + if (document.querySelector('meta[name="generator"]')?.getAttribute("content")?.startsWith("FoolFuuka")) + return FoolFuuka; +};