(gameName)
| 1 | // Game Picker JavaScript |
| 2 | |
| 3 | function 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 | |
| 21 | function openGameInNewTab(gameName) { |
| 22 | // Open the viewer in a new tab with the selected game |
no outgoing calls
no test coverage detected