mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-23 06:01:38 -09:00
add minifyextras
This commit is contained in:
parent
ccdac07c05
commit
711263afec
@ -90,8 +90,12 @@
|
||||
>Choose .html file...</label
|
||||
>
|
||||
<br />
|
||||
<span><label>Minify: </label><input type="checkbox" oninput="globalThis.doShronk = this.checked">
|
||||
<label>EaglerForge: </label><input checked type="checkbox" oninput="globalThis.doEaglerforge = this.checked">
|
||||
<span>
|
||||
<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>
|
||||
<br /><br />
|
||||
<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\>`
|
||||
);
|
||||
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");
|
||||
patchedFile = patchedFile.replaceAll(/main\(\);\s*?}/gm, (match) => {
|
||||
return match.replace("main();", "main();ModAPI.hooks._postInit();");
|
||||
|
@ -1,23 +1,17 @@
|
||||
// Babel plugin to transform functions and calls
|
||||
const ASYNC_PLUGIN_1 = function ({ types: t }) {
|
||||
const MINIFY = function () {
|
||||
return {
|
||||
visitor: {
|
||||
FunctionDeclaration(path) {
|
||||
console.log(path);
|
||||
path.node.async = true;
|
||||
},
|
||||
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)
|
||||
);
|
||||
Identifier(path) {
|
||||
if (path.node.name === "$ptr") {
|
||||
path.node.name = "r";
|
||||
}
|
||||
}
|
||||
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, {
|
||||
plugins: []
|
||||
plugins: globalThis.doShronkPlus ? [
|
||||
MINIFY()
|
||||
] : []
|
||||
});
|
||||
scriptTag.textContent = output.code;
|
||||
await wait(10);
|
||||
|
Loading…
x
Reference in New Issue
Block a user