@indextools/index-games 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.svg +1158 -52
- package/package.json +1 -1
- package/public/config.js +12 -1
- package/public/games/games.json +2 -2
- package/public/games/kidchess.html +9 -6
- package/public/games/nealfun.html +8 -5
- package/public/index.css +30 -0
- package/public/index.html +47 -36
- package/public/index.js +5 -1
- package/public/index.svg +1158 -52
- package/public/register-sw.js +7 -3
- package/public/sw.js +12 -0
package/package.json
CHANGED
package/public/config.js
CHANGED
|
@@ -10,9 +10,20 @@ const _CONFIG = {
|
|
|
10
10
|
wasm: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.wasm.wasm",
|
|
11
11
|
sync: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.sync.js",
|
|
12
12
|
},
|
|
13
|
+
ultraviolet: {
|
|
14
|
+
bundle: "https://unpkg.com/@titaniumnetwork-dev/ultraviolet@3.2.10/dist/uv.bundle.js",
|
|
15
|
+
config: "https://unpkg.com/@titaniumnetwork-dev/ultraviolet@3.2.10/dist/uv.config.js",
|
|
16
|
+
handler: "https://unpkg.com/@titaniumnetwork-dev/ultraviolet@3.2.10/dist/uv.handler.js",
|
|
17
|
+
sw: "https://unpkg.com/@titaniumnetwork-dev/ultraviolet@3.2.10/dist/uv.sw.js",
|
|
18
|
+
},
|
|
13
19
|
baremux: {
|
|
14
20
|
index: "https://unpkg.com/@mercuryworkshop/bare-mux@2.1.7/dist/index.js",
|
|
15
|
-
worker: "
|
|
21
|
+
worker: "baremux/worker.js",
|
|
22
|
+
},
|
|
23
|
+
// Epoxy transport (Rust/Wasm) is drastically faster than libcurl
|
|
24
|
+
transport: "https://unpkg.com/@mercuryworkshop/epoxy-transport@2.1.29/dist/index.mjs",
|
|
25
|
+
epoxy: {
|
|
26
|
+
transport: "https://unpkg.com/@mercuryworkshop/epoxy-transport@2.1.29/dist/index.mjs",
|
|
16
27
|
},
|
|
17
28
|
libcurl: {
|
|
18
29
|
transport: "https://unpkg.com/@mercuryworkshop/libcurl-transport@1.5.2/dist/index.mjs",
|
package/public/games/games.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "Game Suggestions",
|
|
5
5
|
"description": "Suggest a game to add.",
|
|
6
6
|
"file": "gamesuggestions.html",
|
|
7
|
-
"icon": "
|
|
7
|
+
"icon": "icons/GameSuggestions-Favicons.png",
|
|
8
8
|
"tags": ["suggestion", "feedback", "community"]
|
|
9
9
|
},
|
|
10
10
|
{
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"name": "Neal.fun",
|
|
109
109
|
"description": "neal.fun game",
|
|
110
110
|
"file": "nealfun.html",
|
|
111
|
-
"icon": "
|
|
111
|
+
"icon": "icons/NDF-Favicon.png",
|
|
112
112
|
"tags": ["arcade", "multiplayer", "skill"]
|
|
113
113
|
},
|
|
114
114
|
{
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<script src="config.js"></script>
|
|
5
|
+
<title>Kid Chess</title>
|
|
6
|
+
<script src="../config.js"></script>
|
|
8
7
|
<script src="https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js"></script>
|
|
9
8
|
<script src="https://unpkg.com/@mercuryworkshop/bare-mux@2.1.7/dist/index.js"></script>
|
|
10
9
|
<style>
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
</style>
|
|
14
13
|
</head>
|
|
15
14
|
<body>
|
|
16
|
-
<script src="
|
|
15
|
+
<script src="../register-sw.js"></script>
|
|
17
16
|
<script>
|
|
18
17
|
(async () => {
|
|
19
18
|
const cfg = (typeof window !== "undefined" && window.__INDEX_CONFIG) || {};
|
|
@@ -22,14 +21,18 @@
|
|
|
22
21
|
all: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js",
|
|
23
22
|
sync: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.sync.js"
|
|
24
23
|
};
|
|
24
|
+
const baseDir = new URL("../", location.href).pathname;
|
|
25
|
+
const workerPath = (cfg.baremux && cfg.baremux.worker) || new URL("../baremux/worker.js", location.href).pathname;
|
|
26
|
+
const scramjetPrefix = baseDir + "service/";
|
|
27
|
+
|
|
25
28
|
const { ScramjetController } = $scramjetLoadController();
|
|
26
29
|
const sj = new ScramjetController({
|
|
27
|
-
files: scramjetFiles
|
|
30
|
+
files: scramjetFiles,
|
|
31
|
+
prefix: scramjetPrefix
|
|
28
32
|
});
|
|
29
33
|
|
|
30
34
|
await sj.init();
|
|
31
35
|
|
|
32
|
-
const workerPath = (cfg.baremux && cfg.baremux.worker) || "/baremux/worker.js";
|
|
33
36
|
const c = new BareMux.BareMuxConnection(workerPath);
|
|
34
37
|
const wispUrl = cfg.wispUrl || (location.host && location.host.includes("unpkg.com") ? "wss://wisp.mercurywork.shop/" : ((location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/"));
|
|
35
38
|
const transportUrl = (cfg.libcurl && cfg.libcurl.transport) || "https://unpkg.com/@mercuryworkshop/libcurl-transport@1.5.2/dist/index.mjs";
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
|
-
<base href="/" />
|
|
6
5
|
<title>neal.fun</title>
|
|
7
|
-
<script src="config.js"></script>
|
|
6
|
+
<script src="../config.js"></script>
|
|
8
7
|
<script src="https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js"></script>
|
|
9
8
|
<script src="https://unpkg.com/@mercuryworkshop/bare-mux@2.1.7/dist/index.js"></script>
|
|
10
9
|
<style>
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
</style>
|
|
14
13
|
</head>
|
|
15
14
|
<body>
|
|
16
|
-
<script src="
|
|
15
|
+
<script src="../register-sw.js"></script>
|
|
17
16
|
<script>
|
|
18
17
|
(async () => {
|
|
19
18
|
const cfg = (typeof window !== "undefined" && window.__INDEX_CONFIG) || {};
|
|
@@ -22,14 +21,18 @@
|
|
|
22
21
|
all: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js",
|
|
23
22
|
sync: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.sync.js"
|
|
24
23
|
};
|
|
24
|
+
const baseDir = new URL("../", location.href).pathname;
|
|
25
|
+
const workerPath = (cfg.baremux && cfg.baremux.worker) || new URL("../baremux/worker.js", location.href).pathname;
|
|
26
|
+
const scramjetPrefix = baseDir + "service/";
|
|
27
|
+
|
|
25
28
|
const { ScramjetController } = $scramjetLoadController();
|
|
26
29
|
const sj = new ScramjetController({
|
|
27
|
-
files: scramjetFiles
|
|
30
|
+
files: scramjetFiles,
|
|
31
|
+
prefix: scramjetPrefix
|
|
28
32
|
});
|
|
29
33
|
|
|
30
34
|
await sj.init();
|
|
31
35
|
|
|
32
|
-
const workerPath = (cfg.baremux && cfg.baremux.worker) || "/baremux/worker.js";
|
|
33
36
|
const c = new BareMux.BareMuxConnection(workerPath);
|
|
34
37
|
const wispUrl = cfg.wispUrl || (location.host && location.host.includes("unpkg.com") ? "wss://wisp.mercurywork.shop/" : ((location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/"));
|
|
35
38
|
const transportUrl = (cfg.libcurl && cfg.libcurl.transport) || "https://unpkg.com/@mercuryworkshop/libcurl-transport@1.5.2/dist/index.mjs";
|
package/public/index.css
CHANGED
|
@@ -713,6 +713,36 @@
|
|
|
713
713
|
.cloak-option-name { font-size: 12px; color: var(--text-bright, #c8e6c9); }
|
|
714
714
|
.cloak-option-url { font-size: 10px; color: var(--text-dim, #4a6650); }
|
|
715
715
|
|
|
716
|
+
/* proxy options */
|
|
717
|
+
.proxy-options {
|
|
718
|
+
display: flex;
|
|
719
|
+
flex-direction: column;
|
|
720
|
+
gap: 8px;
|
|
721
|
+
}
|
|
722
|
+
.proxy-option {
|
|
723
|
+
display: flex;
|
|
724
|
+
align-items: center;
|
|
725
|
+
gap: 12px;
|
|
726
|
+
padding: 10px 14px;
|
|
727
|
+
border: 1px solid var(--border, rgba(74,180,100,0.15));
|
|
728
|
+
background: transparent;
|
|
729
|
+
border-radius: 7px;
|
|
730
|
+
cursor: pointer;
|
|
731
|
+
transition: background 0.15s, border-color 0.15s;
|
|
732
|
+
font-family: 'Courier New', monospace;
|
|
733
|
+
}
|
|
734
|
+
.proxy-option:hover { background: rgba(74,180,100,0.06); }
|
|
735
|
+
.proxy-option.selected {
|
|
736
|
+
border-color: var(--green, #4ab464);
|
|
737
|
+
background: rgba(74,180,100,0.1);
|
|
738
|
+
}
|
|
739
|
+
.proxy-option-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
|
|
740
|
+
.proxy-option-info { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
|
|
741
|
+
.proxy-option-name { font-size: 12px; color: var(--text-bright, #c8e6c9); }
|
|
742
|
+
.proxy-option-desc { font-size: 10px; color: var(--text-dim, #4a6650); }
|
|
743
|
+
.proxy-check { font-size: 13px; color: var(--green, #4ab464); opacity: 0; margin-left: auto; }
|
|
744
|
+
.proxy-option.selected .proxy-check { opacity: 1; }
|
|
745
|
+
|
|
716
746
|
/* about:blank button */
|
|
717
747
|
.ab-btn {
|
|
718
748
|
display: flex;
|
package/public/index.html
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
<title>Index</title>
|
|
7
7
|
|
|
8
8
|
<script src="config.js"></script>
|
|
9
|
+
<script src="https://unpkg.com/@titaniumnetwork-dev/ultraviolet@3.2.10/dist/uv.bundle.js"></script>
|
|
10
|
+
<script src="https://unpkg.com/@titaniumnetwork-dev/ultraviolet@3.2.10/dist/uv.config.js"></script>
|
|
9
11
|
<script src="https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js"></script>
|
|
10
12
|
<script src="https://unpkg.com/@mercuryworkshop/bare-mux@2.1.7/dist/index.js"></script>
|
|
11
13
|
|
|
@@ -598,19 +600,23 @@
|
|
|
598
600
|
function openAboutBlank(url) {
|
|
599
601
|
const win = window.open("about:blank", "_blank");
|
|
600
602
|
if (!win) { alert("Allow popups for about:blank to work."); return; }
|
|
603
|
+
const baseDir = new URL("./", location.href).pathname;
|
|
604
|
+
const workerPath = new URL("baremux/worker.js", location.href).pathname;
|
|
605
|
+
const swScriptPath = new URL("register-sw.js", location.href).pathname;
|
|
606
|
+
const scramjetPrefix = baseDir + "service/";
|
|
601
607
|
win.document.open();
|
|
602
608
|
win.document.write(`<!doctype html><html><head>
|
|
603
609
|
<script src="https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js"><\/script>
|
|
604
610
|
<script src="https://unpkg.com/@mercuryworkshop/bare-mux@2.1.7/dist/index.js"><\/script>
|
|
605
|
-
<script src="
|
|
611
|
+
<script src="${swScriptPath}"><\/script>
|
|
606
612
|
<style>*{margin:0;padding:0;}iframe{width:100vw;height:100vh;border:none;}<\/style>
|
|
607
613
|
</head><body><script>
|
|
608
614
|
(async()=>{
|
|
609
615
|
const {ScramjetController}=$scramjetLoadController();
|
|
610
|
-
const sj=new ScramjetController({files:{wasm:"https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.wasm.wasm",all:"https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js",sync:"https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.sync.js"}});
|
|
616
|
+
const sj=new ScramjetController({prefix:"${scramjetPrefix}",files:{wasm:"https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.wasm.wasm",all:"https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js",sync:"https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.sync.js"}});
|
|
611
617
|
sj.init();
|
|
612
618
|
await registerSW();
|
|
613
|
-
const c=new BareMux.BareMuxConnection("
|
|
619
|
+
const c=new BareMux.BareMuxConnection("${workerPath}");
|
|
614
620
|
const wispUrl=(location.host && location.host.includes("unpkg.com")) ? "wss://wisp.mercurywork.shop/" : ((location.protocol==="https:"?"wss":"ws")+"://"+location.host+"/wisp/");
|
|
615
621
|
const transportUrl="https://unpkg.com/@mercuryworkshop/libcurl-transport@1.5.2/dist/index.mjs";
|
|
616
622
|
if((await c.getTransport())!==transportUrl)await c.setTransport(transportUrl,[{websocket:wispUrl}]);
|
|
@@ -707,36 +713,36 @@
|
|
|
707
713
|
QUICK APPS / APPS REGISTRY (unchanged)
|
|
708
714
|
══════════════════════════════════════════ */
|
|
709
715
|
const QUICK_APPS = [
|
|
710
|
-
{ name: "duckduckgo", url: "https://www.duckduckgo.com", icon: `<img src="
|
|
711
|
-
{ name: "youtube", url: "https://www.youtube.com", icon: `<img src="
|
|
712
|
-
{ name: "tiktok", url: "https://www.tiktok.com", icon: `<img src="
|
|
713
|
-
{ name: "discord", url: "https://www.discord.com", icon: `<img src="
|
|
714
|
-
{ name: "Cool Math Games", url: "https://www.coolmathgames.com", icon: `<img src="
|
|
715
|
-
{ name: "x [twitter]", url: "https://www.x.com", icon: `<img src="
|
|
716
|
-
{ name: "chatgpt", url: "https://chat.openai.com", icon: `<img src="
|
|
717
|
-
{ name: "music", url: "https://freefy.app/", icon: `<img src="
|
|
718
|
-
{ name: "movies", url: "https://www.justwatch.com/ca/provider/free-all/", icon: `<img src="
|
|
716
|
+
{ name: "duckduckgo", url: "https://www.duckduckgo.com", icon: `<img src="icons/DDG-Favicon.png" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
717
|
+
{ name: "youtube", url: "https://www.youtube.com", icon: `<img src="icons/YT-Favicon.png" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
718
|
+
{ name: "tiktok", url: "https://www.tiktok.com", icon: `<img src="icons/TT-Favicon.png" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
719
|
+
{ name: "discord", url: "https://www.discord.com", icon: `<img src="icons/DC-Favicon.png" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
720
|
+
{ name: "Cool Math Games", url: "https://www.coolmathgames.com", icon: `<img src="icons/CMG-Favicon.jpg" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
721
|
+
{ name: "x [twitter]", url: "https://www.x.com", icon: `<img src="icons/X-Favicon.jpg" width="25" height="24" style="border-radius:2px;object-fit:contain;" />` },
|
|
722
|
+
{ name: "chatgpt", url: "https://chat.openai.com", icon: `<img src="icons/CGPT-Favicon.png" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
723
|
+
{ name: "music", url: "https://freefy.app/", icon: `<img src="icons/MCTF-Favicon.png" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
724
|
+
{ name: "movies", url: "https://www.justwatch.com/ca/provider/free-all/", icon: `<img src="icons/MP4-Favicon.webp" width="25" height="25" style="border-radius:2px;object-fit:contain;" />` },
|
|
719
725
|
];
|
|
720
726
|
|
|
721
727
|
const APPS_REGISTRY = [
|
|
722
|
-
{ name: "Google", url: "https://www.google.com", icon: `<img src="
|
|
723
|
-
{ name: "YouTube", url: "https://www.youtube.com", icon: `<img src="
|
|
724
|
-
{ name: "Discord", url: "https://discord.com/app", icon: `<img src="
|
|
725
|
-
{ name: "Spotify", url: "https://open.spotify.com", icon: `<img src="
|
|
726
|
-
{ name: "Monochrome.tf", url: "https://monochrome.tf", icon: `<img src="
|
|
727
|
-
{ name: "Reddit", url: "https://www.reddit.com", icon: `<img src="
|
|
728
|
-
{ name: "X / Twitter", url: "https://www.x.com", icon: `<img src="
|
|
729
|
-
{ name: "TikTok", url: "https://www.tiktok.com", icon: `<img src="
|
|
730
|
-
{ name: "ChatGPT", url: "https://chat.openai.com", icon: `<img src="
|
|
731
|
-
{ name: "Now.gg", url: "https://www.now.gg/", icon: `<img src="
|
|
732
|
-
{ name: "Crazy Games", url: "https://www.crazygames.com/", icon: `<img src="
|
|
728
|
+
{ name: "Google", url: "https://www.google.com", icon: `<img src="icons/G-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Search the web", tags: ["search","google"] },
|
|
729
|
+
{ name: "YouTube", url: "https://www.youtube.com", icon: `<img src="icons/YT-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Watch videos", tags: ["video","media"] },
|
|
730
|
+
{ name: "Discord", url: "https://discord.com/app", icon: `<img src="icons/DC-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Chat with friends", tags: ["social","chat"] },
|
|
731
|
+
{ name: "Spotify", url: "https://open.spotify.com", icon: `<img src="icons/S-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Stream music", tags: ["music","media"] },
|
|
732
|
+
{ name: "Monochrome.tf", url: "https://monochrome.tf", icon: `<img src="icons/MCTF-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Stream music", tags: ["music","media"] },
|
|
733
|
+
{ name: "Reddit", url: "https://www.reddit.com", icon: `<img src="icons/RDT-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Browse communities", tags: ["social","news"] },
|
|
734
|
+
{ name: "X / Twitter", url: "https://www.x.com", icon: `<img src="icons/X-Favicon.jpg" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Trending topics & posts", tags: ["social","news"] },
|
|
735
|
+
{ name: "TikTok", url: "https://www.tiktok.com", icon: `<img src="icons/TT-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Short-form videos", tags: ["video","social"] },
|
|
736
|
+
{ name: "ChatGPT", url: "https://chat.openai.com", icon: `<img src="icons/CGPT-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "AI assistant by OpenAI", tags: ["ai","tools"] },
|
|
737
|
+
{ name: "Now.gg", url: "https://www.now.gg/", icon: `<img src="icons/NGG-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Online games for all.", tags: ["games","dev"] },
|
|
738
|
+
{ name: "Crazy Games", url: "https://www.crazygames.com/", icon: `<img src="icons/CZG-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Online games for all.", tags: ["games","dev"] },
|
|
733
739
|
{ name: "Gmail", url: "https://mail.google.com", icon: `<img src="https://ssl.gstatic.com/ui/v1/icons/mail/rfr/gmail.ico" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Email by Google", tags: ["productivity","google"] },
|
|
734
|
-
{ name: "DuckDuckGo", url: "https://www.duckduckgo.com", icon: `<img src="
|
|
735
|
-
{ name: "Bing", url: "https://www.bing.com", icon: `<img src="
|
|
736
|
-
{ name: "GitHub", url: "https://github.com", icon: `<img src="
|
|
737
|
-
{ name: "Replit", url: "https://replit.com", icon: `<img src="
|
|
738
|
-
{ name: "Neal.fun", url: "https://www.neal.fun", icon: `<img src="
|
|
739
|
-
{ name: "Cool Math Games", url: "https://www.coolmathgames.com", icon: `<img src="
|
|
740
|
+
{ name: "DuckDuckGo", url: "https://www.duckduckgo.com", icon: `<img src="icons/DDG-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Private search", tags: ["search"] },
|
|
741
|
+
{ name: "Bing", url: "https://www.bing.com", icon: `<img src="icons/BNG-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Microsoft search", tags: ["search"] },
|
|
742
|
+
{ name: "GitHub", url: "https://github.com", icon: `<img src="icons/GH-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Code & collaboration", tags: ["tools","dev"] },
|
|
743
|
+
{ name: "Replit", url: "https://replit.com", icon: `<img src="icons/RPT-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Code in the browser", tags: ["tools","dev"] },
|
|
744
|
+
{ name: "Neal.fun", url: "https://www.neal.fun", icon: `<img src="icons/NDF-Favicon.png" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Many fun games.", tags: ["games","education"] },
|
|
745
|
+
{ name: "Cool Math Games", url: "https://www.coolmathgames.com", icon: `<img src="icons/CMG-Favicon.jpg" width="32" height="32" style="border-radius:6px;object-fit:contain;" />`, description: "Math-based browser games", tags: ["games","education"] },
|
|
740
746
|
];
|
|
741
747
|
|
|
742
748
|
const cfg = (typeof window !== "undefined" && window.__INDEX_CONFIG) || {};
|
|
@@ -745,13 +751,17 @@
|
|
|
745
751
|
all: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.all.js",
|
|
746
752
|
sync: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.sync.js"
|
|
747
753
|
};
|
|
754
|
+
const baseDir = new URL("./", location.href).pathname;
|
|
755
|
+
const workerPath = (cfg.baremux && cfg.baremux.worker) || new URL("baremux/worker.js", location.href).pathname;
|
|
756
|
+
const scramjetPrefix = baseDir + "service/";
|
|
757
|
+
|
|
748
758
|
const { ScramjetController } = $scramjetLoadController();
|
|
749
759
|
const scramjet = new ScramjetController({
|
|
750
|
-
files: scramjetFiles
|
|
760
|
+
files: scramjetFiles,
|
|
761
|
+
prefix: scramjetPrefix
|
|
751
762
|
});
|
|
752
763
|
scramjet.init();
|
|
753
764
|
|
|
754
|
-
const workerPath = (cfg.baremux && cfg.baremux.worker) || "/baremux/worker.js";
|
|
755
765
|
const connection = new BareMux.BareMuxConnection(workerPath);
|
|
756
766
|
let transportReady = false;
|
|
757
767
|
|
|
@@ -935,7 +945,7 @@
|
|
|
935
945
|
|
|
936
946
|
async function loadGamesRegistry() {
|
|
937
947
|
try {
|
|
938
|
-
const res = await fetch("
|
|
948
|
+
const res = await fetch("games/games.json");
|
|
939
949
|
if (!res.ok) throw new Error();
|
|
940
950
|
gamesRegistry = await res.json();
|
|
941
951
|
} catch(_) { gamesRegistry = []; }
|
|
@@ -1003,9 +1013,10 @@
|
|
|
1003
1013
|
if (list.length === 0) { grid.innerHTML = '<div class="games-noresults">no games match your search.<br><span style="opacity:0.5">try a different keyword or tag</span></div>'; return; }
|
|
1004
1014
|
grid.innerHTML = list.map(g => {
|
|
1005
1015
|
const tagsHTML = (g.tags||[]).length ? `<div class="game-card-tags">${(g.tags).map(t=>`<span class="game-card-tag">${t}</span>`).join("")}</div>` : "";
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
|
|
1016
|
+
const iconSrc = g.icon && g.icon.startsWith("/") ? g.icon.replace(/^\/+/, '') : g.icon;
|
|
1017
|
+
const iconHTML = (iconSrc && (iconSrc.includes("/") || iconSrc.includes(".")))
|
|
1018
|
+
? `<img src="${iconSrc}" style="width:2em;height:2em;object-fit:contain;border-radius:4px;" onerror="this.outerHTML='🎮'" />`
|
|
1019
|
+
: (iconSrc || "🎮");
|
|
1009
1020
|
return `<div class="game-card" data-file="${g.file}" data-name="${g.name}"><div class="game-card-icon">${iconHTML}</div><div class="game-card-name">${g.name}</div>${g.description?`<div class="game-card-desc">${g.description}</div>`:""}${tagsHTML}</div>`;
|
|
1010
1021
|
}).join("");
|
|
1011
1022
|
grid.querySelectorAll(".game-card").forEach(card => { card.addEventListener("click", () => openGameModal(card.dataset.file, card.dataset.name)); });
|
|
@@ -1023,7 +1034,7 @@
|
|
|
1023
1034
|
return;
|
|
1024
1035
|
}
|
|
1025
1036
|
gmName.textContent = name; gmFile.textContent = file;
|
|
1026
|
-
gmIframe.src =
|
|
1037
|
+
gmIframe.src = "games/" + file;
|
|
1027
1038
|
gameModal.classList.add("open");
|
|
1028
1039
|
}
|
|
1029
1040
|
function closeGameModal() { gameModal.classList.remove("open"); gmIframe.src="about:blank"; }
|
package/public/index.js
CHANGED
|
@@ -27,15 +27,19 @@ const scramjetFiles = cfg.scramjet || {
|
|
|
27
27
|
sync: "https://unpkg.com/@mercuryworkshop/scramjet@2.0.0-alpha/dist/scramjet.sync.js",
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const baseDir = new URL("./", location.href).pathname;
|
|
31
|
+
const workerPath = (cfg.baremux && cfg.baremux.worker) || new URL("baremux/worker.js", location.href).pathname;
|
|
32
|
+
const scramjetPrefix = baseDir + "service/";
|
|
33
|
+
|
|
30
34
|
const { ScramjetController } = $scramjetLoadController();
|
|
31
35
|
|
|
32
36
|
const scramjet = new ScramjetController({
|
|
33
37
|
files: scramjetFiles,
|
|
38
|
+
prefix: scramjetPrefix,
|
|
34
39
|
});
|
|
35
40
|
|
|
36
41
|
scramjet.init();
|
|
37
42
|
|
|
38
|
-
const workerPath = (cfg.baremux && cfg.baremux.worker) || "/baremux/worker.js";
|
|
39
43
|
const connection = new BareMux.BareMuxConnection(workerPath);
|
|
40
44
|
|
|
41
45
|
form.addEventListener("submit", async (event) => {
|