You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.3 KiB
38 lines
1.3 KiB
export let Buffer = require("buffer").Buffer;
|
|
|
|
if (!isBackground) {
|
|
|
|
if (execution_mode == "userscript") {
|
|
const ocreate = unsafeWindow.document.createElement.bind(document);
|
|
|
|
unsafeWindow.document.createElement = (tag) => {
|
|
if (tag != "meta")
|
|
return ocreate(tag);
|
|
unsafeWindow.document.createElement = ocreate; // restore
|
|
return unsafeWindow.document.createElement('link'); // whatever to not make 4chanX crash
|
|
};
|
|
}
|
|
|
|
if (execution_mode == "ff_api") {
|
|
if (typeof cloneInto != "undefined")
|
|
console.log("CLONE INTO DEFINED");
|
|
else
|
|
console.log("CLONE INTO NOT DEFINED");
|
|
let a = 1;
|
|
console.log(a++);
|
|
const unsafeWindow = window;
|
|
//const ogdoc = window.wrappedJSObject.document;
|
|
console.log(a++);
|
|
const ocreate = unsafeWindow.document.createElement.bind(document);
|
|
|
|
console.log(a++);
|
|
exportFunction((tag) => {
|
|
if (tag != "meta")
|
|
return ocreate(tag);
|
|
unsafeWindow.document.createElement = ocreate; // restore
|
|
return unsafeWindow.document.createElement('link'); // whatever to not make 4chanX crash
|
|
}, window.document, { defineAs: 'createElement' });
|
|
|
|
console.log(a++);
|
|
}
|
|
}
|
|
|