Browse Source

Fix embedding in clipboard pasted content, add embed from clipboard button

pull/46/head
coomdev 2 years ago
parent
commit
eb02018463
  1. 4
      README.md
  2. 2
      build-ff.js
  3. 278
      chrome/dist/main.js
  4. 2
      chrome/manifest.json
  5. 4554
      dist/main.js
  6. 0
      efdb47d2f0e04144bbaa-0.247.xpi
  7. 278
      firefox/dist/main.js
  8. 2
      firefox/manifest.json
  9. 2
      firefox_update.json
  10. 2
      main.meta.js
  11. 280
      main.user.js
  12. 7850
      package-lock.json
  13. 8
      package.json
  14. BIN
      pngextraembedder-0.249.xpi
  15. 10
      src/Components/App.svelte
  16. 60
      src/Components/PostOptions.svelte
  17. 2
      src/webm.ts

4
README.md

@ -25,7 +25,7 @@ Please report any issue you have with those (only for mainstream browsers)
Also, use this if you plan to use b4k's archive.
- [Install 4chanX (recommended)](https://www.4chan-x.net/builds/4chan-X.user.js)
- Install the correct WebExtension for your Browser ([Firefox](https://git.coom.tech/coomdev/PEE/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.247.xpi) or [Chrome-based](https://chrome.google.com/webstore/detail/pngextraembedder/bfhpobiikighljcapcfmfganodihbicj))
- Install the correct WebExtension for your Browser ([Firefox](https://git.coom.tech/coomdev/PEE/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.249.xpi) or [Chrome-based](https://chrome.google.com/webstore/detail/pngextraembedder/bfhpobiikighljcapcfmfganodihbicj))
For FF users, the extension is signed so you can just drag and drop it on your about:addons tab.
@ -67,6 +67,8 @@ Your embeds will be attached as you add them after you've selected a file, but c
By default, you can add up to 5 attachments to a file. This limit can be raised, but keep in mind others using the default settings will only see your 5 first files, unless they themselves raised that limit in the settings.
You can also paste files from your clipboard. Click the clipboard button that appears when you hover over the magnet icon, then press CTRL+V.
### Thread Watcher
The "thread watcher" allows you to find threads that contain embeds.

2
build-ff.js

@ -161,7 +161,7 @@ const manif = {
"updates": [
{
"version": manif.version,
"update_link": "https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.241.xpi",
"update_link": `https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-${manif.version}.xpi`,
}
]
}

278
chrome/dist/main.js

@ -51,7 +51,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 247];
define_BUILD_VERSION_default = [0, 249];
}
});
@ -16886,7 +16886,7 @@
var has_embed2 = (webm) => {
const dec = new ebml.Decoder();
const chunks = dec.decode(webm);
const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && e.value == "DOOM");
const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM"));
const cl = chunks.find((e) => e.name == "Cluster");
if (cl && embed2 == -1)
return false;
@ -21322,65 +21322,6 @@
}
};
}
function create_if_block_22(ctx) {
let tabpanel;
let current;
tabpanel = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
}
});
return {
c() {
create_component(tabpanel.$$.fragment);
},
m(target, anchor) {
mount_component(tabpanel, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(tabpanel.$$.fragment, local);
current = true;
},
o(local) {
transition_out(tabpanel.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(tabpanel, detaching);
}
};
}
function create_default_slot_2(ctx) {
let hydrussearch;
let current;
hydrussearch = new HydrusSearch_default({});
return {
c() {
create_component(hydrussearch.$$.fragment);
},
m(target, anchor) {
mount_component(hydrussearch, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(hydrussearch.$$.fragment, local);
current = true;
},
o(local) {
transition_out(hydrussearch.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(hydrussearch, detaching);
}
};
}
function create_else_block2(ctx) {
let each_1_anchor;
let each_value = ctx[3];
@ -21428,7 +21369,7 @@
}
};
}
function create_if_block_12(ctx) {
function create_if_block_22(ctx) {
let p;
return {
c() {
@ -21484,13 +21425,13 @@
}
};
}
function create_default_slot_1(ctx) {
function create_default_slot_2(ctx) {
let p;
let t2;
let div;
function select_block_type_1(ctx2, dirty) {
if (ctx2[3].length == 0)
return create_if_block_12;
return create_if_block_22;
return create_else_block2;
}
let current_block_type = select_block_type_1(ctx, [-1, -1, -1]);
@ -21533,6 +21474,65 @@
}
};
}
function create_if_block_12(ctx) {
let tabpanel;
let current;
tabpanel = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_1] },
$$scope: { ctx }
}
});
return {
c() {
create_component(tabpanel.$$.fragment);
},
m(target, anchor) {
mount_component(tabpanel, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(tabpanel.$$.fragment, local);
current = true;
},
o(local) {
transition_out(tabpanel.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(tabpanel, detaching);
}
};
}
function create_default_slot_1(ctx) {
let hydrussearch;
let current;
hydrussearch = new HydrusSearch_default({});
return {
c() {
create_component(hydrussearch.$$.fragment);
},
m(target, anchor) {
mount_component(hydrussearch, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(hydrussearch.$$.fragment, local);
current = true;
},
o(local) {
transition_out(hydrussearch.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(hydrussearch, detaching);
}
};
}
function create_default_slot(ctx) {
let tablist;
let t0;
@ -21544,8 +21544,9 @@
let t3;
let tabpanel3;
let t4;
let t5;
let tabpanel4;
let t5;
let if_block_anchor;
let current;
tablist = new TabList_default({
props: {
@ -21577,13 +21578,13 @@
$$scope: { ctx }
}
});
let if_block = ctx[8].akValid && create_if_block_22(ctx);
tabpanel4 = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_1] },
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
}
});
let if_block = ctx[8].akValid && create_if_block_12(ctx);
return {
c() {
create_component(tablist.$$.fragment);
@ -21596,10 +21597,11 @@
t3 = space();
create_component(tabpanel3.$$.fragment);
t4 = space();
create_component(tabpanel4.$$.fragment);
t5 = space();
if (if_block)
if_block.c();
t5 = space();
create_component(tabpanel4.$$.fragment);
if_block_anchor = empty();
},
m(target, anchor) {
mount_component(tablist, target, anchor);
@ -21612,10 +21614,11 @@
insert(target, t3, anchor);
mount_component(tabpanel3, target, anchor);
insert(target, t4, anchor);
mount_component(tabpanel4, target, anchor);
insert(target, t5, anchor);
if (if_block)
if_block.m(target, anchor);
insert(target, t5, anchor);
mount_component(tabpanel4, target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, dirty) {
@ -21644,16 +21647,21 @@
tabpanel3_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel3.$set(tabpanel3_changes);
const tabpanel4_changes = {};
if (dirty[0] & 8 | dirty[2] & 256) {
tabpanel4_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel4.$set(tabpanel4_changes);
if (ctx2[8].akValid) {
if (if_block) {
if (dirty[0] & 256) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block_22(ctx2);
if_block = create_if_block_12(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(t5.parentNode, t5);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
@ -21662,11 +21670,6 @@
});
check_outros();
}
const tabpanel4_changes = {};
if (dirty[0] & 8 | dirty[2] & 256) {
tabpanel4_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel4.$set(tabpanel4_changes);
},
i(local) {
if (current)
@ -21676,8 +21679,8 @@
transition_in(tabpanel1.$$.fragment, local);
transition_in(tabpanel2.$$.fragment, local);
transition_in(tabpanel3.$$.fragment, local);
transition_in(if_block);
transition_in(tabpanel4.$$.fragment, local);
transition_in(if_block);
current = true;
},
o(local) {
@ -21686,8 +21689,8 @@
transition_out(tabpanel1.$$.fragment, local);
transition_out(tabpanel2.$$.fragment, local);
transition_out(tabpanel3.$$.fragment, local);
transition_out(if_block);
transition_out(tabpanel4.$$.fragment, local);
transition_out(if_block);
current = false;
},
d(detaching) {
@ -21706,11 +21709,13 @@
destroy_component(tabpanel3, detaching);
if (detaching)
detach(t4);
destroy_component(tabpanel4, detaching);
if (detaching)
detach(t5);
if (if_block)
if_block.d(detaching);
if (detaching)
detach(t5);
destroy_component(tabpanel4, detaching);
detach(if_block_anchor);
}
};
}
@ -22297,7 +22302,7 @@
function create_if_block8(ctx) {
let a;
let i;
let t_value = ctx[1].is4chanX ? "" : "\u274C";
let t_value = ctx[2].is4chanX ? "" : "\u274C";
let t;
let a_title_value;
let mounted;
@ -22316,12 +22321,12 @@
append(a, i);
append(i, t);
if (!mounted) {
dispose = listen(a, "click", ctx[7]);
dispose = listen(a, "click", ctx[8]);
mounted = true;
}
},
p(ctx2, dirty) {
if (dirty & 2 && t_value !== (t_value = ctx2[1].is4chanX ? "" : "\u274C"))
if (dirty & 4 && t_value !== (t_value = ctx2[2].is4chanX ? "" : "\u274C"))
set_data(t, t_value);
if (dirty & 1 && a_title_value !== (a_title_value = "Discard ALL " + ctx2[0].length + " files")) {
attr(a, "title", a_title_value);
@ -22339,15 +22344,20 @@
let div1;
let a0;
let i0;
let t0_value = ctx[1].is4chanX ? "" : "\u{1F9F2}";
let t0_value = ctx[2].is4chanX ? "" : "\u{1F9F2}";
let t0;
let t1;
let div0;
let a1;
let i1;
let t2_value = ctx[1].is4chanX ? "" : "\u{1F589}";
let t2_value = ctx[2].is4chanX ? "" : "\u{1F589}";
let t2;
let t3;
let a2;
let i2;
let t4_value = ctx[2].is4chanX ? "" : "\u{1F4CB}";
let t4;
let t5;
let mounted;
let dispose;
let if_block = ctx[0].length && create_if_block8(ctx);
@ -22363,6 +22373,10 @@
i1 = element("i");
t2 = text(t2_value);
t3 = space();
a2 = element("a");
i2 = element("i");
t4 = text(t4_value);
t5 = space();
if (if_block)
if_block.c();
attr(i0, "class", "fa fa-magnet svelte-bgqqj3");
@ -22371,6 +22385,9 @@
attr(i1, "class", "fa fa-pencil svelte-bgqqj3");
attr(a1, "title", "Add a message (this uses the content of the comment text box)");
attr(a1, "class", "svelte-bgqqj3");
attr(i2, "class", "fa fa-clipboard svelte-bgqqj3");
attr(a2, "title", "Add from clipboard (click this then CTRL+v)");
attr(a2, "class", "svelte-bgqqj3");
attr(div0, "class", "additionnal svelte-bgqqj3");
attr(div1, "class", "root svelte-bgqqj3");
},
@ -22385,21 +22402,28 @@
append(a1, i1);
append(i1, t2);
append(div0, t3);
append(div0, a2);
append(a2, i2);
append(i2, t4);
append(div0, t5);
if (if_block)
if_block.m(div0, null);
ctx[9](div0);
if (!mounted) {
dispose = [
listen(a0, "click", ctx[4]),
listen(a1, "click", ctx[3])
listen(a0, "click", ctx[5]),
listen(a1, "click", ctx[4])
];
mounted = true;
}
},
p(ctx2, [dirty]) {
if (dirty & 2 && t0_value !== (t0_value = ctx2[1].is4chanX ? "" : "\u{1F9F2}"))
if (dirty & 4 && t0_value !== (t0_value = ctx2[2].is4chanX ? "" : "\u{1F9F2}"))
set_data(t0, t0_value);
if (dirty & 2 && t2_value !== (t2_value = ctx2[1].is4chanX ? "" : "\u{1F589}"))
if (dirty & 4 && t2_value !== (t2_value = ctx2[2].is4chanX ? "" : "\u{1F589}"))
set_data(t2, t2_value);
if (dirty & 4 && t4_value !== (t4_value = ctx2[2].is4chanX ? "" : "\u{1F4CB}"))
set_data(t4, t4_value);
if (ctx2[0].length) {
if (if_block) {
if_block.p(ctx2, dirty);
@ -22420,6 +22444,7 @@
detach(div1);
if (if_block)
if_block.d();
ctx[9](null);
mounted = false;
run_all(dispose);
}
@ -22428,11 +22453,41 @@
function instance11($$self, $$props, $$invalidate) {
let $settings;
let $appState;
component_subscribe($$self, settings, ($$value) => $$invalidate(11, $settings = $$value));
component_subscribe($$self, appState, ($$value) => $$invalidate(1, $appState = $$value));
component_subscribe($$self, settings, ($$value) => $$invalidate(13, $settings = $$value));
component_subscribe($$self, appState, ($$value) => $$invalidate(2, $appState = $$value));
let { processors: processors2 = [] } = $$props;
let { textinput } = $$props;
let { links = [] } = $$props;
let floating;
const isParentOrSame = (p, ofe) => {
while (ofe && ofe != document.body) {
if (p == ofe)
return true;
ofe = ofe.parentElement;
}
return false;
};
const handleGlobalPaste = (e) => {
if (!e.clipboardData) {
return;
}
if (isParentOrSame(floating, e.target)) {
if (e.clipboardData.files.length == 0) {
if (e.clipboardData.types.includes("text/plain")) {
const data = e.clipboardData.getData("text/plain");
addContent(new File([new Blob([data], { type: "text/plain" })], `message${links.length}.txt`));
}
} else {
addContent(...[...e.clipboardData.files]);
}
e.stopImmediatePropagation();
e.stopPropagation();
return true;
}
};
onMount(() => {
document.addEventListener("paste", handleGlobalPaste, true);
});
const addContent = async (...newfiles) => {
$$invalidate(0, links = [...links, ...await uploadFiles(newfiles)]);
return embedContent({});
@ -22484,15 +22539,24 @@
return;
}
await addContent(new File([new Blob([textinput.value], { type: "text/plain" })], `message${links.length}.txt`));
$$invalidate(5, textinput.value = "", textinput);
$$invalidate(6, textinput.value = "", textinput);
};
const embedContent = async (e) => {
const file = original;
if (!file)
let tfile = original;
if (!tfile)
return;
if (links.length == 0)
return;
const type = file.type;
const type = tfile.type;
let file;
if (!(tfile instanceof File)) {
const et = await fileTypeFromBuffer(await tfile.arrayBuffer());
if (!et)
throw new Error("Unsupported container type");
file = new File([tfile], `file.${et.ext}`);
} else {
file = tfile;
}
try {
const proc = processors2.filter((e2) => e2.inject).find((e2) => e2.match(file.name));
if (!proc)
@ -22520,39 +22584,47 @@
input.click();
};
const click_handler2 = () => ($$invalidate(0, links = []), restore());
function div0_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
floating = $$value;
$$invalidate(1, floating);
});
}
$$self.$$set = ($$props2) => {
if ("processors" in $$props2)
$$invalidate(6, processors2 = $$props2.processors);
$$invalidate(7, processors2 = $$props2.processors);
if ("textinput" in $$props2)
$$invalidate(5, textinput = $$props2.textinput);
$$invalidate(6, textinput = $$props2.textinput);
if ("links" in $$props2)
$$invalidate(0, links = $$props2.links);
};
return [
links,
floating,
$appState,
restore,
embedText,
embedFile,
textinput,
processors2,
click_handler2
click_handler2,
div0_binding
];
}
var PostOptions = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance11, create_fragment11, safe_not_equal, { processors: 6, textinput: 5, links: 0 }, add_css10);
init(this, options, instance11, create_fragment11, safe_not_equal, { processors: 7, textinput: 6, links: 0 }, add_css10);
}
get processors() {
return this.$$.ctx[6];
return this.$$.ctx[7];
}
set processors(processors2) {
this.$$set({ processors: processors2 });
flush();
}
get textinput() {
return this.$$.ctx[5];
return this.$$.ctx[6];
}
set textinput(textinput) {
this.$$set({ textinput });

2
chrome/manifest.json

@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "PngExtraEmbedder",
"description": "Discover embedded files on 4chan and archives!",
"version": "0.247",
"version": "0.249",
"icons": {
"64": "1449696017588.png"
},

4554
dist/main.js

File diff suppressed because it is too large

0
pngextraembedder-0.247.xpi → efdb47d2f0e04144bbaa-0.247.xpi

278
firefox/dist/main.js

@ -51,7 +51,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 247];
define_BUILD_VERSION_default = [0, 249];
}
});
@ -16842,7 +16842,7 @@
var has_embed2 = (webm) => {
const dec = new ebml.Decoder();
const chunks = dec.decode(webm);
const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && e.value == "DOOM");
const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM"));
const cl = chunks.find((e) => e.name == "Cluster");
if (cl && embed2 == -1)
return false;
@ -21278,65 +21278,6 @@
}
};
}
function create_if_block_22(ctx) {
let tabpanel;
let current;
tabpanel = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
}
});
return {
c() {
create_component(tabpanel.$$.fragment);
},
m(target, anchor) {
mount_component(tabpanel, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(tabpanel.$$.fragment, local);
current = true;
},
o(local) {
transition_out(tabpanel.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(tabpanel, detaching);
}
};
}
function create_default_slot_2(ctx) {
let hydrussearch;
let current;
hydrussearch = new HydrusSearch_default({});
return {
c() {
create_component(hydrussearch.$$.fragment);
},
m(target, anchor) {
mount_component(hydrussearch, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(hydrussearch.$$.fragment, local);
current = true;
},
o(local) {
transition_out(hydrussearch.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(hydrussearch, detaching);
}
};
}
function create_else_block2(ctx) {
let each_1_anchor;
let each_value = ctx[3];
@ -21384,7 +21325,7 @@
}
};
}
function create_if_block_12(ctx) {
function create_if_block_22(ctx) {
let p;
return {
c() {
@ -21440,13 +21381,13 @@
}
};
}
function create_default_slot_1(ctx) {
function create_default_slot_2(ctx) {
let p;
let t2;
let div;
function select_block_type_1(ctx2, dirty) {
if (ctx2[3].length == 0)
return create_if_block_12;
return create_if_block_22;
return create_else_block2;
}
let current_block_type = select_block_type_1(ctx, [-1, -1, -1]);
@ -21489,6 +21430,65 @@
}
};
}
function create_if_block_12(ctx) {
let tabpanel;
let current;
tabpanel = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_1] },
$$scope: { ctx }
}
});
return {
c() {
create_component(tabpanel.$$.fragment);
},
m(target, anchor) {
mount_component(tabpanel, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(tabpanel.$$.fragment, local);
current = true;
},
o(local) {
transition_out(tabpanel.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(tabpanel, detaching);
}
};
}
function create_default_slot_1(ctx) {
let hydrussearch;
let current;
hydrussearch = new HydrusSearch_default({});
return {
c() {
create_component(hydrussearch.$$.fragment);
},
m(target, anchor) {
mount_component(hydrussearch, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(hydrussearch.$$.fragment, local);
current = true;
},
o(local) {
transition_out(hydrussearch.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(hydrussearch, detaching);
}
};
}
function create_default_slot(ctx) {
let tablist;
let t0;
@ -21500,8 +21500,9 @@
let t3;
let tabpanel3;
let t4;
let t5;
let tabpanel4;
let t5;
let if_block_anchor;
let current;
tablist = new TabList_default({
props: {
@ -21533,13 +21534,13 @@
$$scope: { ctx }
}
});
let if_block = ctx[8].akValid && create_if_block_22(ctx);
tabpanel4 = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_1] },
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
}
});
let if_block = ctx[8].akValid && create_if_block_12(ctx);
return {
c() {
create_component(tablist.$$.fragment);
@ -21552,10 +21553,11 @@
t3 = space();
create_component(tabpanel3.$$.fragment);
t4 = space();
create_component(tabpanel4.$$.fragment);
t5 = space();
if (if_block)
if_block.c();
t5 = space();
create_component(tabpanel4.$$.fragment);
if_block_anchor = empty();
},
m(target, anchor) {
mount_component(tablist, target, anchor);
@ -21568,10 +21570,11 @@
insert(target, t3, anchor);
mount_component(tabpanel3, target, anchor);
insert(target, t4, anchor);
mount_component(tabpanel4, target, anchor);
insert(target, t5, anchor);
if (if_block)
if_block.m(target, anchor);
insert(target, t5, anchor);
mount_component(tabpanel4, target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, dirty) {
@ -21600,16 +21603,21 @@
tabpanel3_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel3.$set(tabpanel3_changes);
const tabpanel4_changes = {};
if (dirty[0] & 8 | dirty[2] & 256) {
tabpanel4_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel4.$set(tabpanel4_changes);
if (ctx2[8].akValid) {
if (if_block) {
if (dirty[0] & 256) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block_22(ctx2);
if_block = create_if_block_12(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(t5.parentNode, t5);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
@ -21618,11 +21626,6 @@
});
check_outros();
}
const tabpanel4_changes = {};
if (dirty[0] & 8 | dirty[2] & 256) {
tabpanel4_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel4.$set(tabpanel4_changes);
},
i(local) {
if (current)
@ -21632,8 +21635,8 @@
transition_in(tabpanel1.$$.fragment, local);
transition_in(tabpanel2.$$.fragment, local);
transition_in(tabpanel3.$$.fragment, local);
transition_in(if_block);
transition_in(tabpanel4.$$.fragment, local);
transition_in(if_block);
current = true;
},
o(local) {
@ -21642,8 +21645,8 @@
transition_out(tabpanel1.$$.fragment, local);
transition_out(tabpanel2.$$.fragment, local);
transition_out(tabpanel3.$$.fragment, local);
transition_out(if_block);
transition_out(tabpanel4.$$.fragment, local);
transition_out(if_block);
current = false;
},
d(detaching) {
@ -21662,11 +21665,13 @@
destroy_component(tabpanel3, detaching);
if (detaching)
detach(t4);
destroy_component(tabpanel4, detaching);
if (detaching)
detach(t5);
if (if_block)
if_block.d(detaching);
if (detaching)
detach(t5);
destroy_component(tabpanel4, detaching);
detach(if_block_anchor);
}
};
}
@ -22253,7 +22258,7 @@
function create_if_block8(ctx) {
let a;
let i;
let t_value = ctx[1].is4chanX ? "" : "\u274C";
let t_value = ctx[2].is4chanX ? "" : "\u274C";
let t;
let a_title_value;
let mounted;
@ -22272,12 +22277,12 @@
append(a, i);
append(i, t);
if (!mounted) {
dispose = listen(a, "click", ctx[7]);
dispose = listen(a, "click", ctx[8]);
mounted = true;
}
},
p(ctx2, dirty) {
if (dirty & 2 && t_value !== (t_value = ctx2[1].is4chanX ? "" : "\u274C"))
if (dirty & 4 && t_value !== (t_value = ctx2[2].is4chanX ? "" : "\u274C"))
set_data(t, t_value);
if (dirty & 1 && a_title_value !== (a_title_value = "Discard ALL " + ctx2[0].length + " files")) {
attr(a, "title", a_title_value);
@ -22295,15 +22300,20 @@
let div1;
let a0;
let i0;
let t0_value = ctx[1].is4chanX ? "" : "\u{1F9F2}";
let t0_value = ctx[2].is4chanX ? "" : "\u{1F9F2}";
let t0;
let t1;
let div0;
let a1;
let i1;
let t2_value = ctx[1].is4chanX ? "" : "\u{1F589}";
let t2_value = ctx[2].is4chanX ? "" : "\u{1F589}";
let t2;
let t3;
let a2;
let i2;
let t4_value = ctx[2].is4chanX ? "" : "\u{1F4CB}";
let t4;
let t5;
let mounted;
let dispose;
let if_block = ctx[0].length && create_if_block8(ctx);
@ -22319,6 +22329,10 @@
i1 = element("i");
t2 = text(t2_value);
t3 = space();
a2 = element("a");
i2 = element("i");
t4 = text(t4_value);
t5 = space();
if (if_block)
if_block.c();
attr(i0, "class", "fa fa-magnet svelte-bgqqj3");
@ -22327,6 +22341,9 @@
attr(i1, "class", "fa fa-pencil svelte-bgqqj3");
attr(a1, "title", "Add a message (this uses the content of the comment text box)");
attr(a1, "class", "svelte-bgqqj3");
attr(i2, "class", "fa fa-clipboard svelte-bgqqj3");
attr(a2, "title", "Add from clipboard (click this then CTRL+v)");
attr(a2, "class", "svelte-bgqqj3");
attr(div0, "class", "additionnal svelte-bgqqj3");
attr(div1, "class", "root svelte-bgqqj3");
},
@ -22341,21 +22358,28 @@
append(a1, i1);
append(i1, t2);
append(div0, t3);
append(div0, a2);
append(a2, i2);
append(i2, t4);
append(div0, t5);
if (if_block)
if_block.m(div0, null);
ctx[9](div0);
if (!mounted) {
dispose = [
listen(a0, "click", ctx[4]),
listen(a1, "click", ctx[3])
listen(a0, "click", ctx[5]),
listen(a1, "click", ctx[4])
];
mounted = true;
}
},
p(ctx2, [dirty]) {
if (dirty & 2 && t0_value !== (t0_value = ctx2[1].is4chanX ? "" : "\u{1F9F2}"))
if (dirty & 4 && t0_value !== (t0_value = ctx2[2].is4chanX ? "" : "\u{1F9F2}"))
set_data(t0, t0_value);
if (dirty & 2 && t2_value !== (t2_value = ctx2[1].is4chanX ? "" : "\u{1F589}"))
if (dirty & 4 && t2_value !== (t2_value = ctx2[2].is4chanX ? "" : "\u{1F589}"))
set_data(t2, t2_value);
if (dirty & 4 && t4_value !== (t4_value = ctx2[2].is4chanX ? "" : "\u{1F4CB}"))
set_data(t4, t4_value);
if (ctx2[0].length) {
if (if_block) {
if_block.p(ctx2, dirty);
@ -22376,6 +22400,7 @@
detach(div1);
if (if_block)
if_block.d();
ctx[9](null);
mounted = false;
run_all(dispose);
}
@ -22384,11 +22409,41 @@
function instance11($$self, $$props, $$invalidate) {
let $settings;
let $appState;
component_subscribe($$self, settings, ($$value) => $$invalidate(11, $settings = $$value));
component_subscribe($$self, appState, ($$value) => $$invalidate(1, $appState = $$value));
component_subscribe($$self, settings, ($$value) => $$invalidate(13, $settings = $$value));
component_subscribe($$self, appState, ($$value) => $$invalidate(2, $appState = $$value));
let { processors: processors2 = [] } = $$props;
let { textinput } = $$props;
let { links = [] } = $$props;
let floating;
const isParentOrSame = (p, ofe) => {
while (ofe && ofe != document.body) {
if (p == ofe)
return true;
ofe = ofe.parentElement;
}
return false;
};
const handleGlobalPaste = (e) => {
if (!e.clipboardData) {
return;
}
if (isParentOrSame(floating, e.target)) {
if (e.clipboardData.files.length == 0) {
if (e.clipboardData.types.includes("text/plain")) {
const data = e.clipboardData.getData("text/plain");
addContent(new File([new Blob([data], { type: "text/plain" })], `message${links.length}.txt`));
}
} else {
addContent(...[...e.clipboardData.files]);
}
e.stopImmediatePropagation();
e.stopPropagation();
return true;
}
};
onMount(() => {
document.addEventListener("paste", handleGlobalPaste, true);
});
const addContent = async (...newfiles) => {
$$invalidate(0, links = [...links, ...await uploadFiles(newfiles)]);
return embedContent({});
@ -22440,15 +22495,24 @@
return;
}
await addContent(new File([new Blob([textinput.value], { type: "text/plain" })], `message${links.length}.txt`));
$$invalidate(5, textinput.value = "", textinput);
$$invalidate(6, textinput.value = "", textinput);
};
const embedContent = async (e) => {
const file = original;
if (!file)
let tfile = original;
if (!tfile)
return;
if (links.length == 0)
return;
const type = file.type;
const type = tfile.type;
let file;
if (!(tfile instanceof File)) {
const et = await fileTypeFromBuffer(await tfile.arrayBuffer());
if (!et)
throw new Error("Unsupported container type");
file = new File([tfile], `file.${et.ext}`);
} else {
file = tfile;
}
try {
const proc = processors2.filter((e2) => e2.inject).find((e2) => e2.match(file.name));
if (!proc)
@ -22476,39 +22540,47 @@
input.click();
};
const click_handler2 = () => ($$invalidate(0, links = []), restore());
function div0_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
floating = $$value;
$$invalidate(1, floating);
});
}
$$self.$$set = ($$props2) => {
if ("processors" in $$props2)
$$invalidate(6, processors2 = $$props2.processors);
$$invalidate(7, processors2 = $$props2.processors);
if ("textinput" in $$props2)
$$invalidate(5, textinput = $$props2.textinput);
$$invalidate(6, textinput = $$props2.textinput);
if ("links" in $$props2)
$$invalidate(0, links = $$props2.links);
};
return [
links,
floating,
$appState,
restore,
embedText,
embedFile,
textinput,
processors2,
click_handler2
click_handler2,
div0_binding
];
}
var PostOptions = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance11, create_fragment11, safe_not_equal, { processors: 6, textinput: 5, links: 0 }, add_css10);
init(this, options, instance11, create_fragment11, safe_not_equal, { processors: 7, textinput: 6, links: 0 }, add_css10);
}
get processors() {
return this.$$.ctx[6];
return this.$$.ctx[7];
}
set processors(processors2) {
this.$$set({ processors: processors2 });
flush();
}
get textinput() {
return this.$$.ctx[5];
return this.$$.ctx[6];
}
set textinput(textinput) {
this.$$set({ textinput });

2
firefox/manifest.json

@ -7,7 +7,7 @@
},
"name": "PngExtraEmbedder",
"description": "Discover embedded files on 4chan and archives!",
"version": "0.247",
"version": "0.249",
"icons": {
"64": "1449696017588.png"
},

