updates
This commit is contained in:
18
loader.html
18
loader.html
@ -14,6 +14,7 @@
|
||||
<script src="/js/all.min.js"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
let gameData = {};
|
||||
if (location.search != "") {
|
||||
let items = {};
|
||||
location.search.substr(1).split("&").forEach((e)=>{
|
||||
@ -21,18 +22,22 @@
|
||||
});
|
||||
if(items.type == "g") {
|
||||
items.type = "semag";
|
||||
gameData["type"] = "g";
|
||||
} else {
|
||||
items.type = "sppa";
|
||||
gameData["type"] = "a";
|
||||
}
|
||||
document.getElementById("gameFrame").setAttribute("src", `/resources/${items.type}/${items.dir}/index.html`);
|
||||
document.getElementById("gameImage").setAttribute("src", `/resources/${items.type}/${items.dir}/${items.img}`);
|
||||
document.getElementById("gameName").innerText = decodeURIComponent(items.title);
|
||||
console.log(items);
|
||||
gameData["path"] = items.dir;
|
||||
} else if(localStorage.getItem("selenite.lastGame")) {
|
||||
let game = JSON.parse(decodeURIComponent(atob(localStorage.getItem("selenite.lastGame"))));
|
||||
document.getElementById("gameFrame").setAttribute("src", `/resources/${items.type}/${game[0]}/index.html`);
|
||||
document.getElementById("gameImage").setAttribute("src", `/resources/${items.type}/${game[0]}/${decodeURIComponent(game[1])}`);
|
||||
document.getElementById("gameName").innerText = game[2];
|
||||
gameData["path"] = game[0];
|
||||
gameData["type"] = items.type == "semag" ? "g" : "a";
|
||||
}
|
||||
document.getElementById("fullscreen").addEventListener("click", () => {
|
||||
document.getElementById("gameFrame").requestFullscreen();
|
||||
@ -40,6 +45,13 @@
|
||||
document.getElementById("reload").addEventListener("click", () => {
|
||||
document.getElementById("gameFrame").src = document.getElementById("gameFrame").src;
|
||||
});
|
||||
document.getElementById("open").addEventListener("click", () => {
|
||||
window.open(document.getElementById("gameFrame").src);
|
||||
});
|
||||
document.getElementById("share").addEventListener("click", () => {
|
||||
let link = location.origin + "#/" + gameData["type"] + "/" + gameData["path"];
|
||||
navigator.clipboard.writeText(link);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -51,13 +63,15 @@
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="gameFrame" allow="fullscreen" sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-scripts allow-same-origin"></iframe>
|
||||
<iframe id="gameFrame" sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-scripts allow-same-origin"></iframe>
|
||||
<div id="infobox">
|
||||
<img id="gameImage" src="favicon.png" />
|
||||
<h2 id="gameName">Selenite</h2>
|
||||
<div class="opposite">
|
||||
<img class="button" id="reload" src="/img/reload.svg">
|
||||
<img class="button" id="fullscreen" src="/img/fullscreen.svg">
|
||||
<img class="button" id="open" src="/img/open.svg">
|
||||
<img class="button" id="share" src="/img/share.svg">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user