|
|
@ -1,7 +1,7 @@ |
|
|
|
// ==UserScript==
|
|
|
|
// @name PNGExtraEmbed2
|
|
|
|
// @namespace https://coom.tech/
|
|
|
|
// @version 0.145
|
|
|
|
// @version 0.146
|
|
|
|
// @description uhh
|
|
|
|
// @author You
|
|
|
|
// @match https://boards.4channel.org/*
|
|
|
@ -11147,7 +11147,7 @@ |
|
|
|
const fnsize = data.readUInt32LE(0); |
|
|
|
const fn = data.slice(4, 4 + fnsize).toString(); |
|
|
|
data = data.slice(4 + fnsize); |
|
|
|
return [{ embed_type: 1 /* MEDIA_EMBED */, filename: fn, data }]; |
|
|
|
return [{ embed_type: 2 /* MEDIA_EMBED */, filename: fn, data }]; |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.error(e); |
|
|
@ -11274,7 +11274,7 @@ |
|
|
|
return; |
|
|
|
const chk = chunks[embed2 + 1]; |
|
|
|
if (chk.type == "b" && chk.name == "TagBinary") |
|
|
|
return [{ embed_type: 1 /* MEDIA_EMBED */, filename: "string", data: chk.data }]; |
|
|
|
return [{ embed_type: 2 /* MEDIA_EMBED */, filename: "string", data: chk.data }]; |
|
|
|
}; |
|
|
|
var inject = async (container, [inj]) => embed(import_buffer2.Buffer.from(await container.arrayBuffer()), import_buffer2.Buffer.from(await inj.arrayBuffer())); |
|
|
|
var has_embed2 = (webm) => { |
|
|
@ -11336,7 +11336,7 @@ |
|
|
|
ptr += sec.data.byteLength; |
|
|
|
end = sec.end; |
|
|
|
} while (sec.appname == "COOMTECH" && gif[end] == "!".charCodeAt(0)); |
|
|
|
return [{ embed_type: 1 /* MEDIA_EMBED */, data: ret, filename: "embedded" }]; |
|
|
|
return [{ embed_type: 2 /* MEDIA_EMBED */, data: ret, filename: "embedded" }]; |
|
|
|
} |
|
|
|
end = sec.end; |
|
|
|
} |
|
|
@ -11588,7 +11588,7 @@ |
|
|
|
const prev = result[0].preview_url; |
|
|
|
const full = result[0].full_url; |
|
|
|
return [{ |
|
|
|
embed_type: 0 /* THIRD_EYE */, |
|
|
|
embed_type: 0 /* EXTERNAL_BOORU */, |
|
|
|
tags, |
|
|
|
source: result[0].source, |
|
|
|
page: { title: booru, url: result[0].page }, |
|
|
@ -11669,7 +11669,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
return [{ |
|
|
|
embed_type: 1 /* MEDIA_EMBED */, |
|
|
|
embed_type: 1 /* EXTERNAL_POMF */, |
|
|
|
filename: ext, |
|
|
|
data: csettings3.hotlink ? rsource : async (lsn) => { |
|
|
|
try { |
|
|
@ -15171,8 +15171,8 @@ |
|
|
|
if_block5.c(); |
|
|
|
attr(div0, "class", "place svelte-145c3cl"); |
|
|
|
toggle_class(div0, "contract", ctx[6]); |
|
|
|
toggle_class(div0, "hasembed", ctx[0]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(div0, "hasext", ctx[0]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(div0, "hasembed", ctx[0]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
toggle_class(div0, "hasext", ctx[0]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx[0]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
attr(div1, "class", "hoverer svelte-145c3cl"); |
|
|
|
attr(div1, "id", "ihover"); |
|
|
|
toggle_class(div1, "visible", ctx[7] && ctx[6]); |
|
|
@ -15254,10 +15254,10 @@ |
|
|
|
toggle_class(div0, "contract", ctx2[6]); |
|
|
|
} |
|
|
|
if (dirty[0] & 1) { |
|
|
|
toggle_class(div0, "hasembed", ctx2[0]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(div0, "hasembed", ctx2[0]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
} |
|
|
|
if (dirty[0] & 1) { |
|
|
|
toggle_class(div0, "hasext", ctx2[0]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(div0, "hasext", ctx2[0]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx2[0]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
} |
|
|
|
if (ctx2[16]) { |
|
|
|
if (if_block3) { |
|
|
@ -15622,26 +15622,24 @@ |
|
|
|
if (settled) |
|
|
|
return; |
|
|
|
settled = true; |
|
|
|
const media = typeof file.thumbnail === "function" ? await file.thumbnail() : file.data; |
|
|
|
if (media == null) |
|
|
|
const thumb = typeof file.thumbnail === "function" ? await file.thumbnail() : file.data; |
|
|
|
if (thumb == null) |
|
|
|
return; |
|
|
|
let type; |
|
|
|
if (media instanceof ArrayBuffer || media instanceof Uint8Array) { |
|
|
|
type = await fileTypeFromBuffer(media); |
|
|
|
$$invalidate(5, url = URL.createObjectURL(new Blob([media], { type: type?.mime }))); |
|
|
|
} else if (typeof media === "string") { |
|
|
|
let head = headerStringToObject(await GM_head(media, void 0)); |
|
|
|
if (thumb instanceof ArrayBuffer || thumb instanceof Uint8Array) { |
|
|
|
type = await fileTypeFromBuffer(thumb); |
|
|
|
$$invalidate(5, url = URL.createObjectURL(new Blob([thumb], { type: type?.mime }))); |
|
|
|
} else if (typeof thumb === "string") { |
|
|
|
let head = headerStringToObject(await GM_head(thumb, void 0)); |
|
|
|
type = { |
|
|
|
ext: "", |
|
|
|
mime: head["content-type"].split(";")[0].trim() |
|
|
|
}; |
|
|
|
} |
|
|
|
if (!type) |
|
|
|
return; |
|
|
|
$$invalidate(8, ftype = type.mime); |
|
|
|
$$invalidate(2, isVideo = type.mime.startsWith("video/")); |
|
|
|
$$invalidate(4, isAudio = type.mime.startsWith("audio/")); |
|
|
|
$$invalidate(3, isImage = type.mime.startsWith("image/")); |
|
|
|
$$invalidate(8, ftype = type?.mime ?? ""); |
|
|
|
$$invalidate(2, isVideo = ftype.startsWith("video/") ?? false); |
|
|
|
$$invalidate(4, isAudio = ftype.startsWith("audio/") ?? false); |
|
|
|
$$invalidate(3, isImage = ftype.startsWith("image/") ?? false); |
|
|
|
dispatch("fileinfo", { type }); |
|
|
|
if (isImage) { |
|
|
|
$$invalidate(6, contracted = !$settings.xpi); |
|
|
@ -15667,7 +15665,9 @@ |
|
|
|
rootMargin: "1000px", |
|
|
|
threshold: 0.01 |
|
|
|
}); |
|
|
|
obs.observe(place); |
|
|
|
setTimeout(() => { |
|
|
|
obs.observe(place); |
|
|
|
}, 1e3); |
|
|
|
} |
|
|
|
}); |
|
|
|
let unzipping = false; |
|
|
@ -15675,8 +15675,6 @@ |
|
|
|
async function unzip() { |
|
|
|
if (file?.isBlacklisted === true) |
|
|
|
return; |
|
|
|
if (!file.thumbnail) |
|
|
|
return; |
|
|
|
if (unzipping) |
|
|
|
return; |
|
|
|
let type; |
|
|
@ -15687,8 +15685,8 @@ |
|
|
|
$$invalidate(17, progress = e.detail); |
|
|
|
}); |
|
|
|
let full = await file.data(lisn); |
|
|
|
const type2 = await fileTypeFromBuffer(full); |
|
|
|
$$invalidate(14, furl = URL.createObjectURL(new Blob([full], { type: type2?.mime }))); |
|
|
|
type = await fileTypeFromBuffer(full); |
|
|
|
$$invalidate(14, furl = URL.createObjectURL(new Blob([full], { type: type?.mime }))); |
|
|
|
} else if (typeof file.data === "string") { |
|
|
|
$$invalidate(5, url = file.data); |
|
|
|
$$invalidate(14, furl = file.data); |
|
|
@ -15697,9 +15695,13 @@ |
|
|
|
ext: "", |
|
|
|
mime: head["content-type"].split(";")[0].trim() |
|
|
|
}; |
|
|
|
} else { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!type) |
|
|
|
if (!type) { |
|
|
|
debugger; |
|
|
|
return; |
|
|
|
} |
|
|
|
$$invalidate(2, isVideo = type.mime.startsWith("video/")); |
|
|
|
$$invalidate(4, isAudio = type.mime.startsWith("audio/")); |
|
|
|
$$invalidate(3, isImage = type.mime.startsWith("image/")); |
|
|
@ -16192,8 +16194,8 @@ |
|
|
|
attr(a, "href", a_href_value = ctx[22].source); |
|
|
|
attr(a, "target", "_blank"); |
|
|
|
attr(a, "class", "clickable svelte-1b3be75"); |
|
|
|
toggle_class(a, "hasembed", ctx[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasext", ctx[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(a, "hasembed", ctx[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasext", ctx[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
toggle_class(a, "hasblack", ctx[22]?.isBlacklisted === true); |
|
|
|
}, |
|
|
|
m(target, anchor) { |
|
|
@ -16205,10 +16207,10 @@ |
|
|
|
attr(a, "href", a_href_value); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasembed", ctx2[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasembed", ctx2[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasext", ctx2[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(a, "hasext", ctx2[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx2[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasblack", ctx2[22]?.isBlacklisted === true); |
|
|
@ -16232,8 +16234,8 @@ |
|
|
|
attr(a, "href", a_href_value = ctx[22].page.url); |
|
|
|
attr(a, "target", "_blank"); |
|
|
|
attr(a, "class", "clickable svelte-1b3be75"); |
|
|
|
toggle_class(a, "hasembed", ctx[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasext", ctx[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(a, "hasembed", ctx[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasext", ctx[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
toggle_class(a, "hasblack", ctx[22]?.isBlacklisted === true); |
|
|
|
}, |
|
|
|
m(target, anchor) { |
|
|
@ -16247,10 +16249,10 @@ |
|
|
|
attr(a, "href", a_href_value); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasembed", ctx2[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasembed", ctx2[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasext", ctx2[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(a, "hasext", ctx2[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx2[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasblack", ctx2[22]?.isBlacklisted === true); |
|
|
@ -16283,8 +16285,8 @@ |
|
|
|
each_blocks[i].c(); |
|
|
|
} |
|
|
|
attr(summary, "class", "svelte-1b3be75"); |
|
|
|
toggle_class(summary, "hasembed", ctx[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(summary, "hasext", ctx[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(summary, "hasembed", ctx[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
toggle_class(summary, "hasext", ctx[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
toggle_class(summary, "hasblack", ctx[22]?.isBlacklisted === true); |
|
|
|
attr(ul, "class", "svelte-1b3be75"); |
|
|
|
attr(details, "class", "tags svelte-1b3be75"); |
|
|
@ -16300,10 +16302,10 @@ |
|
|
|
}, |
|
|
|
p(ctx2, dirty) { |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(summary, "hasembed", ctx2[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(summary, "hasembed", ctx2[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(summary, "hasext", ctx2[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(summary, "hasext", ctx2[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx2[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(summary, "hasblack", ctx2[22]?.isBlacklisted === true); |
|
|
@ -16372,8 +16374,8 @@ |
|
|
|
a.textContent = "[PEE contract]"; |
|
|
|
attr(a, "alt", "By clicking this you agree to stay hydrated"); |
|
|
|
attr(a, "class", "clickable svelte-1b3be75"); |
|
|
|
toggle_class(a, "hasembed", ctx[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasext", ctx[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(a, "hasembed", ctx[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasext", ctx[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
toggle_class(a, "hasblack", ctx[22]?.isBlacklisted === true); |
|
|
|
}, |
|
|
|
m(target, anchor) { |
|
|
@ -16385,10 +16387,10 @@ |
|
|
|
}, |
|
|
|
p(ctx2, dirty) { |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasembed", ctx2[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(a, "hasembed", ctx2[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasext", ctx2[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(a, "hasext", ctx2[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx2[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(a, "hasblack", ctx2[22]?.isBlacklisted === true); |
|
|
@ -16437,8 +16439,8 @@ |
|
|
|
if_block3_anchor = empty(); |
|
|
|
attr(span, "title", span_title_value = ctx[22].filename); |
|
|
|
attr(span, "class", "fa fa-download clickable svelte-1b3be75"); |
|
|
|
toggle_class(span, "hasembed", ctx[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(span, "hasext", ctx[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(span, "hasembed", ctx[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
toggle_class(span, "hasext", ctx[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
toggle_class(span, "hasblack", ctx[22]?.isBlacklisted === true); |
|
|
|
}, |
|
|
|
m(target, anchor) { |
|
|
@ -16467,10 +16469,10 @@ |
|
|
|
attr(span, "title", span_title_value); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(span, "hasembed", ctx[22]?.embed_type === 1 /* MEDIA_EMBED */); |
|
|
|
toggle_class(span, "hasembed", ctx[22]?.embed_type === 2 /* MEDIA_EMBED */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(span, "hasext", ctx[22]?.embed_type === 0 /* THIRD_EYE */); |
|
|
|
toggle_class(span, "hasext", ctx[22]?.embed_type === 0 /* EXTERNAL_BOORU */ || ctx[22]?.embed_type === 1 /* EXTERNAL_POMF */); |
|
|
|
} |
|
|
|
if (dirty & 1) { |
|
|
|
toggle_class(span, "hasblack", ctx[22]?.isBlacklisted === true); |
|
|
@ -16661,7 +16663,12 @@ |
|
|
|
const a = document.createElement("a"); |
|
|
|
document.body.appendChild(a); |
|
|
|
a.style.display = "none"; |
|
|
|
const thumb = Buffer2.isBuffer(file.data) ? file.data : await file.data(); |
|
|
|
const thumb = typeof file.data === "function" ? await file.data() : file.data; |
|
|
|
if (!(thumb instanceof Buffer2)) { |
|
|
|
console.error("Couldn't download File"); |
|
|
|
debugger; |
|
|
|
return; |
|
|
|
} |
|
|
|
const type = await fileTypeFromBuffer(thumb); |
|
|
|
const url = URL.createObjectURL(new Blob([thumb], { type: type?.mime })); |
|
|
|
a.href = url; |
|
|
@ -16772,8 +16779,9 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
var EMBED_TYPES = /* @__PURE__ */ ((EMBED_TYPES2) => { |
|
|
|
EMBED_TYPES2[EMBED_TYPES2["THIRD_EYE"] = 0] = "THIRD_EYE"; |
|
|
|
EMBED_TYPES2[EMBED_TYPES2["MEDIA_EMBED"] = 1] = "MEDIA_EMBED"; |
|
|
|
EMBED_TYPES2[EMBED_TYPES2["EXTERNAL_BOORU"] = 0] = "EXTERNAL_BOORU"; |
|
|
|
EMBED_TYPES2[EMBED_TYPES2["EXTERNAL_POMF"] = 1] = "EXTERNAL_POMF"; |
|
|
|
EMBED_TYPES2[EMBED_TYPES2["MEDIA_EMBED"] = 2] = "MEDIA_EMBED"; |
|
|
|
return EMBED_TYPES2; |
|
|
|
})(EMBED_TYPES || {}); |
|
|
|
var EMBED_STATUS = /* @__PURE__ */ ((EMBED_STATUS2) => { |
|
|
@ -16788,13 +16796,21 @@ |
|
|
|
if (proc.skip) { |
|
|
|
const md5 = import_buffer5.Buffer.from(hex, "base64"); |
|
|
|
const embed_status = await proc.has_embed(md5, fn); |
|
|
|
if (embed_status === 0 /* SUCCESS */ || embed_status === 1 /* TE_BLACKLISTED */) { |
|
|
|
const isBlacklisted = embed_status === 1 /* TE_BLACKLISTED */; |
|
|
|
if (embed_status === 0 /* SUCCESS */ || isBlacklisted) { |
|
|
|
const file2 = await proc.extract(md5, fn); |
|
|
|
if (embed_status === 1 /* TE_BLACKLISTED */) |
|
|
|
file2?.forEach((e) => { |
|
|
|
let type; |
|
|
|
file2?.forEach((e) => { |
|
|
|
type = e.embed_type; |
|
|
|
if (isBlacklisted) |
|
|
|
e.isBlacklisted = true; |
|
|
|
}); |
|
|
|
return [file2, 0 /* THIRD_EYE */]; |
|
|
|
}); |
|
|
|
if (type == null) { |
|
|
|
debugger; |
|
|
|
return; |
|
|
|
} |
|
|
|
; |
|
|
|
return [file2, type]; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
@ -16821,7 +16837,7 @@ |
|
|
|
return; |
|
|
|
} |
|
|
|
const file = await proc.extract(cumul); |
|
|
|
return [file, 1 /* MEDIA_EMBED */]; |
|
|
|
return [file, 2 /* MEDIA_EMBED */]; |
|
|
|
})); |
|
|
|
}; |
|
|
|
var textToElement = (s) => document.createRange().createContextualFragment(s).children[0]; |
|
|
@ -16980,9 +16996,9 @@ |
|
|
|
function processAttachments(post, ress) { |
|
|
|
const replyBox = post.querySelector(".post"); |
|
|
|
const embed_status = ress[0][1]; |
|
|
|
if (embed_status === 0 /* THIRD_EYE */) |
|
|
|
if (embed_status === 0 /* EXTERNAL_BOORU */ || embed_status === 1 /* EXTERNAL_POMF */) |
|
|
|
replyBox?.classList.add("hasext"); |
|
|
|
else if (embed_status === 1 /* MEDIA_EMBED */) |
|
|
|
else if (embed_status === 2 /* MEDIA_EMBED */) |
|
|
|
replyBox?.classList.add("hasembed"); |
|
|
|
if (ress.length > 1) |
|
|
|
replyBox?.classList.add("hasmultiple"); |
|
|
|