This commit is contained in:
sepia 2025-07-19 18:34:53 -05:00
parent 1f19022d45
commit 742bd4f106
8 changed files with 49 additions and 62 deletions

View file

@ -10,4 +10,4 @@ function copyGameLink() {
console.error('Failed to copy link: ', err);
});
}
}
}

View file

@ -22,12 +22,10 @@ htmx.trigger(gameContainer, ' and connect');
// Update the game link input
const gameLinkInput = document.getElementById('game-link');
if (!gameLinkInput) {
console.error('Missing game-link element.')
console.error('Missing game-link element.');
}
gameLinkInput.value =
window.location.origin +
window.location.pathname +
`?gameId=${gameId}`;
window.location.origin + window.location.pathname + `?gameId=${gameId}`;
// Update the WebSocket status indicator
const wsStatusDiv = document.getElementById('ws-status');

View file

@ -1,13 +1,13 @@
document.addEventListener('htmx:wsConfigSend', function(e) {
if (e.target.classList.contains('board-cell')) {
const row = parseInt(e.target.dataset.row);
const col = parseInt(e.target.dataset.col);
// Set the custom JSON data
e.detail.parameters = {
type: "make_move",
row: row,
col: col
};
}
});
document.addEventListener('htmx:wsConfigSend', function (e) {
if (e.target.classList.contains('board-cell')) {
const row = parseInt(e.target.dataset.row);
const col = parseInt(e.target.dataset.col);
// Set the custom JSON data
e.detail.parameters = {
type: 'make_move',
row: row,
col: col,
};
}
});