2
firefox_update.json

@ -1 +1 @@
{"addons":{"{34ac4994-07f2-44d2-8599-682516a6c6a6}":{"updates":[{"version":"0.245","update_link":"https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.241.xpi"}]}}}
{"addons":{"{34ac4994-07f2-44d2-8599-682516a6c6a6}":{"updates":[{"version":"0.249","update_link":"https://git.coom.tech/fuckjannies/lolipiss/raw/branch/%E4%B8%AD%E5%87%BA%E3%81%97/pngextraembedder-0.249.xpi"}]}}}

2
main.meta.js

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

280
main.user.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.247
// @version 0.249
// @description uhh
// @author You
// @match https://boards.4channel.org/*
@ -87,7 +87,7 @@ const _DOMParser = DOMParser;
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 247];
define_BUILD_VERSION_default = [0, 249];
}
});
@ -16753,7 +16753,7 @@ const _DOMParser = DOMParser;
var has_embed2 = (webm) => {
const dec = new ebml.Decoder();
const chunks = dec.decode(webm);
const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && e.value == "DOOM");
const embed2 = chunks.findIndex((e) => e.name == "TagName" && e.type == "8" && (e.value == "DOOM" || e.value == "VOOM"));
const cl = chunks.find((e) => e.name == "Cluster");
if (cl && embed2 == -1)
return false;
@ -21189,65 +21189,6 @@ const _DOMParser = DOMParser;
}
};
}
function create_if_block_22(ctx) {
let tabpanel;
let current;
tabpanel = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
}
});
return {
c() {
create_component(tabpanel.$$.fragment);
},
m(target, anchor) {
mount_component(tabpanel, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(tabpanel.$$.fragment, local);
current = true;
},
o(local) {
transition_out(tabpanel.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(tabpanel, detaching);
}
};
}
function create_default_slot_2(ctx) {
let hydrussearch;
let current;
hydrussearch = new HydrusSearch_default({});
return {
c() {
create_component(hydrussearch.$$.fragment);
},
m(target, anchor) {
mount_component(hydrussearch, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(hydrussearch.$$.fragment, local);
current = true;
},
o(local) {
transition_out(hydrussearch.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(hydrussearch, detaching);
}
};
}
function create_else_block2(ctx) {
let each_1_anchor;
let each_value = ctx[3];
@ -21295,7 +21236,7 @@ const _DOMParser = DOMParser;
}
};
}
function create_if_block_12(ctx) {
function create_if_block_22(ctx) {
let p;
return {
c() {
@ -21351,13 +21292,13 @@ const _DOMParser = DOMParser;
}
};
}
function create_default_slot_1(ctx) {
function create_default_slot_2(ctx) {
let p;
let t2;
let div;
function select_block_type_1(ctx2, dirty) {
if (ctx2[3].length == 0)
return create_if_block_12;
return create_if_block_22;
return create_else_block2;
}
let current_block_type = select_block_type_1(ctx, [-1, -1, -1]);
@ -21400,6 +21341,65 @@ const _DOMParser = DOMParser;
}
};
}
function create_if_block_12(ctx) {
let tabpanel;
let current;
tabpanel = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_1] },
$$scope: { ctx }
}
});
return {
c() {
create_component(tabpanel.$$.fragment);
},
m(target, anchor) {
mount_component(tabpanel, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(tabpanel.$$.fragment, local);
current = true;
},
o(local) {
transition_out(tabpanel.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(tabpanel, detaching);
}
};
}
function create_default_slot_1(ctx) {
let hydrussearch;
let current;
hydrussearch = new HydrusSearch_default({});
return {
c() {
create_component(hydrussearch.$$.fragment);
},
m(target, anchor) {
mount_component(hydrussearch, target, anchor);
current = true;
},
i(local) {
if (current)
return;
transition_in(hydrussearch.$$.fragment, local);
current = true;
},
o(local) {
transition_out(hydrussearch.$$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(hydrussearch, detaching);
}
};
}
function create_default_slot(ctx) {
let tablist;
let t0;
@ -21411,8 +21411,9 @@ const _DOMParser = DOMParser;
let t3;
let tabpanel3;
let t4;
let t5;
let tabpanel4;
let t5;
let if_block_anchor;
let current;
tablist = new TabList_default({
props: {
@ -21444,13 +21445,13 @@ const _DOMParser = DOMParser;
$$scope: { ctx }
}
});
let if_block = ctx[8].akValid && create_if_block_22(ctx);
tabpanel4 = new TabPanel_default({
props: {
$$slots: { default: [create_default_slot_1] },
$$slots: { default: [create_default_slot_2] },
$$scope: { ctx }
}
});
let if_block = ctx[8].akValid && create_if_block_12(ctx);
return {
c() {
create_component(tablist.$$.fragment);
@ -21463,10 +21464,11 @@ const _DOMParser = DOMParser;
t3 = space();
create_component(tabpanel3.$$.fragment);
t4 = space();
create_component(tabpanel4.$$.fragment);
t5 = space();
if (if_block)
if_block.c();
t5 = space();
create_component(tabpanel4.$$.fragment);
if_block_anchor = empty();
},
m(target, anchor) {
mount_component(tablist, target, anchor);
@ -21479,10 +21481,11 @@ const _DOMParser = DOMParser;
insert(target, t3, anchor);
mount_component(tabpanel3, target, anchor);
insert(target, t4, anchor);
mount_component(tabpanel4, target, anchor);
insert(target, t5, anchor);
if (if_block)
if_block.m(target, anchor);
insert(target, t5, anchor);
mount_component(tabpanel4, target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, dirty) {
@ -21511,16 +21514,21 @@ const _DOMParser = DOMParser;
tabpanel3_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel3.$set(tabpanel3_changes);
const tabpanel4_changes = {};
if (dirty[0] & 8 | dirty[2] & 256) {
tabpanel4_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel4.$set(tabpanel4_changes);
if (ctx2[8].akValid) {
if (if_block) {
if (dirty[0] & 256) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block_22(ctx2);
if_block = create_if_block_12(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(t5.parentNode, t5);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
@ -21529,11 +21537,6 @@ const _DOMParser = DOMParser;
});
check_outros();
}
const tabpanel4_changes = {};
if (dirty[0] & 8 | dirty[2] & 256) {
tabpanel4_changes.$$scope = { dirty, ctx: ctx2 };
}
tabpanel4.$set(tabpanel4_changes);
},
i(local) {
if (current)
@ -21543,8 +21546,8 @@ const _DOMParser = DOMParser;
transition_in(tabpanel1.$$.fragment, local);
transition_in(tabpanel2.$$.fragment, local);
transition_in(tabpanel3.$$.fragment, local);
transition_in(if_block);
transition_in(tabpanel4.$$.fragment, local);
transition_in(if_block);
current = true;
},
o(local) {
@ -21553,8 +21556,8 @@ const _DOMParser = DOMParser;
transition_out(tabpanel1.$$.fragment, local);
transition_out(tabpanel2.$$.fragment, local);
transition_out(tabpanel3.$$.fragment, local);
transition_out(if_block);
transition_out(tabpanel4.$$.fragment, local);
transition_out(if_block);
current = false;
},
d(detaching) {
@ -21573,11 +21576,13 @@ const _DOMParser = DOMParser;
destroy_component(tabpanel3, detaching);
if (detaching)
detach(t4);
destroy_component(tabpanel4, detaching);
if (detaching)
detach(t5);
if (if_block)
if_block.d(detaching);
if (detaching)
detach(t5);
destroy_component(tabpanel4, detaching);
detach(if_block_anchor);
}
};
}
@ -22164,7 +22169,7 @@ const _DOMParser = DOMParser;
function create_if_block8(ctx) {
let a;
let i;
let t_value = ctx[1].is4chanX ? "" : "\u274C";
let t_value = ctx[2].is4chanX ? "" : "\u274C";
let t;
let a_title_value;
let mounted;
@ -22183,12 +22188,12 @@ const _DOMParser = DOMParser;
append(a, i);
append(i, t);
if (!mounted) {
dispose = listen(a, "click", ctx[7]);
dispose = listen(a, "click", ctx[8]);
mounted = true;
}
},
p(ctx2, dirty) {
if (dirty & 2 && t_value !== (t_value = ctx2[1].is4chanX ? "" : "\u274C"))
if (dirty & 4 && t_value !== (t_value = ctx2[2].is4chanX ? "" : "\u274C"))
set_data(t, t_value);
if (dirty & 1 && a_title_value !== (a_title_value = "Discard ALL " + ctx2[0].length + " files")) {
attr(a, "title", a_title_value);
@ -22206,15 +22211,20 @@ const _DOMParser = DOMParser;
let div1;
let a0;
let i0;
let t0_value = ctx[1].is4chanX ? "" : "\u{1F9F2}";
let t0_value = ctx[2].is4chanX ? "" : "\u{1F9F2}";
let t0;
let t1;
let div0;
let a1;
let i1;
let t2_value = ctx[1].is4chanX ? "" : "\u{1F589}";
let t2_value = ctx[2].is4chanX ? "" : "\u{1F589}";
let t2;
let t3;
let a2;
let i2;
let t4_value = ctx[2].is4chanX ? "" : "\u{1F4CB}";
let t4;
let t5;
let mounted;
let dispose;
let if_block = ctx[0].length && create_if_block8(ctx);
@ -22230,6 +22240,10 @@ const _DOMParser = DOMParser;
i1 = element("i");
t2 = text(t2_value);
t3 = space();
a2 = element("a");
i2 = element("i");
t4 = text(t4_value);
t5 = space();
if (if_block)
if_block.c();
attr(i0, "class", "fa fa-magnet svelte-bgqqj3");
@ -22238,6 +22252,9 @@ const _DOMParser = DOMParser;
attr(i1, "class", "fa fa-pencil svelte-bgqqj3");
attr(a1, "title", "Add a message (this uses the content of the comment text box)");
attr(a1, "class", "svelte-bgqqj3");
attr(i2, "class", "fa fa-clipboard svelte-bgqqj3");
attr(a2, "title", "Add from clipboard (click this then CTRL+v)");
attr(a2, "class", "svelte-bgqqj3");
attr(div0, "class", "additionnal svelte-bgqqj3");
attr(div1, "class", "root svelte-bgqqj3");
},
@ -22252,21 +22269,28 @@ const _DOMParser = DOMParser;
append(a1, i1);
append(i1, t2);
append(div0, t3);
append(div0, a2);
append(a2, i2);
append(i2, t4);
append(div0, t5);
if (if_block)
if_block.m(div0, null);
ctx[9](div0);
if (!mounted) {
dispose = [
listen(a0, "click", ctx[4]),
listen(a1, "click", ctx[3])
listen(a0, "click", ctx[5]),
listen(a1, "click", ctx[4])
];
mounted = true;
}
},
p(ctx2, [dirty]) {
if (dirty & 2 && t0_value !== (t0_value = ctx2[1].is4chanX ? "" : "\u{1F9F2}"))
if (dirty & 4 && t0_value !== (t0_value = ctx2[2].is4chanX ? "" : "\u{1F9F2}"))
set_data(t0, t0_value);
if (dirty & 2 && t2_value !== (t2_value = ctx2[1].is4chanX ? "" : "\u{1F589}"))
if (dirty & 4 && t2_value !== (t2_value = ctx2[2].is4chanX ? "" : "\u{1F589}"))
set_data(t2, t2_value);
if (dirty & 4 && t4_value !== (t4_value = ctx2[2].is4chanX ? "" : "\u{1F4CB}"))
set_data(t4, t4_value);
if (ctx2[0].length) {
if (if_block) {
if_block.p(ctx2, dirty);
@ -22287,6 +22311,7 @@ const _DOMParser = DOMParser;
detach(div1);
if (if_block)
if_block.d();
ctx[9](null);
mounted = false;
run_all(dispose);
}
@ -22295,11 +22320,41 @@ const _DOMParser = DOMParser;
function instance11($$self, $$props, $$invalidate) {
let $settings;
let $appState;
component_subscribe($$self, settings, ($$value) => $$invalidate(11, $settings = $$value));
component_subscribe($$self, appState, ($$value) => $$invalidate(1, $appState = $$value));
component_subscribe($$self, settings, ($$value) => $$invalidate(13, $settings = $$value));
component_subscribe($$self, appState, ($$value) => $$invalidate(2, $appState = $$value));
let { processors: processors2 = [] } = $$props;
let { textinput } = $$props;
let { links = [] } = $$props;
let floating;
const isParentOrSame = (p, ofe) => {
while (ofe && ofe != document.body) {
if (p == ofe)
return true;
ofe = ofe.parentElement;
}
return false;
};
const handleGlobalPaste = (e) => {
if (!e.clipboardData) {
return;
}
if (isParentOrSame(floating, e.target)) {
if (e.clipboardData.files.length == 0) {
if (e.clipboardData.types.includes("text/plain")) {
const data = e.clipboardData.getData("text/plain");
addContent(new File([new Blob([data], { type: "text/plain" })], `message${links.length}.txt`));
}
} else {
addContent(...[...e.clipboardData.files]);
}
e.stopImmediatePropagation();
e.stopPropagation();
return true;
}
};
onMount(() => {
document.addEventListener("paste", handleGlobalPaste, true);
});
const addContent = async (...newfiles) => {
$$invalidate(0, links = [...links, ...await uploadFiles(newfiles)]);
return embedContent({});
@ -22351,15 +22406,24 @@ const _DOMParser = DOMParser;
return;
}
await addContent(new File([new Blob([textinput.value], { type: "text/plain" })], `message${links.length}.txt`));
$$invalidate(5, textinput.value = "", textinput);
$$invalidate(6, textinput.value = "", textinput);
};
const embedContent = async (e) => {
const file = original;
if (!file)
let tfile = original;
if (!tfile)
return;
if (links.length == 0)
return;
const type = file.type;
const type = tfile.type;
let file;
if (!(tfile instanceof File)) {
const et = await fileTypeFromBuffer(await tfile.arrayBuffer());
if (!et)
throw new Error("Unsupported container type");
file = new File([tfile], `file.${et.ext}`);
} else {
file = tfile;
}
try {
const proc = processors2.filter((e2) => e2.inject).find((e2) => e2.match(file.name));
if (!proc)
@ -22387,39 +22451,47 @@ const _DOMParser = DOMParser;
input.click();
};
const click_handler2 = () => ($$invalidate(0, links = []), restore());
function div0_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
floating = $$value;
$$invalidate(1, floating);
});
}
$$self.$$set = ($$props2) => {
if ("processors" in $$props2)
$$invalidate(6, processors2 = $$props2.processors);
$$invalidate(7, processors2 = $$props2.processors);
if ("textinput" in $$props2)
$$invalidate(5, textinput = $$props2.textinput);
$$invalidate(6, textinput = $$props2.textinput);
if ("links" in $$props2)
$$invalidate(0, links = $$props2.links);
};
return [
links,
floating,
$appState,
restore,
embedText,
embedFile,
textinput,
processors2,
click_handler2
click_handler2,
div0_binding
];
}
var PostOptions = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance11, create_fragment11, safe_not_equal, { processors: 6, textinput: 5, links: 0 }, add_css10);
init(this, options, instance11, create_fragment11, safe_not_equal, { processors: 7, textinput: 6, links: 0 }, add_css10);
}
get processors() {
return this.$$.ctx[6];
return this.$$.ctx[7];
}
set processors(processors2) {
this.$$set({ processors: processors2 });
flush();
}
get textinput() {
return this.$$.ctx[5];
return this.$$.ctx[6];
}
set textinput(textinput) {
this.$$set({ textinput });

7850
package-lock.json

File diff suppressed because it is too large

8
package.json

@ -20,11 +20,13 @@
"crc-32": "^1.2.0",
"events": "^3.3.0",
"file-type": "^17.0.2",
"hls.js": "^1.1.5",
"image-hash": "^5.0.1",
"jpeg-js": "^0.4.3",
"jsdom": "^19.0.0",
"linkify-string": "^3.0.4",
"lodash": "^4.17.21",
"mp4box": "^0.5.2",
"png-js": "^1.0.0",
"readable-stream": "^3.6.0",
"socks-proxy-agent": "^7.0.0",
@ -37,15 +39,15 @@
"@types/tampermonkey": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"crx": "^5.0.1",
"esbuild": "^0.14.7",
"esbuild": "^0.14.48",
"esbuild-css-modules-plugin": "^2.0.9",
"esbuild-svelte": "^0.6.0",
"esbuild-svelte": "^0.6.3",
"eslint": "^8.6.0",
"svelte": "^3.44.3",
"svelte-check": "^2.2.11",
"svelte-preprocess": "^4.10.1",
"typescript": "^4.5.4",
"web-ext": "^6.8.0",
"web-ext": "^7.1.1",
"web-ext-types": "^3.2.1"
},
"browser": {

BIN
pngextraembedder-0.249.xpi

Binary file not shown.

10
src/Components/App.svelte

@ -365,11 +365,6 @@
<p>Loading...</p>
{/if}
</TabPanel>
{#if $appState.akValid}
<TabPanel>
<HydrusSearch />
</TabPanel>
{/if}
<TabPanel>
<p>
Reminder to report issues to <a
@ -387,6 +382,11 @@
{/if}
</div>
</TabPanel>
{#if $appState.akValid}
<TabPanel>
<HydrusSearch />
</TabPanel>
{/if}
</Tabs>
</div>
</div>

60
src/Components/PostOptions.svelte

@ -10,11 +10,51 @@
getFileFromHydrus,
uploadFiles,
} from "../utils";
import { fileTypeFromBuffer } from "file-type";
import { onMount } from "svelte";
export let processors: ImageProcessor[] = [];
export let textinput: HTMLTextAreaElement;
export let links: string[] = [];
let floating: HTMLDivElement;
const isParentOrSame = (p: HTMLElement, ofe: HTMLElement | null) => {
while (ofe && ofe != document.body) {
if (p == ofe) return true;
ofe = ofe.parentElement;
}
return false;
};
const handleGlobalPaste = (e: ClipboardEvent) => {
if (!e.clipboardData) {
return;
}
if (isParentOrSame(floating, e.target as HTMLElement)) {
if (e.clipboardData.files.length == 0) {
if (e.clipboardData.types.includes("text/plain")) {
const data = e.clipboardData.getData("text/plain");
addContent(
new File(
[new Blob([data], { type: "text/plain" })],
`message${links.length}.txt`
)
);
}
} else {
addContent(...[...e.clipboardData.files]);
}
e.stopImmediatePropagation();
e.stopPropagation();
return true;
}
};
onMount(() => {
document.addEventListener("paste", handleGlobalPaste, true);
});
const addContent = async (...newfiles: File[]) => {
links = [...links, ...(await uploadFiles(newfiles))];
@ -94,10 +134,18 @@
};
const embedContent = async (e: Event) => {
const file = original;
if (!file) return;
let tfile: File | Blob | undefined = original;
if (!tfile) return;
if (links.length == 0) return;
const type = file.type;
const type = tfile.type;
let file: File;
if (!(tfile instanceof File)) {
const et = await fileTypeFromBuffer(await tfile.arrayBuffer());
if (!et) throw new Error("Unsupported container type");
file = new File([tfile], `file.${et.ext}`);
} else {
file = tfile;
}
try {
const proc = processors
.filter((e) => e.inject)
@ -136,7 +184,7 @@
<a on:click={embedFile} title="Add a file">
<i class="fa fa-magnet"> {$appState.is4chanX ? "" : "🧲"} </i>
</a>
<div class="additionnal">
<div bind:this={floating} class="additionnal">
<!-- svelte-ignore a11y-missing-attribute -->
<a
on:click={embedText}
@ -144,6 +192,10 @@
>
<i class="fa fa-pencil"> {$appState.is4chanX ? "" : "🖉"} </i>
</a>
<!-- svelte-ignore a11y-missing-attribute -->
<a title="Add from clipboard (click this then CTRL+v)">
<i class="fa fa-clipboard"> {$appState.is4chanX ? "" : "📋"} </i>
</a>
{#if links.length}
<!-- svelte-ignore a11y-missing-attribute -->
<a

2
src/webm.ts

@ -139,7 +139,7 @@ const has_embed = (webm: Buffer) => {
const dec = new ebml.Decoder();
const chunks = dec.decode(webm);
const embed = chunks.findIndex(e => e.name == "TagName" && e.type == '8' && e.value == "DOOM");
const embed = chunks.findIndex(e => e.name == "TagName" && e.type == '8' && (e.value == "DOOM" || e.value == "VOOM"));
const cl = chunks.find(e => e.name == "Cluster");
if (cl && embed == -1)
return false; // Tags appear before Cluster, so if we have a Cluster and no coomtag, then it's a definite no

Loading…
Cancel
Save