hoosiertransfer-mod/javascript/index.html

76 lines
2.9 KiB
HTML
Raw Normal View History

2024-03-15 14:25:40 -05:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="EaglercraftX 1.8 test directory HTML page" />
<meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" />
<title>EaglercraftX 1.8</title>
<meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="EaglercraftX 1.8" />
<meta property="og:description" content="test directory HTML page" />
<link type="image/png" rel="shortcut icon" href="favicon.png" />
<script type="text/javascript" src="classes.js"></script>
2024-04-21 10:40:21 -05:00
<script type="text/javascript">
2024-03-15 14:25:40 -05:00
"use strict";
2024-04-21 10:40:21 -05:00
function setCookie(name, data) {
document.cookie = name + '=' + encodeURIComponent(data) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT';
}
function getCookie(name) {
var cookies = document.cookie.split(';');
for(var i = 0; i < cookies.length; i++) {
var c = cookies[i];
while(c.charAt(0) == ' ') c = c.substring(1);
if(c.indexOf(name + '=') == 0) return decodeURIComponent(c.substring(name.length + 1, c.length));
}
return null;
}
2024-03-15 14:25:40 -05:00
window.addEventListener("load", () => {
if(document.location.href.startsWith("file:")) {
alert("HTTP please, do not open this file locally, run a local HTTP server and load it via HTTP");
}else {
2024-04-21 10:40:21 -05:00
if (localStorage.getItem("username") === null && getCookie("username") !== null) {
localStorage.setItem("username", getCookie("username"));
}
if (getCookie("username") === null && localStorage.getItem("username") !== null) {
setCookie("username", localStorage.getItem("username"));
}
2024-03-15 14:25:40 -05:00
const isHttps = document.location.protocol === "https:";
var serverURL = isHttps ? "wss://" : "ws://";
serverURL += document.location.host + "/";
const relayId = Math.floor(Math.random() * 3);
window.eaglercraftXOpts = {
demoMode: false,
container: "game_frame",
assetsURI: "assets.epk",
localesURI: "lang/",
worldsDB: "worlds",
logInvalidCerts: true,
servers: [
{ addr: serverURL, name: "TemuzX" }
],
relays: [
{ addr: "wss://relay.deev.is/", comment: "lax1dude relay #1", primary: relayId == 0 },
{ addr: "wss://relay.lax1dude.net/", comment: "lax1dude relay #2", primary: relayId == 1 },
{ addr: "wss://relay.shhnowisnottheti.me/", comment: "ayunami relay #1", primary: relayId == 2 }
]
};
var q = window.location.search;
if(typeof q === "string" && q.startsWith("?")) {
q = new URLSearchParams(q);
var s = q.get("server");
if(s) window.eaglercraftXOpts.joinServer = s;
}
main();
}
});
</script>
</head>
<body style="margin:0px;width:100vw;height:100vh;overflow:hidden;" id="game_frame">
</body>
</html>