mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-24 14:41:18 -09:00
add minifyextras
This commit is contained in:
parent
ccdac07c05
commit
711263afec
@ -90,8 +90,12 @@
|
|||||||
>Choose .html file...</label
|
>Choose .html file...</label
|
||||||
>
|
>
|
||||||
<br />
|
<br />
|
||||||
<span><label>Minify: </label><input type="checkbox" oninput="globalThis.doShronk = this.checked">
|
<span>
|
||||||
<label>EaglerForge: </label><input checked type="checkbox" oninput="globalThis.doEaglerforge = this.checked">
|
<label>Minify: </label><input type="checkbox" oninput="globalThis.doShronk = this.checked">
|
||||||
|
|
||||||
|
<label>MinifyExtras: </label><input type="checkbox" oninput="globalThis.doShronkPlus = this.checked">
|
||||||
|
|
||||||
|
<label>EaglerForge: </label><input checked type="checkbox" oninput="globalThis.doEaglerforge = this.checked">
|
||||||
<code id="status">Awaiting input...</code></span>
|
<code id="status">Awaiting input...</code></span>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<button class="btn btn-primary" id="giveme">Make modded client</button>
|
<button class="btn btn-primary" id="giveme">Make modded client</button>
|
||||||
|
@ -322,7 +322,7 @@ var main;(function(){`
|
|||||||
\<script id="__eaglerforgeinjector_installation_flag__"\>console.log("Thank you for using EaglerForge!");\<\/script\>`
|
\<script id="__eaglerforgeinjector_installation_flag__"\>console.log("Thank you for using EaglerForge!");\<\/script\>`
|
||||||
);
|
);
|
||||||
backgroundLog("[HTML] Injecting script files");
|
backgroundLog("[HTML] Injecting script files");
|
||||||
patchedFile = patchedFile.replace(`<title>EaglercraftX`, `<title>EFI ${globalThis.ModAPIVersion}`);
|
patchedFile = patchedFile.replace(`<title>EaglercraftX`, `<title>EFI ${globalThis.ModAPIVersion} on`);
|
||||||
backgroundLog("[HTML] Injecting title");
|
backgroundLog("[HTML] Injecting title");
|
||||||
patchedFile = patchedFile.replaceAll(/main\(\);\s*?}/gm, (match) => {
|
patchedFile = patchedFile.replaceAll(/main\(\);\s*?}/gm, (match) => {
|
||||||
return match.replace("main();", "main();ModAPI.hooks._postInit();");
|
return match.replace("main();", "main();ModAPI.hooks._postInit();");
|
||||||
|
@ -1,23 +1,17 @@
|
|||||||
// Babel plugin to transform functions and calls
|
const MINIFY = function () {
|
||||||
const ASYNC_PLUGIN_1 = function ({ types: t }) {
|
|
||||||
return {
|
return {
|
||||||
visitor: {
|
visitor: {
|
||||||
FunctionDeclaration(path) {
|
Identifier(path) {
|
||||||
console.log(path);
|
if (path.node.name === "$ptr") {
|
||||||
path.node.async = true;
|
path.node.name = "r";
|
||||||
},
|
|
||||||
ArrowFunctionExpression(path) {
|
|
||||||
console.log(path);
|
|
||||||
path.node.async = true;
|
|
||||||
},
|
|
||||||
CallExpression(path) {
|
|
||||||
console.log(path);
|
|
||||||
if (path.parent.type !== 'AwaitExpression') {
|
|
||||||
path.replaceWith(
|
|
||||||
t.awaitExpression(path.node)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
if (path.node.name === "$tmp") {
|
||||||
|
path.node.name = "m";
|
||||||
}
|
}
|
||||||
|
if (path.node.name === "$thread") {
|
||||||
|
path.node.name = "t";
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -45,7 +39,9 @@ async function shronk(input) {
|
|||||||
|
|
||||||
|
|
||||||
const output = Babel.transform(code, {
|
const output = Babel.transform(code, {
|
||||||
plugins: []
|
plugins: globalThis.doShronkPlus ? [
|
||||||
|
MINIFY()
|
||||||
|
] : []
|
||||||
});
|
});
|
||||||
scriptTag.textContent = output.code;
|
scriptTag.textContent = output.code;
|
||||||
await wait(10);
|
await wait(10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user