mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-25 07:01:20 -09:00
Finish of ModGUI on init
This commit is contained in:
parent
6aa24515ab
commit
a355bb4fa0
@ -238,7 +238,6 @@ document.querySelector("#giveme").addEventListener("click", () => {
|
|||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @type File
|
// @type File
|
||||||
var file = document.querySelector("input").files[0];
|
var file = document.querySelector("input").files[0];
|
||||||
var fileType = file.name.split(".");
|
var fileType = file.name.split(".");
|
||||||
@ -259,7 +258,6 @@ document.querySelector("#givemeserver").addEventListener("click", () => {
|
|||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @type File
|
// @type File
|
||||||
var file = document.querySelector("input").files[0];
|
var file = document.querySelector("input").files[0];
|
||||||
var fileType = file.name.split(".");
|
var fileType = file.name.split(".");
|
||||||
|
@ -42,7 +42,7 @@ globalThis.modapi_guikit = `// ModAPI GUI made by TheIdiotPlays
|
|||||||
<button class="button" onclick="window.modapi_uploadmod()">Upload Mod (.js)</button>
|
<button class="button" onclick="window.modapi_uploadmod()">Upload Mod (.js)</button>
|
||||||
<button class="button" onclick="window.modapi_addmod()">Add Mod From URL</button>
|
<button class="button" onclick="window.modapi_addmod()">Add Mod From URL</button>
|
||||||
<button class="button" style="text-shadow: 0px 0px 10px rgba(255, 0, 0, 0.5)" onclick="window.modapi_clearmods()">Clear All Mods</button>
|
<button class="button" style="text-shadow: 0px 0px 10px rgba(255, 0, 0, 0.5)" onclick="window.modapi_clearmods()">Clear All Mods</button>
|
||||||
<button class="button" onclick="this.parentElement.parentElement.remove(); main();">Done</button>
|
<button class="button _doneButton" onclick="this.parentElement.parentElement.remove();">Done</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span>(reload to apply changes)</span>
|
<span>(reload to apply changes)</span>
|
||||||
@ -168,7 +168,7 @@ globalThis.modapi_guikit = `// ModAPI GUI made by TheIdiotPlays
|
|||||||
fr.readAsDataURL(file);
|
fr.readAsDataURL(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.modapi_displayModGui = async function () {
|
window.modapi_displayModGui = async function (cb) {
|
||||||
if (!getMods) {
|
if (!getMods) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -248,7 +248,19 @@ globalThis.modapi_guikit = `// ModAPI GUI made by TheIdiotPlays
|
|||||||
tr.appendChild(button);
|
tr.appendChild(button);
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
|
var once = false;
|
||||||
|
if (cb) {
|
||||||
|
document.querySelector("#modapi_gui_container ._doneButton").addEventListener("mousedown", ()=>{
|
||||||
|
if (once) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
once = true;
|
||||||
|
cb();
|
||||||
|
document.querySelector("#modapi_gui_container").remove();
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.modapi_clearmods = async () => {
|
window.modapi_clearmods = async () => {
|
||||||
await resetMods();
|
await resetMods();
|
||||||
window.modapi_displayModGui();
|
window.modapi_displayModGui();
|
||||||
@ -277,4 +289,5 @@ globalThis.modapi_guikit = `// ModAPI GUI made by TheIdiotPlays
|
|||||||
});
|
});
|
||||||
f.click();
|
f.click();
|
||||||
}
|
}
|
||||||
})();`;
|
})();
|
||||||
|
`;
|
||||||
|
16
modgui.js
16
modgui.js
@ -42,7 +42,7 @@
|
|||||||
<button class="button" onclick="window.modapi_uploadmod()">Upload Mod (.js)</button>
|
<button class="button" onclick="window.modapi_uploadmod()">Upload Mod (.js)</button>
|
||||||
<button class="button" onclick="window.modapi_addmod()">Add Mod From URL</button>
|
<button class="button" onclick="window.modapi_addmod()">Add Mod From URL</button>
|
||||||
<button class="button" style="text-shadow: 0px 0px 10px rgba(255, 0, 0, 0.5)" onclick="window.modapi_clearmods()">Clear All Mods</button>
|
<button class="button" style="text-shadow: 0px 0px 10px rgba(255, 0, 0, 0.5)" onclick="window.modapi_clearmods()">Clear All Mods</button>
|
||||||
<button class="button" onclick="this.parentElement.parentElement.remove(); main();">Done</button>
|
<button class="button _doneButton" onclick="this.parentElement.parentElement.remove();">Done</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span>(reload to apply changes)</span>
|
<span>(reload to apply changes)</span>
|
||||||
@ -168,7 +168,7 @@
|
|||||||
fr.readAsDataURL(file);
|
fr.readAsDataURL(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.modapi_displayModGui = async function () {
|
window.modapi_displayModGui = async function (cb) {
|
||||||
if (!getMods) {
|
if (!getMods) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -248,7 +248,19 @@
|
|||||||
tr.appendChild(button);
|
tr.appendChild(button);
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
|
var once = false;
|
||||||
|
if (cb) {
|
||||||
|
document.querySelector("#modapi_gui_container ._doneButton").addEventListener("mousedown", ()=>{
|
||||||
|
if (once) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
once = true;
|
||||||
|
cb();
|
||||||
|
document.querySelector("#modapi_gui_container").remove();
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.modapi_clearmods = async () => {
|
window.modapi_clearmods = async () => {
|
||||||
await resetMods();
|
await resetMods();
|
||||||
window.modapi_displayModGui();
|
window.modapi_displayModGui();
|
||||||
|
@ -749,4 +749,13 @@ globalThis.modapi_postinit = `(() => {
|
|||||||
var x = originalCrashMethod.apply(this, args);
|
var x = originalCrashMethod.apply(this, args);
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
var inited = false;
|
||||||
|
const originalMainMethod = ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.lax1dude.eaglercraft.v1_8.internal.teavm.ClientMain", "_main")];
|
||||||
|
ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.lax1dude.eaglercraft.v1_8.internal.teavm.ClientMain", "_main")] = function (...args) {
|
||||||
|
if (!inited) {
|
||||||
|
return modapi_displayModGui(originalMainMethod);
|
||||||
|
} else {
|
||||||
|
return originalMainMethod.apply(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
})();`;
|
})();`;
|
||||||
|
10
postinit.js
10
postinit.js
@ -749,4 +749,14 @@
|
|||||||
var x = originalCrashMethod.apply(this, args);
|
var x = originalCrashMethod.apply(this, args);
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
var inited = false;
|
||||||
|
const originalMainMethod = ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.lax1dude.eaglercraft.v1_8.internal.teavm.ClientMain", "_main")];
|
||||||
|
ModAPI.hooks.methods[ModAPI.util.getMethodFromPackage("net.lax1dude.eaglercraft.v1_8.internal.teavm.ClientMain", "_main")] = function (...args) {
|
||||||
|
if (!inited) {
|
||||||
|
inited = true;
|
||||||
|
return modapi_displayModGui(globalThis.main);
|
||||||
|
} else {
|
||||||
|
return originalMainMethod.apply(this, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user