Added games
This commit is contained in:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user