MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / openGame

Function openGame

codeclash/viewer/static/js/picker.js:3–19  ·  view source on GitHub ↗
(gameName)

Source from the content-addressed store, hash-verified

1// Game Picker JavaScript
2
3function openGame(gameName) {
4 // Navigate to the viewer with the selected game
5 // In static mode, use path-based URLs; in dynamic mode, use query parameters
6 const isStatic = document.body.hasAttribute("data-static-mode");
7 if (isStatic) {
8 // For static mode, encode each path segment separately to preserve slashes
9 const pathSegments = gameName
10 .split("/")
11 .map((segment) => encodeURIComponent(segment));
12 // Navigate to .html file directly
13 const url = `/game/${pathSegments.join("/")}.html`;
14 window.location.href = url;
15 } else {
16 const url = `/?folder=${encodeURIComponent(gameName)}`;
17 window.location.href = url;
18 }
19}
20
21function openGameInNewTab(gameName) {
22 // Open the viewer in a new tab with the selected game

Callers 3

handleGameClickFunction · 0.85
handleRowClickFunction · 0.85
activateSelectedRowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected