mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
1 line
9.3 KiB
HTML
1 line
9.3 KiB
HTML
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Shadow Client</title><link rel="icon" type="image/webp" href="/resources/images/icons/clients/shadow.webp"><link rel="stylesheet" href="/resources/styles/eagler.css"><script src="/resources/scripts/google-tag.js"></script><script src="/game/web/clients/shadow/classes.js"></script><script>function initAPI(e){var l={events:{}};l.events.types=["event"],l.events.listeners={event:[]},l.globals={},l.version=e,l.addEventListener=function(e,t){if(!t)throw new Error("Invalid callback!");if(!l.events.types.includes(e))throw new Error("This event does not exist!");Array.isArray(l.events.listeners[e])||(l.events.listeners[e]=[]),l.events.listeners[e].push(t),console.log("Added new event listener.")},l.removeEventListener=function(e,t,n){if(!t)throw new Error("Invalid callback!");Array.isArray(l.events.listeners[e])||(l.events.listeners[e]=[]);var s,o=l.events.listeners[e];n?(s=t.toString(),o.forEach((e,t)=>{e.toString()===s&&(o.splice(t,1),console.log("Removed event listener."))})):-1!==o.indexOf(t)&&(o.splice(o.indexOf(t),1),console.log("Removed event listener."))},l.events.newEvent=function(e){l.events.types.push(e)},l.events.callEvent=function(t,n){if(!l.events.types.includes(t)||!Array.isArray(l.events.listeners[t]))return Array.isArray(l.events.listeners[t])?(console.error("The ModAPI has been called with an invalid event name: "+t),void console.error("Please report this bug to the repo.")):l.events.types.includes(t)?void l.events.listeners.event.forEach(e=>{e({event:t,data:n})}):void 0;l.events.listeners[t].forEach(e=>{e(n)}),l.events.listeners.event.forEach(e=>{e({event:t,data:n})}),l.globals._initUpdate()},l.updateComponent=function(e){"string"==typeof e&&null!=l[e]&&l.globals&&l.globals.onGlobalsUpdate&&(l.globals.toUpdate||(l.globals.toUpdate=[]),-1===l.globals.toUpdate.indexOf(e))&&l.globals.toUpdate.push(e)},l.require=function(e){"string"==typeof e&&l.globals&&l.globals.onRequire&&l.globals.onRequire(e)},l.globals._initUpdate=function(){l.globals.toUpdate||(l.globals.toUpdate=[]),l.globals.toUpdate.forEach(e=>{l.globals.onGlobalsUpdate(e)}),l.globals.toUpdate=[]},window.ModAPI=l}</script><script>function loadLoader(){window.ModLoader=function(a){function t(e){try{console.log("EaglerML: Loading "+e+" via method B.");var o=document.createElement("script");o.src=e,o.setAttribute("data-Mod",e),o.setAttribute("data-isMod",!0),o.onerror=()=>{console.log("EaglerML: Failed to load "+e+" via method B!"),o.remove(),l++},o.onload=()=>{console.log("EaglerML: Successfully loaded "+e+" via method B."),l++},document.body.appendChild(o)}catch(o){console.log("EaglerML: Oh no! The Mod "+e+" failed to load!"),l++}}window.eaglerMLoaderMainRun||(new URLSearchParams(location.search).getAll("Mod").forEach(o=>{console.log("EaglerML: Adding Mod to loadlist from search params: "+o),a.push(o)}),eaglercraftXOpts&&eaglercraftXOpts.Mods&&Array.isArray(eaglercraftXOpts.Mods)&&eaglercraftXOpts.Mods.forEach(o=>{console.log("EaglerML: Adding Mod to loadlist from eaglercraftXOpts: "+o),a.push(o)}),window.eaglerMLoaderMainRun=!0),!0===window.noLoadMods&&a.splice(0,a.length),window.ModGracePeriod=!0;var l=0,d=null;a.forEach(o=>{let e=o;console.log("EaglerML: Starting "+e);try{var a=new XMLHttpRequest;a.open("GET",e),a.onload=function(){console.log("EaglerML: Loading "+e+" via method A.");var o=document.createElement("script");try{o.src="data:text/javascript,"+encodeURIComponent(a.responseText)}catch(o){return void t(e)}o.setAttribute("data-Mod",e),o.setAttribute("data-isMod",!0),o.onerror=()=>{console.log("EaglerML: Failed to load "+e+" via method A!"),o.remove(),l++},o.onload=()=>{console.log("EaglerML: Successfully loaded "+e+" via method A."),l++},document.body.appendChild(o)},a.onerror=function(){t(e)},a.send()}catch(o){t(e)}}),d=setInterval(()=>{var o,e;o=l,e=d,console.log("EaglerML: Checking if Mods are finished :: "+o+"/"+a.length),o>=a.length&&(clearInterval(e),window.ModGracePeriod=!1,window.eaglerMLoaderMainRun&&ModAPI&&ModAPI.events&&ModAPI.events.callEvent&&ModAPI.events.callEvent("load",{}),console.log("EaglerML: Checking if Mods are finished :: All Mods loaded! Grace period off."))},500),console.log("EaglerML: Starting to load "+a.length+" Mods..."),window.returntotalloadedmods=function(){return l}}}</script><script>function displayGui(){!function a(){document.querySelector("#eaglerpl_gui")&&document.querySelector("#eaglerpl_gui").remove(),localStorage.setItem("ml::Mods",localStorage.getItem("ml::Mods")||"[]");try{localStorage.setItem("ml::Mods",JSON.stringify(JSON.parse(localStorage.getItem("ml::Mods"))))}catch(e){localStorage.setItem("ml::Mods","[]")}var l=JSON.parse(localStorage.getItem("ml::Mods")),e=document.createElement("div"),t=(e.id="eaglerpl_gui",e.style="width:100%; height: 100%; position: fixed; top: 0; left: 0; z-index: 10; color: white; font-family: Minecraftia, sans-serif; overflow-y: scroll; overflow-x: hidden; background-image: url(data:image/png;base64,UklGRhoBAABXRUJQVlA4TA0BAAAvn8AnAIWjtpEECdnA2N0DsTROy7xUqfrWw0jbyLkJKTz0+I20jTT/Bo89e1YR/Wfktm0Y+wNKLobT7QP/n/B7Z/naW26QHoTpHB7LFouyKHlzeHxfCStSuj9KdbC8z1IJ5iWiyQed48vtYJ+lUu0t4VwranS1XMIutSiLYlbb8G54uf2p3VPSfRZtSrlsPFjOzZZrd/us3B3uK+HcHJQql+xbLMrS/WqNpm6DeZ/VIPVYaN/KzUbp91nd9xl5pYu50dU2W417nbdTj5l2Ne92uM9qXNpyf6+oXkabHKXaZ1HS4Iaqpim+1KIJ+0M49/LjNbTGP5mrrMZEuc7Uzcb1ViOJ6TuOt4NGJs+zDgA=); background-color: rgb(60,60,60); background-blend-mode: multiply; background-size: 64px;",document.createElement("h1")),n=(t.style="text-shadow: 0px 0px 4px;",t.innerHTML="Mod Manager",document.createElement("a")),n=(n.style="margin-left: 2rem; color: red;",n.href="javascript:void(0)",n.addEventListener("click",()=>{document.querySelector("#eaglerpl_gui").remove()}),n.innerHTML="[X]",t.appendChild(n),e.appendChild(t),document.createElement("p")),t=(n.style="font-size: 0.8rem; color: orangered;",n.innerHTML="Warning: Installing Mods gives them full control over the game. Be cautious when installing them.<br>Mods that have been removed also need a reload to stop running in the background.",e.appendChild(n),document.createElement("p")),i=(t.style="font-size: 0.8rem; color: yellow;",t.innerHTML="Tip: if the mods say that they failed loading, try refreshing the gui",e.appendChild(t),document.createElement("table")),n=(i.style="table-layout: fixed; width: 100%",document.createElement("tr")),t=(n.style="background: rgb(50,50,50);",document.createElement("th")),t=(t.style="text-align: center;",t.innerHTML="URL",n.appendChild(t),document.createElement("th")),t=(t.style="text-align: center; width: 15%;",t.innerHTML="Status",n.appendChild(t),i.appendChild(n),l.forEach(e=>{var t=document.createElement("tr"),n=(t.style="box-shadow: 0px 2px 0px grey;",document.createElement("td")),r=(n.style="user-select: text;",document.createElement("div")),o=(r.style="max-width: 100%; overflow-wrap: anywhere; max-height: 3rem; overflow-y: scroll;",r.innerText=e,n.append(r),t.appendChild(n),document.createElement("td"));switch(o.innerHTML=(t=>{var n=document.querySelectorAll("script[data-Mod]");for(let e=0;e<n.length;e++)if(n[e].getAttribute("data-Mod")===t)return"LOADED";return"FAILED"})(e),o.innerHTML){case"LOADED":o.style="background-color: green; text-align: center;";break;case"FAILED":o.style="background-color: dimgrey; text-align: center;"}(r=document.createElement("button")).style="background: transparent; text-align: center; color: yellow; cursor: pointer; font-family: 'Minecraftia', sans-serif; text-decoration: underline; border: 0; margin-left: 1rem; font-size: 1rem;",r.innerHTML="[X]",r.addEventListener("click",()=>{window.confirm("Delete Mod?")&&-1!==l.indexOf(e)&&(l.splice(l.indexOf(e),1),localStorage.setItem("ml::Mods",JSON.stringify(l)),a())}),o.appendChild(r),t.appendChild(o),i.appendChild(t)}),document.createElement("button")),n=(t.style="background: transparent; text-align: center; color: yellow; cursor: pointer; font-family: 'Minecraftia', sans-serif; text-decoration: underline; border: 0; margin-right: 1rem; font-size: 1rem;",t.innerHTML="Add new",t.addEventListener("click",()=>{var e=window.prompt("URL of Mod: ","http://example.com/example.js");e&&(l.push(e),localStorage.setItem("ml::Mods",JSON.stringify(l)),window.ModLoader&&ModLoader([e]),a())}),document.createElement("button")),t=(n.style="background: transparent; text-align: center; color: yellow; cursor: pointer; font-family: 'Minecraftia', sans-serif; text-decoration: underline; border: 0; font-size: 1rem;",n.innerHTML="Upload...",n.addEventListener("click",function(){var n=document.createElement("input");n.type="file",n.accept=".js",n.addEventListener("input",function(){var t;n.files[0]&&((t=new FileReader).addEventListener("load",function(){var e=t.result.replace(";base64",`;fs=${encodeURIComponent(n.files[0].name)||"unknown"};base64`);l.push(e),localStorage.setItem("ml::Mods",JSON.stringify(l)),window.ModLoader&&ModLoader([e]),a()}),t.readAsDataURL(n.files[0]))}),n.click()}),e.appendChild(i),e.appendChild(t),e.appendChild(n),document.createElement("a"));t.innerHTML="Refresh GUI",t.href="javascript:void(0)",t.addEventListener("click",function(){setTimeout(a,500),this.remove()}),t.style="color: yellow; display: block; margin-top: 2rem; width: 0; white-space: nowrap;",e.appendChild(t),ModAPI.events.callEvent("gui",{}),document.body.appendChild(e)}()}</script><script src="/resources/scripts/eagler-launch/1.8.8/main.js"></script></head><body id="game_frame"></body></html> |