|
|
@ -1,7 +1,7 @@ |
|
|
|
// ==UserScript==
|
|
|
|
// @name PNGExtraEmbed
|
|
|
|
// @namespace https://coom.tech/
|
|
|
|
// @version 0.110
|
|
|
|
// @version 0.113
|
|
|
|
// @description uhh
|
|
|
|
// @author You
|
|
|
|
// @match https://boards.4channel.org/*
|
|
|
@ -11061,7 +11061,7 @@ |
|
|
|
}); |
|
|
|
|
|
|
|
// src/global.css
|
|
|
|
var global_default = ".pee-hidden {\n display: none;\n}\n\n.extractedImg {\n width: auto;\n height: auto;\n max-width: 125px;\n max-height: 125px;\n cursor: pointer;\n}\n\n#delform .postContainer>div.hasembed {\n border-right: 3px dashed deeppink !important;\n}\n\n.hasembed.catalog-post {\n border: 3px dashed deeppink !important;\n}\n\n#delform .postContainer>div.hasext {\n border-right: 3px dashed goldenrod !important;\n}\n\n#delform .postContainer>div.hasmultiple {\n border-right: 3px dashed cornflowerblue !important;\n}\n\n\n.hasext.catalog-post {\n border: 3px dashed goldenrod !important;\n}\n\n.expanded-image>.post>.file .fileThumb>img[data-md5] {\n display: none;\n}\n\n.expanded-image>.post>.file .fileThumb .full-image {\n display: inline;\n}\n\n.pee-settings {\n position: fixed;\n top: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\ndiv.hasemb .catalog-host img {\n border: 1px solid deeppink;\n}\n\ndiv.hasext .catalog-host img {\n border: 1px solid goldenrod;\n}\n\ndiv.hasmultiple .catalog-host img {\n border: 1px solid cornflowerblue;\n}\n\n.catalog-host img {\n position: absolute;\n top: -5px;\n right: 0px;\n max-width: 80px;\n max-height: 80px;\n box-shadow: 0px 0px 4px 2px #00000090;\n}\n\n.fileThumb.filehost {\n margin-left: 0 !important;\n display: flex;\n gap: 20px;\n}\n"; |
|
|
|
var global_default = ".pee-hidden {\r\n display: none;\r\n}\r\n\r\n.extractedImg {\r\n width: auto;\r\n height: auto;\r\n max-width: 125px;\r\n max-height: 125px;\r\n cursor: pointer;\r\n}\r\n\r\n#delform .postContainer>div.hasblack {\r\n border-right: 3px dashed black !important;\r\n}\r\n.hasblack.catalog-post {\r\n border: 3px dashed black !important;\r\n}\r\n\r\n#delform .postContainer>div.hasembed {\r\n border-right: 3px dashed deeppink !important;\r\n}\r\n\r\n.hasembed.catalog-post {\r\n border: 3px dashed deeppink !important;\r\n}\r\n\r\n#delform .postContainer>div.hasext {\r\n border-right: 3px dashed goldenrod !important;\r\n}\r\n\r\n.hasext.catalog-post {\r\n border: 3px dashed goldenrod !important;\r\n}\r\n\r\n#delform .postContainer>div.hasmultiple {\r\n border-right: 3px dashed cornflowerblue !important;\r\n}\r\ndiv.hasmultiple.catalog-post {\r\n border-right: 3px dashed cornflowerblue !important;\r\n}\r\n\r\n.expanded-image>.post>.file .fileThumb>img[data-md5] {\r\n display: none;\r\n}\r\n\r\n.expanded-image>.post>.file .fileThumb .full-image {\r\n display: inline;\r\n}\r\n\r\n.pee-settings {\r\n position: fixed;\r\n top: 0;\r\n width: 100%;\r\n height: 100%;\r\n pointer-events: none;\r\n}\r\n\r\n#delform div.hasemb .catalog-host .place video,\r\n#delform div.hasemb .catalog-host .place img {\r\n border: 1px solid deeppink;\r\n}\r\n\r\n#delform div.hasext .catalog-host .place video,\r\n#delform div.hasext .catalog-host .place img {\r\n border: 1px solid goldenrod;\r\n}\r\n\r\n#delform .div.hasmultiple .catalog-host video,\r\n#delform .div.hasmultiple .catalog-host img {\r\n border: 1px solid cornflowerblue;\r\n}\r\n\r\n#delform .catalog-host .place video,\r\n#delform .catalog-host .place img {\r\n position: absolute;\r\n top: -5px;\r\n right: 0px;\r\n max-width: 80px;\r\n max-height: 80px;\r\n box-shadow: 0px 0px 4px 2px #00000090;\r\n}\r\n\r\n.fileThumb.filehost {\r\n margin-left: 0 !important;\r\n display: flex;\r\n gap: 20px;\r\n}\r\n"; |
|
|
|
|
|
|
|
// src/png.ts
|
|
|
|
init_esbuild_inject(); |
|
|
@ -11217,21 +11217,22 @@ |
|
|
|
case "tEXt": |
|
|
|
buff = chunk; |
|
|
|
if (buff.slice(4, 4 + CUM0.length).equals(CUM0)) { |
|
|
|
return true; |
|
|
|
return 0 /* HAS_PEE */; |
|
|
|
} |
|
|
|
break; |
|
|
|
case "IDAT": |
|
|
|
case "IEND": |
|
|
|
return false; |
|
|
|
return 4 /* NONE */; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
return; |
|
|
|
return 3 /* PEE_UNDEFINED */; |
|
|
|
} finally { |
|
|
|
reader.releaseLock(); |
|
|
|
} |
|
|
|
return 3 /* PEE_UNDEFINED */; |
|
|
|
}; |
|
|
|
var png_default = { |
|
|
|
extract, |
|
|
@ -11263,10 +11264,10 @@ |
|
|
|
const embed = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && e.value == "COOM"); |
|
|
|
const cl = chunks.find((e) => e.name == "Cluster"); |
|
|
|
if (cl && embed == -1) |
|
|
|
return false; |
|
|
|
return 4 /* NONE */; |
|
|
|
if (embed == -1) |
|
|
|
return; |
|
|
|
return true; |
|
|
|
return 3 /* PEE_UNDEFINED */; |
|
|
|
return 0 /* HAS_PEE */; |
|
|
|
}; |
|
|
|
var webm_default = { |
|
|
|
extract: extract2, |
|
|
@ -11386,12 +11387,12 @@ |
|
|
|
end += v; |
|
|
|
} |
|
|
|
} else { |
|
|
|
return true; |
|
|
|
return 0 /* HAS_PEE */; |
|
|
|
} |
|
|
|
} |
|
|
|
if (end >= gif.byteLength) |
|
|
|
return; |
|
|
|
return false; |
|
|
|
return 3 /* PEE_UNDEFINED */; |
|
|
|
return 4 /* NONE */; |
|
|
|
}; |
|
|
|
var gif_default = { |
|
|
|
extract: extract3, |
|
|
@ -11510,7 +11511,7 @@ |
|
|
|
return cache[b.domain][hex]; |
|
|
|
const res = await GM_fetch(`https://${b.domain}${b.endpoint}${hex}`); |
|
|
|
const pres = await res.json(); |
|
|
|
const tran = b.quirks(pres).filter((e) => !e.tags.some((e2) => black.has(e2))); |
|
|
|
const tran = b.quirks(pres); |
|
|
|
if (!(b.domain in cache)) |
|
|
|
cache[b.domain] = {}; |
|
|
|
cache[b.domain][hex] = tran; |
|
|
@ -11531,24 +11532,29 @@ |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
let cachedFile; |
|
|
|
let cachedPrev; |
|
|
|
let cachedFull; |
|
|
|
const prev = result[0].preview_url; |
|
|
|
const full = result[0].full_url; |
|
|
|
return { |
|
|
|
source: result[0].source, |
|
|
|
page: { title: booru, url: result[0].page }, |
|
|
|
filename: fn.substring(0, 33) + result[0].ext, |
|
|
|
thumbnail: await (await GM_fetch(prev || full)).arrayBuffer(), |
|
|
|
thumbnail: async () => { |
|
|
|
if (!cachedPrev) |
|
|
|
cachedPrev = await (await GM_fetch(prev || full)).arrayBuffer(); |
|
|
|
return cachedPrev; |
|
|
|
}, |
|
|
|
data: async (lsn) => { |
|
|
|
if (!cachedFile) |
|
|
|
cachedFile = await (await GM_fetch(full || prev, void 0, lsn)).arrayBuffer(); |
|
|
|
return cachedFile; |
|
|
|
if (!cachedFull) |
|
|
|
cachedFull = await (await GM_fetch(full || prev, void 0, lsn)).arrayBuffer(); |
|
|
|
return cachedFull; |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
var has_embed4 = async (b, fn) => { |
|
|
|
if (Buffer2.from(fn, "hex").equals(b)) |
|
|
|
return false; |
|
|
|
return 4 /* NONE */; |
|
|
|
let result = void 0; |
|
|
|
for (const e of Object.values(boorus)) { |
|
|
|
if (e.disabled) |
|
|
@ -11558,7 +11564,13 @@ |
|
|
|
if (result.length) |
|
|
|
break; |
|
|
|
} |
|
|
|
return result && result.length != 0; |
|
|
|
if (result && result.length !== 0) { |
|
|
|
const filtered = result.filter((e) => !e.tags.some((e2) => black.has(e2))); |
|
|
|
if (filtered.length > 0) |
|
|
|
return 1 /* HAS_TE */; |
|
|
|
return 2 /* TE_BLACKLISTED */; |
|
|
|
} |
|
|
|
return 4 /* NONE */; |
|
|
|
}; |
|
|
|
var thirdeye_default = { |
|
|
|
skip: true, |
|
|
@ -11889,7 +11901,7 @@ |
|
|
|
c() { |
|
|
|
label = element("label"); |
|
|
|
input = element("input"); |
|
|
|
t = text("\n Hide original content when hidden content is visible."); |
|
|
|
t = text("\r\n Hide original content when hidden content is visible."); |
|
|
|
attr(input, "type", "checkbox"); |
|
|
|
}, |
|
|
|
m(target, anchor) { |
|
|
@ -12207,19 +12219,19 @@ |
|
|
|
c() { |
|
|
|
div = element("div"); |
|
|
|
label0 = element("label"); |
|
|
|
t0 = text("Name\n "); |
|
|
|
t0 = text("Name\r\n "); |
|
|
|
input0 = element("input"); |
|
|
|
t1 = space(); |
|
|
|
label1 = element("label"); |
|
|
|
t2 = text("Domain\n "); |
|
|
|
t2 = text("Domain\r\n "); |
|
|
|
input1 = element("input"); |
|
|
|
t3 = space(); |
|
|
|
label2 = element("label"); |
|
|
|
t4 = text("API Endpoint\n "); |
|
|
|
t4 = text("API Endpoint\r\n "); |
|
|
|
input2 = element("input"); |
|
|
|
t5 = space(); |
|
|
|
label3 = element("label"); |
|
|
|
t6 = text("Post page prefix (for sources)\n "); |
|
|
|
t6 = text("Post page prefix (for sources)\r\n "); |
|
|
|
input3 = element("input"); |
|
|
|
t7 = space(); |
|
|
|
button = element("button"); |
|
|
@ -12401,52 +12413,52 @@ |
|
|
|
t2 = space(); |
|
|
|
label0 = element("label"); |
|
|
|
input0 = element("input"); |
|
|
|
t3 = text("\n Autoexpand Images on opening."); |
|
|
|
t3 = text("\r\n Autoexpand Images on opening."); |
|
|
|
t4 = space(); |
|
|
|
label1 = element("label"); |
|
|
|
input1 = element("input"); |
|
|
|
t5 = text("\n Autoexpand Videos on opening."); |
|
|
|
t5 = text("\r\n Autoexpand Videos on opening."); |
|
|
|
t6 = space(); |
|
|
|
label2 = element("label"); |
|
|
|
input2 = element("input"); |
|
|
|
t7 = text("\n Loop media content."); |
|
|
|
t7 = text("\r\n Loop media content."); |
|
|
|
t8 = space(); |
|
|
|
label3 = element("label"); |
|
|
|
input3 = element("input"); |
|
|
|
t9 = text("\n Turn off hover preview."); |
|
|
|
t9 = text("\r\n Turn off hover preview."); |
|
|
|
t10 = space(); |
|
|
|
label4 = element("label"); |
|
|
|
input4 = element("input"); |
|
|
|
t11 = text("\n Hide embedded content behind an eye."); |
|
|
|
t11 = text("\r\n Hide embedded content behind an eye."); |
|
|
|
t12 = space(); |
|
|
|
if (if_block0) |
|
|
|
if_block0.c(); |
|
|
|
t13 = space(); |
|
|
|
label5 = element("label"); |
|
|
|
input5 = element("input"); |
|
|
|
t14 = text("\n Preload external files."); |
|
|
|
t14 = text("\r\n Preload external files."); |
|
|
|
t15 = space(); |
|
|
|
label6 = element("label"); |
|
|
|
input6 = element("input"); |
|
|
|
t16 = text("\n Preload external files when they are in view."); |
|
|
|
t16 = text("\r\n Preload external files when they are in view."); |
|
|
|
t17 = space(); |
|
|
|
label7 = element("label"); |
|
|
|
input7 = element("input"); |
|
|
|
t18 = text("\n Control audio on videos with mouse wheel."); |
|
|
|
t18 = text("\r\n Control audio on videos with mouse wheel."); |
|
|
|
t19 = space(); |
|
|
|
label8 = element("label"); |
|
|
|
input8 = element("input"); |
|
|
|
t20 = text("\n Show Minimap"); |
|
|
|
t20 = text("\r\n Show Minimap"); |
|
|
|
t21 = space(); |
|
|
|
label9 = element("label"); |
|
|
|
input9 = element("input"); |
|
|
|
t22 = text("\n \n Turn off embedded file preloading"); |
|
|
|
t22 = text("\r\n \r\n Turn off embedded file preloading"); |
|
|
|
a = element("a"); |
|
|
|
a.textContent = "?"; |
|
|
|
t24 = space(); |
|
|
|
label10 = element("label"); |
|
|
|
input10 = element("input"); |
|
|
|
t25 = text("\n Turn off third-eye."); |
|
|
|
t25 = text("\r\n Turn off third-eye."); |
|
|
|
t26 = space(); |
|
|
|
if (if_block1) |
|
|
|
if_block1.c(); |
|
|
@ -14985,6 +14997,7 @@ |
|
|
|
attr(div0, "class", "place svelte-yvh28x"); |
|
|
|
toggle_class(div0, "contract", ctx[6]); |
|
|
|
attr(div1, "class", "hoverer svelte-yvh28x"); |
|
|
|
attr(div1, "id", "ihover"); |
|
|
|
toggle_class(div1, "visible", ctx[7] && ctx[6]); |
|
|
|
toggle_class(div1, "unzipping", ctx[16]); |
|
|
|
}, |
|
|
@ -15342,7 +15355,7 @@ |
|
|
|
} |
|
|
|
function create_fragment6(ctx) { |
|
|
|
let if_block_anchor; |
|
|
|
let if_block = (!ctx[18].eye || ctx[15]) && create_if_block5(ctx); |
|
|
|
let if_block = !ctx[0].isBlacklisted && (!ctx[18].eye || ctx[15]) && create_if_block5(ctx); |
|
|
|
return { |
|
|
|
c() { |
|
|
|
if (if_block) |
|
|
@ -15355,7 +15368,7 @@ |
|
|
|
insert(target, if_block_anchor, anchor); |
|
|
|
}, |
|
|
|
p(ctx2, dirty) { |
|
|
|
if (!ctx2[18].eye || ctx2[15]) { |
|
|
|
if (!ctx2[0].isBlacklisted && (!ctx2[18].eye || ctx2[15])) { |
|
|
|
if (if_block) { |
|
|
|
if_block.p(ctx2, dirty); |
|
|
|
} else { |
|
|
@ -15416,10 +15429,12 @@ |
|
|
|
return contracted; |
|
|
|
} |
|
|
|
beforeUpdate(async () => { |
|
|
|
if (file?.isBlacklisted === true) |
|
|
|
return; |
|
|
|
if (settled) |
|
|
|
return; |
|
|
|
settled = true; |
|
|
|
const thumb = file.thumbnail || file.data; |
|
|
|
const thumb = file.thumbnail ? await file.thumbnail() : file.data; |
|
|
|
const type = await fileTypeFromBuffer(thumb); |
|
|
|
$$invalidate(5, url = URL.createObjectURL(new Blob([thumb], { type: type?.mime }))); |
|
|
|
if (!type) |
|
|
@ -15450,7 +15465,7 @@ |
|
|
|
} |
|
|
|
}, { |
|
|
|
root: null, |
|
|
|
rootMargin: "0px", |
|
|
|
rootMargin: "1000px", |
|
|
|
threshold: 0.01 |
|
|
|
}); |
|
|
|
obs.observe(place); |
|
|
@ -15459,6 +15474,8 @@ |
|
|
|
let unzipping = false; |
|
|
|
let progress = [0, 0]; |
|
|
|
async function unzip() { |
|
|
|
if (file?.isBlacklisted === true) |
|
|
|
return; |
|
|
|
if (!file.thumbnail) |
|
|
|
return; |
|
|
|
if (unzipping) |
|
|
@ -15486,6 +15503,8 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
async function bepis(ev) { |
|
|
|
if (file?.isBlacklisted === true) |
|
|
|
return; |
|
|
|
if ($appState.isCatalog) |
|
|
|
return; |
|
|
|
if (ev.button == 0) { |
|
|
@ -15539,6 +15558,8 @@ |
|
|
|
$$invalidate(10, hoverElem.style.height = `${dims[1]}px`, hoverElem); |
|
|
|
} |
|
|
|
async function hoverStart(ev) { |
|
|
|
if (file?.isBlacklisted === true) |
|
|
|
return; |
|
|
|
if ($settings.dh) |
|
|
|
return; |
|
|
|
if (file.thumbnail && !furl) { |
|
|
@ -16293,6 +16314,14 @@ |
|
|
|
var EyeButton_default = EyeButton; |
|
|
|
|
|
|
|
// src/main.ts
|
|
|
|
var EMBED_ENUM = /* @__PURE__ */ ((EMBED_ENUM2) => { |
|
|
|
EMBED_ENUM2[EMBED_ENUM2["HAS_PEE"] = 0] = "HAS_PEE"; |
|
|
|
EMBED_ENUM2[EMBED_ENUM2["HAS_TE"] = 1] = "HAS_TE"; |
|
|
|
EMBED_ENUM2[EMBED_ENUM2["TE_BLACKLISTED"] = 2] = "TE_BLACKLISTED"; |
|
|
|
EMBED_ENUM2[EMBED_ENUM2["PEE_UNDEFINED"] = 3] = "PEE_UNDEFINED"; |
|
|
|
EMBED_ENUM2[EMBED_ENUM2["NONE"] = 4] = "NONE"; |
|
|
|
return EMBED_ENUM2; |
|
|
|
})(EMBED_ENUM || {}); |
|
|
|
var csettings; |
|
|
|
var processors = [thirdeye_default, png_default, webm_default, gif_default]; |
|
|
|
var cappState; |
|
|
@ -16336,8 +16365,9 @@ |
|
|
|
return Promise.all(processors.filter((e) => e.match(fn)).map(async (proc) => { |
|
|
|
if (proc.skip) { |
|
|
|
const md5 = import_buffer4.Buffer.from(hex, "base64"); |
|
|
|
if (await proc.has_embed(md5, fn) === true) |
|
|
|
return [await proc.extract(md5, fn), true]; |
|
|
|
const embed_enum2 = await proc.has_embed(md5, fn); |
|
|
|
if (embed_enum2 === 1 /* HAS_TE */ || embed_enum2 === 2 /* TE_BLACKLISTED */) |
|
|
|
return [await proc.extract(md5, fn), embed_enum2]; |
|
|
|
return; |
|
|
|
} |
|
|
|
const iter = streamRemote(src); |
|
|
@ -16346,6 +16376,7 @@ |
|
|
|
let cumul = import_buffer4.Buffer.alloc(0); |
|
|
|
let found; |
|
|
|
let chunk = { done: true }; |
|
|
|
let embed_enum; |
|
|
|
do { |
|
|
|
const { value, done } = await iter.next(found === false); |
|
|
|
if (done) { |
|
|
@ -16355,13 +16386,14 @@ |
|
|
|
} |
|
|
|
if (!done) |
|
|
|
cumul = import_buffer4.Buffer.concat([cumul, value]); |
|
|
|
found = await proc.has_embed(cumul); |
|
|
|
embed_enum = await proc.has_embed(cumul); |
|
|
|
found = embed_enum === 0 /* HAS_PEE */; |
|
|
|
} while (found !== false && !chunk.done); |
|
|
|
await iter.next(true); |
|
|
|
if (found === false) { |
|
|
|
return; |
|
|
|
} |
|
|
|
return [await proc.extract(cumul), false]; |
|
|
|
return [await proc.extract(cumul), embed_enum]; |
|
|
|
})); |
|
|
|
}; |
|
|
|
var textToElement = (s) => document.createRange().createContextualFragment(s).children[0]; |
|
|
@ -16374,7 +16406,15 @@ |
|
|
|
res2 = res2?.filter((e) => e); |
|
|
|
if (!res2 || res2.length == 0) |
|
|
|
return; |
|
|
|
processAttachments(post, res2?.filter((e) => e)); |
|
|
|
processAttachments(post, res2?.filter((e) => { |
|
|
|
if (!e) |
|
|
|
return; |
|
|
|
if (e[1] === 2 /* TE_BLACKLISTED */) { |
|
|
|
e[0].isBlacklisted = true; |
|
|
|
post.querySelector(".reply")?.classList.add("hasblack"); |
|
|
|
} |
|
|
|
return e; |
|
|
|
})); |
|
|
|
}; |
|
|
|
var startup = async () => { |
|
|
|
if (typeof window["FCX"] != "undefined") |
|
|
@ -16504,10 +16544,10 @@ |
|
|
|
document.documentElement.insertBefore(customStyles, null); |
|
|
|
function processAttachments(post, ress) { |
|
|
|
const replyBox = post.querySelector(".post"); |
|
|
|
const external = ress[0][1]; |
|
|
|
if (external) |
|
|
|
const embed_enum = ress[0][1]; |
|
|
|
if (embed_enum === 1 /* HAS_TE */) |
|
|
|
replyBox?.classList.add("hasext"); |
|
|
|
else |
|
|
|
else if (embed_enum === 0 /* HAS_PEE */) |
|
|
|
replyBox?.classList.add("hasembed"); |
|
|
|
if (ress.length > 1) |
|
|
|
replyBox?.classList.add("hasmultiple"); |
|
|
|