mid update

This commit is contained in:
sky
2025-09-27 20:54:26 -04:00
parent 7fca0fbde6
commit 6b448258ea
6 changed files with 59 additions and 14 deletions

View File

@ -57,7 +57,38 @@
<!-- <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415518411898563" crossorigin="anonymous"></script> -->
<script>
let currentPanic = {key: "", url: ""};
document.addEventListener("DOMContentLoaded", ()=>{
document.addEventListener("DOMContentLoaded", async ()=>{
let hash = location.hash.substring(1);
if(hash) {
// location.hash = "";
if(hash.startsWith("/u/")) {
document.getElementById("iframe").src = hash;
} else if(hash.startsWith("/g/")) {
document.querySelector("loading-game").style.display = "flex";
await fetch("/resources/games.json")
.then(data => data.json())
.then(data => {
data.forEach(el => {
if(el.directory == hash.substring(3)) {
document.getElementById("iframe").src = `/loader.html?title=${encodeURIComponent(el.name)}&dir=${el.directory}&img=${el.image}&type=g`
}
})
})
document.querySelector("loading-game").style.display = "none";
} else if(hash.startsWith("/a/")) {
document.querySelector("loading-game").style.display = "flex";
await fetch("/resources/apps.json")
.then(data => data.json())
.then(data => {
data.forEach(el => {
if(el.directory == hash.substring(3)) {
document.getElementById("iframe").src = `/loader.html?title=${encodeURIComponent(el.name)}&dir=${el.directory}&img=${el.image}&type=g`
}
})
});
document.querySelector("loading-game").style.display = "none";
}
}
let socket = new WebSocket("/socket");
socket.addEventListener("open", () => {
let cookies = document.cookie.split("; ");
@ -142,6 +173,7 @@
</script>
</head>
<mobile-warning><h1 class="title">your device is not supported!</h1><p>please rotate your screen for the best experience.</p></mobile-warning>
<loading-game><h1 class="title">we are loading your game!</h1><p>please allow us to fetch the data first, this should only take a second.</p></loading-game>
<body>
<iframe id="iframe" src="home.html"></iframe>
<!-- to do