Reformat
This commit is contained in:
parent
1f19022d45
commit
742bd4f106
8 changed files with 49 additions and 62 deletions
|
|
@ -10,4 +10,4 @@ function copyGameLink() {
|
|||
console.error('Failed to copy link: ', err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue