Added games

This commit is contained in:
Mysaa Java
2026-09-12 13:34:24 +02:00
parent 44e5a01727
commit 6127508211
13 changed files with 702 additions and 422 deletions
+1 -14
View File
@@ -1,6 +1,5 @@
var socket = null
var player = '_'
var roomId = '_'
var wsHeaders = {}
var cards = []
var gc = {}
@@ -11,13 +10,6 @@ var phase = {}
// This variable is here to check for updates to availableHintWordCount, as updating it is a bit expensive
var registeredAvailableHintWordCountInvalid = true
function getRoomId() {
const urlRegex = /\/room\/([a-f0-9-]{36})\/grid$/
const res = urlRegex.exec(window.location.href)
if (res == null)
console.log("Could not understand room id from url")
return res[1]
}
/*
* Update html to match state
@@ -245,8 +237,7 @@ function initGame(data) {
updatePhase()
}
function selectPlayer(e) {
player = (e.target.id == "select-player-a") ? 'A' : 'B'
function selectPlayer(player) {
wsHeaders = {
"room": roomId,
"player": player
@@ -336,14 +327,10 @@ function onConfigChange(m) {
}
function initialize() {
$('#select-player-a').on('click', selectPlayer)
$('#select-player-b').on('click', selectPlayer)
$('#submit-hint button').on('click', submitHint)
$('#end-guessing-button').on('click', endGuessing)
$('#enter-sudden-death-button').on('click', enterSuddenDeath)
roomId = getRoomId()
$('#game-panel').hide()
$('#side-panel').hide()
}