32 lines
841 B
JavaScript
32 lines
841 B
JavaScript
document.addEventListener('htmx:wsConfigSend', function (e) {
|
|
if (e.target.classList.contains('intersection')) {
|
|
const row = parseInt(e.target.dataset.row);
|
|
const col = parseInt(e.target.dataset.col);
|
|
|
|
console.log(e.target.id);
|
|
|
|
// Set the custom JSON data
|
|
e.detail.parameters = {
|
|
type: 'make_move',
|
|
row: row,
|
|
col: col,
|
|
};
|
|
} else if (e.target.id == 'resign-button') {
|
|
e.detail.parameters = {
|
|
type: 'resign',
|
|
};
|
|
} else if (e.target.id == 'takeback-button') {
|
|
e.detail.parameters = {
|
|
type: 'request_takeback',
|
|
};
|
|
} else if (e.target.id == 'accept-takeback-button') {
|
|
e.detail.parameters = {
|
|
type: 'accept_takeback',
|
|
};
|
|
} else if (e.target.id == 'decline-takeback-button') {
|
|
e.detail.parameters = {
|
|
type: 'decline_takeback',
|
|
};
|
|
}
|
|
});
|