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

Function openGameInNewTab

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

Source from the content-addressed store, hash-verified

19}
20
21function openGameInNewTab(gameName) {
22 // Open the viewer in a new tab with the selected game
23 // In static mode, use path-based URLs; in dynamic mode, use query parameters
24 const isStatic = document.body.hasAttribute("data-static-mode");
25 if (isStatic) {
26 // For static mode, encode each path segment separately to preserve slashes
27 const pathSegments = gameName
28 .split("/")
29 .map((segment) => encodeURIComponent(segment));
30 // Navigate to .html file directly
31 const url = `/game/${pathSegments.join("/")}.html`;
32 window.open(url, "_blank");
33 } else {
34 const url = `/?folder=${encodeURIComponent(gameName)}`;
35 window.open(url, "_blank");
36 }
37}
38
39function handleGameClick(event, gameName) {
40 // Handle different types of clicks for Open button

Callers 2

handleGameClickFunction · 0.85
handleRowClickFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected