Browse Source

Workaround extension not loading on vanilla 4chan catalog

pull/46/head
coomdev 2 years ago
parent
commit
ac56fbacf3
  1. 54
      chrome/dist/main.js
  2. 52
      firefox/dist/main.js
  3. 2
      main.meta.js
  4. 44
      main.user.js
  5. 2
      package.json
  6. 15
      src/main.ts

54
chrome/dist/main.js

@ -53,7 +53,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 241];
define_BUILD_VERSION_default = [0, 242];
}
});
@ -5266,12 +5266,12 @@
function Int64(buffer, offset, value, raddix) {
if (!(this instanceof Int64))
return new Int64(buffer, offset, value, raddix);
return init4(this, buffer, offset, value, raddix);
return init5(this, buffer, offset, value, raddix);
}
function isInt64(b) {
return !!(b && b[_isInt64]);
}
function init4(that, buffer, offset, value, raddix) {
function init5(that, buffer, offset, value, raddix) {
if (UINT8ARRAY && ARRAYBUFFER) {
if (buffer instanceof ARRAYBUFFER)
buffer = new UINT8ARRAY(buffer);
@ -11559,7 +11559,7 @@
initQuantTables(sf);
currentQuality = quality2;
}
function init4() {
function init5() {
var time_start = new Date().getTime();
if (!quality)
quality = 50;
@ -11570,7 +11570,7 @@
setQuality(quality);
var duration = new Date().getTime() - time_start;
}
init4();
init5();
}
if (typeof module !== "undefined") {
module.exports = encode;
@ -13133,7 +13133,7 @@
if (animation_name)
delete_rule(node, animation_name);
}
function init4(program, duration) {
function init5(program, duration) {
const d = program.b - t;
duration *= Math.abs(d);
return {
@ -13165,11 +13165,11 @@
}
if (b)
tick2(0, 1);
running_program = init4(program, duration);
running_program = init5(program, duration);
add_render_callback(() => dispatch(node, b, "start"));
loop((now2) => {
if (pending_program && now2 > pending_program.start) {
running_program = init4(pending_program, duration);
running_program = init5(pending_program, duration);
pending_program = null;
dispatch(node, running_program.b, "start");
if (css) {
@ -13974,11 +13974,11 @@
}
}
}
var corsFetch = async (input, init4, lsn) => {
var corsFetch = async (input, init5, lsn) => {
const id = gid++;
if (init4?.body) {
if (init5?.body) {
if (true)
init4.body = await serialize(init4.body);
init5.body = await serialize(init5.body);
}
const prom = new Promise((_, rej) => {
let gcontroller;
@ -13999,8 +13999,8 @@
const cmdbuff = [];
let cleaned = false;
lqueue[id] = async (e) => {
if (!cleaned && true && init4?.body) {
cleanupSerialized(init4.body);
if (!cleaned && true && init5?.body) {
cleanupSerialized(init5.body);
cleaned = true;
}
if (e.progress) {
@ -14093,7 +14093,7 @@
port1.postMessage({
id,
name: "corsFetch",
args: [input, init4]
args: [input, init5]
});
});
return prom;
@ -23647,13 +23647,13 @@
}
function get_each_context7(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[2] = list[i];
child_ctx[3] = list[i];
return child_ctx;
}
function create_each_block7(ctx) {
let div;
let html_tag;
let raw_value = linkifyStr(ctx[2]) + "";
let raw_value = ctx[1](ctx[3]) + "";
let t;
return {
c() {
@ -23696,7 +23696,7 @@
insert(target, each_1_anchor, anchor);
},
p(ctx2, [dirty]) {
if (dirty & 1) {
if (dirty & 3) {
each_value = ctx2[0];
let i;
for (i = 0; i < each_value.length; i += 1) {
@ -23727,19 +23727,20 @@
function instance16($$self, $$props, $$invalidate) {
let { files } = $$props;
let contents = files.map((e) => e.data.toString());
const san = (s) => linkifyStr(s).split("\n").map((m) => m.trim().startsWith("&gt;") ? `<span style="color: #b5bd68">${m.trim()}</span>` : m.trim()).join("\n");
$$self.$$set = ($$props2) => {
if ("files" in $$props2)
$$invalidate(1, files = $$props2.files);
$$invalidate(2, files = $$props2.files);
};
return [contents, files];
return [contents, san, files];
}
var TextEmbeddings = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance16, create_fragment16, safe_not_equal, { files: 1 }, add_css14);
init(this, options, instance16, create_fragment16, safe_not_equal, { files: 2 }, add_css14);
}
get files() {
return this.$$.ctx[1];
return this.$$.ctx[2];
}
set files(files) {
this.$$set({ files });
@ -24276,7 +24277,11 @@
}
return true;
};
var init4 = false;
var startup = async (is4chanX = true) => {
if (init4)
return;
init4 = true;
const meta = document.querySelector('meta[name="referrer"]');
const customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
@ -24412,8 +24417,11 @@
}
}));
};
document.addEventListener("4chanXInitFinished", () => startup(true));
document.addEventListener("4chanParsingDone", () => startup(false), { once: true });
if (location.host.startsWith("boards.4chan")) {
setTimeout(() => startup(false), 2e3);
document.addEventListener("4chanParsingDone", () => startup(false), { once: true });
}
document.addEventListener("4chanXInitFinished", () => startup(true), { once: true });
if (supportedAltDomain(location.host)) {
if (location.host == "arch.b4k.co") {
gmo = new MutationObserver((m) => {

52
firefox/dist/main.js

@ -53,7 +53,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 241];
define_BUILD_VERSION_default = [0, 242];
}
});
@ -5266,12 +5266,12 @@
function Int64(buffer, offset, value, raddix) {
if (!(this instanceof Int64))
return new Int64(buffer, offset, value, raddix);
return init4(this, buffer, offset, value, raddix);
return init5(this, buffer, offset, value, raddix);
}
function isInt64(b) {
return !!(b && b[_isInt64]);
}
function init4(that, buffer, offset, value, raddix) {
function init5(that, buffer, offset, value, raddix) {
if (UINT8ARRAY && ARRAYBUFFER) {
if (buffer instanceof ARRAYBUFFER)
buffer = new UINT8ARRAY(buffer);
@ -11559,7 +11559,7 @@
initQuantTables(sf);
currentQuality = quality2;
}
function init4() {
function init5() {
var time_start = new Date().getTime();
if (!quality)
quality = 50;
@ -11570,7 +11570,7 @@
setQuality(quality);
var duration = new Date().getTime() - time_start;
}
init4();
init5();
}
if (typeof module !== "undefined") {
module.exports = encode;
@ -13133,7 +13133,7 @@
if (animation_name)
delete_rule(node, animation_name);
}
function init4(program, duration) {
function init5(program, duration) {
const d = program.b - t;
duration *= Math.abs(d);
return {
@ -13165,11 +13165,11 @@
}
if (b)
tick2(0, 1);
running_program = init4(program, duration);
running_program = init5(program, duration);
add_render_callback(() => dispatch(node, b, "start"));
loop((now2) => {
if (pending_program && now2 > pending_program.start) {
running_program = init4(pending_program, duration);
running_program = init5(pending_program, duration);
pending_program = null;
dispatch(node, running_program.b, "start");
if (css) {
@ -13906,11 +13906,11 @@
Platform = __decorateClass([
Bridged
], Platform);
var corsFetch = async (input, init4, lsn) => {
var corsFetch = async (input, init5, lsn) => {
const id = gid++;
if (init4?.body) {
if (init5?.body) {
if (false)
init4.body = await serialize(init4.body);
init5.body = await serialize(init5.body);
}
const prom = new Promise((_, rej) => {
let gcontroller;
@ -13932,7 +13932,7 @@
let cleaned = false;
lqueue[id] = async (e) => {
if (!cleaned && false) {
cleanupSerialized(init4.body);
cleanupSerialized(init5.body);
cleaned = true;
}
if (e.progress) {
@ -14025,7 +14025,7 @@
port1.postMessage({
id,
name: "corsFetch",
args: [input, init4]
args: [input, init5]
});
});
return prom;
@ -23603,13 +23603,13 @@
}
function get_each_context7(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[2] = list[i];
child_ctx[3] = list[i];
return child_ctx;
}
function create_each_block7(ctx) {
let div;
let html_tag;
let raw_value = linkifyStr(ctx[2]) + "";
let raw_value = ctx[1](ctx[3]) + "";
let t;
return {
c() {
@ -23652,7 +23652,7 @@
insert(target, each_1_anchor, anchor);
},
p(ctx2, [dirty]) {
if (dirty & 1) {
if (dirty & 3) {
each_value = ctx2[0];
let i;
for (i = 0; i < each_value.length; i += 1) {
@ -23683,19 +23683,20 @@
function instance16($$self, $$props, $$invalidate) {
let { files } = $$props;
let contents = files.map((e) => e.data.toString());
const san = (s) => linkifyStr(s).split("\n").map((m) => m.trim().startsWith("&gt;") ? `<span style="color: #b5bd68">${m.trim()}</span>` : m.trim()).join("\n");
$$self.$$set = ($$props2) => {
if ("files" in $$props2)
$$invalidate(1, files = $$props2.files);
$$invalidate(2, files = $$props2.files);
};
return [contents, files];
return [contents, san, files];
}
var TextEmbeddings = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance16, create_fragment16, safe_not_equal, { files: 1 }, add_css14);
init(this, options, instance16, create_fragment16, safe_not_equal, { files: 2 }, add_css14);
}
get files() {
return this.$$.ctx[1];
return this.$$.ctx[2];
}
set files(files) {
this.$$set({ files });
@ -24232,7 +24233,11 @@
}
return true;
};
var init4 = false;
var startup = async (is4chanX = true) => {
if (init4)
return;
init4 = true;
const meta = document.querySelector('meta[name="referrer"]');
const customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
@ -24368,8 +24373,11 @@
}
}));
};
document.addEventListener("4chanXInitFinished", () => startup(true));
document.addEventListener("4chanParsingDone", () => startup(false), { once: true });
if (location.host.startsWith("boards.4chan")) {
setTimeout(() => startup(false), 2e3);
document.addEventListener("4chanParsingDone", () => startup(false), { once: true });
}
document.addEventListener("4chanXInitFinished", () => startup(true), { once: true });
if (supportedAltDomain(location.host)) {
if (location.host == "arch.b4k.co") {
gmo = new MutationObserver((m) => {

2
main.meta.js

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

44
main.user.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.241
// @version 0.242
// @description uhh
// @author You
// @match https://boards.4channel.org/*
@ -89,7 +89,7 @@ const _DOMParser = DOMParser;
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 241];
define_BUILD_VERSION_default = [0, 242];
}
});
@ -5302,12 +5302,12 @@ const _DOMParser = DOMParser;
function Int64(buffer, offset, value, raddix) {
if (!(this instanceof Int64))
return new Int64(buffer, offset, value, raddix);
return init4(this, buffer, offset, value, raddix);
return init5(this, buffer, offset, value, raddix);
}
function isInt64(b) {
return !!(b && b[_isInt64]);
}
function init4(that, buffer, offset, value, raddix) {
function init5(that, buffer, offset, value, raddix) {
if (UINT8ARRAY && ARRAYBUFFER) {
if (buffer instanceof ARRAYBUFFER)
buffer = new UINT8ARRAY(buffer);
@ -11595,7 +11595,7 @@ const _DOMParser = DOMParser;
initQuantTables(sf);
currentQuality = quality2;
}
function init4() {
function init5() {
var time_start = new Date().getTime();
if (!quality)
quality = 50;
@ -11606,7 +11606,7 @@ const _DOMParser = DOMParser;
setQuality(quality);
var duration = new Date().getTime() - time_start;
}
init4();
init5();
}
if (typeof module !== "undefined") {
module.exports = encode;
@ -13169,7 +13169,7 @@ const _DOMParser = DOMParser;
if (animation_name)
delete_rule(node, animation_name);
}
function init4(program, duration) {
function init5(program, duration) {
const d = program.b - t;
duration *= Math.abs(d);
return {
@ -13201,11 +13201,11 @@ const _DOMParser = DOMParser;
}
if (b)
tick2(0, 1);
running_program = init4(program, duration);
running_program = init5(program, duration);
add_render_callback(() => dispatch(node, b, "start"));
loop((now2) => {
if (pending_program && now2 > pending_program.start) {
running_program = init4(pending_program, duration);
running_program = init5(pending_program, duration);
pending_program = null;
dispatch(node, running_program.b, "start");
if (css) {
@ -23514,13 +23514,13 @@ const _DOMParser = DOMParser;
}
function get_each_context7(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[2] = list[i];
child_ctx[3] = list[i];
return child_ctx;
}
function create_each_block7(ctx) {
let div;
let html_tag;
let raw_value = linkifyStr(ctx[2]) + "";
let raw_value = ctx[1](ctx[3]) + "";
let t;
return {
c() {
@ -23563,7 +23563,7 @@ const _DOMParser = DOMParser;
insert(target, each_1_anchor, anchor);
},
p(ctx2, [dirty]) {
if (dirty & 1) {
if (dirty & 3) {
each_value = ctx2[0];
let i;
for (i = 0; i < each_value.length; i += 1) {
@ -23594,19 +23594,20 @@ const _DOMParser = DOMParser;
function instance16($$self, $$props, $$invalidate) {
let { files } = $$props;
let contents = files.map((e) => e.data.toString());
const san = (s) => linkifyStr(s).split("\n").map((m) => m.trim().startsWith("&gt;") ? `<span style="color: #b5bd68">${m.trim()}</span>` : m.trim()).join("\n");
$$self.$$set = ($$props2) => {
if ("files" in $$props2)
$$invalidate(1, files = $$props2.files);
$$invalidate(2, files = $$props2.files);
};
return [contents, files];
return [contents, san, files];
}
var TextEmbeddings = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance16, create_fragment16, safe_not_equal, { files: 1 }, add_css14);
init(this, options, instance16, create_fragment16, safe_not_equal, { files: 2 }, add_css14);
}
get files() {
return this.$$.ctx[1];
return this.$$.ctx[2];
}
set files(files) {
this.$$set({ files });
@ -24143,7 +24144,11 @@ const _DOMParser = DOMParser;
}
return true;
};
var init4 = false;
var startup = async (is4chanX = true) => {
if (init4)
return;
init4 = true;
const meta = document.querySelector('meta[name="referrer"]');
const customStyles = document.createElement("style");
customStyles.appendChild(document.createTextNode(global_default));
@ -24279,8 +24284,11 @@ const _DOMParser = DOMParser;
}
}));
};
document.addEventListener("4chanXInitFinished", () => startup(true));
document.addEventListener("4chanParsingDone", () => startup(false), { once: true });
if (location.host.startsWith("boards.4chan")) {
setTimeout(() => startup(false), 2e3);
document.addEventListener("4chanParsingDone", () => startup(false), { once: true });
}
document.addEventListener("4chanXInitFinished", () => startup(true), { once: true });
if (supportedAltDomain(location.host)) {
if (location.host == "arch.b4k.co") {
gmo = new MutationObserver((m) => {

2
package.json

@ -5,7 +5,7 @@
"type": "module",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "node ./build-test.js",
"build": "node ./build.js",
"ver": "tsc -v",
"build_chrome": "node ./build-chrome.js",

15
src/main.ts

@ -409,7 +409,11 @@ const earlystartup = async () => {
return true;
};
let init = false;
const startup = async (is4chanX = true) => {
if (init)
return;
init = true;
const meta = document.querySelector('meta[name="referrer"]') as HTMLMetaElement;
const customStyles = document.createElement('style');
@ -571,9 +575,16 @@ const startup = async (is4chanX = true) => {
}));
//await Promise.all(posts.map(e => processPost(e as any)));
};
document.addEventListener('4chanXInitFinished', () => startup(true));
if (location.host.startsWith('boards.4chan')) {
setTimeout(() => startup(false), 2000);
document.addEventListener('4chanParsingDone', () => startup(false), { once: true });
}
document.addEventListener('4chanXInitFinished', () => startup(true), { once: true });
// 4chanMainInit is fired even if the native extension is disabled, which we don't want
document.addEventListener('4chanParsingDone', () => startup(false), { once: true });
if (supportedAltDomain(location.host)) {
if (location.host == 'arch.b4k.co') {
gmo = new MutationObserver(m => {

Loading…
Cancel
Save