mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-13 12:00:01 -04:00
Games are back!
This commit is contained in:
parent
f82c2de301
commit
920d9f198f
4 changed files with 30 additions and 18 deletions
|
@ -57,10 +57,10 @@
|
||||||
|
|
||||||
const eventHandler = new EventHandler({
|
const eventHandler = new EventHandler({
|
||||||
events: {
|
events: {
|
||||||
"DOMContentLoaded": (async () => {
|
"DOMContentLoaded": async () => {
|
||||||
await init();
|
await init();
|
||||||
await initSettings();
|
await initSettings();
|
||||||
}),
|
},
|
||||||
"astro:after-swap": (async () => {
|
"astro:after-swap": (async () => {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,16 +3,25 @@ import Layout from "@layouts/Layout.astro";
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Chango Games">
|
<Layout title="Chango Games">
|
||||||
<iframe id="chango" class="w-full h-full"></iframe>
|
<iframe id="chango" class="w-full h-full" src="/loading"></iframe>
|
||||||
</Layout>
|
</Layout>
|
||||||
<script>
|
<script>
|
||||||
import { setTransport, getSWStuff } from "@utils/registerSW.ts"; //../../utils/registerSW.ts
|
import { EventHandler } from "@utils/events";
|
||||||
import { Settings } from "@utils/settings/index";
|
import { Elements } from "@utils/index";
|
||||||
import { pageLoad } from "@utils/events";
|
|
||||||
pageLoad(async () => {
|
const init = async () => {
|
||||||
const { conn } = getSWStuff();
|
const el = Elements.select([
|
||||||
const iframe = document.getElementById("chango") as HTMLIFrameElement;
|
{ type: 'id', val: 'chango' }
|
||||||
await setTransport(conn, localStorage.getItem(Settings.ProxySettings.transport) as string);
|
]);
|
||||||
if (iframe) return iframe.src = __uv$config!.prefix + __uv$config.encodeUrl!("https://radon.games");
|
const chango = Elements.exists<HTMLIFrameElement>(await el.next());
|
||||||
});
|
chango.src = `${__uv$config.prefix}${__uv$config.encodeUrl!("https://radon.games/games/")}`
|
||||||
|
};
|
||||||
|
|
||||||
|
new EventHandler({
|
||||||
|
events: {
|
||||||
|
"astro:page-load": init
|
||||||
|
},
|
||||||
|
logging: false
|
||||||
|
})
|
||||||
|
.bind();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -169,11 +169,9 @@ import { VERSION } from "astro:env/client";
|
||||||
|
|
||||||
new EventHandler({
|
new EventHandler({
|
||||||
events: {
|
events: {
|
||||||
"astro:page-load": async () => {
|
"astro:page-load": init
|
||||||
await init()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
logging: true
|
logging: false
|
||||||
})
|
})
|
||||||
.bind();
|
.bind();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -31,8 +31,13 @@ class EventHandler {
|
||||||
this.#eventItems = items;
|
this.#eventItems = items;
|
||||||
}
|
}
|
||||||
#attachEvent(items: Events, eventType: Event, fn: () => unknown) {
|
#attachEvent(items: Events, eventType: Event, fn: () => unknown) {
|
||||||
if (items.logging) return document.addEventListener(eventType, () => fn());
|
if (items.logging) return document.addEventListener(eventType, async () => await fn());
|
||||||
try { document.addEventListener(eventType, () => fn()) } catch (_) {};
|
document.addEventListener(eventType, async () => {
|
||||||
|
try {
|
||||||
|
await fn();
|
||||||
|
}
|
||||||
|
catch (_) {}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Binds the events you passed when creating the class to the document. If none are passed, an error is thrown.
|
* Binds the events you passed when creating the class to the document. If none are passed, an error is thrown.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue