fixed bug whereby non identified user would get constantly redirected until chrome blocked it

This commit is contained in:
Ben Kyd
2021-05-07 00:13:27 +01:00
parent a0fde3ec23
commit b93c91243f
4 changed files with 32 additions and 16 deletions

View File

@@ -15,10 +15,22 @@ function initGame(boardstate, tileset, myplayer, players)
let drawerStructure = [];
for (const tile of myplayer.activetiles)
{
let points = 0;
// for (const pointband of tileset)
// {
// console.log(pointband)
// }
const piece = {
letter: tile,
score: points
}
drawerStructure.push(piece);
console.log(tile);
}
addPiecesToDrawer();
addPiecesToDrawer(drawerStructure);
return true;
}

View File

@@ -294,13 +294,13 @@
</div>
<div id="piece-drawer">
<piece class="unselectable unplayed-piece">Ç<score>8</score></piece>
<!-- <piece class="unselectable unplayed-piece">Ç<score>8</score></piece>
<piece class="unselectable unplayed-piece">_<score>_</score></piece>
<piece class="unselectable unplayed-piece">C<score>3</score></piece>
<piece class="unselectable unplayed-piece">D<score>2</score></piece>
<piece class="unselectable unplayed-piece">E<score>1</score></piece>
<piece class="unselectable unplayed-piece">F<score>4</score></piece>
<piece class="unselectable unplayed-piece">G<score>2</score></piece>
<piece class="unselectable unplayed-piece">G<score>2</score></piece> -->
</div>
<div id="game-info-compact" style="display: none;">

View File

@@ -39,7 +39,8 @@ function onIdentify(socket, args)
{
socket.disconnect();
ConnectionState.innerHTML = 'Identify cannot proceed, no user';
document.location.href += '../';
document.qu
window.location = `/`;
return;
}
@@ -51,7 +52,7 @@ function onIdentify(socket, args)
{
socket.disconnect();
ConnectionState.innerHTML = 'Identify cannot proceed, corrupted user';
document.location.href += '../';
window.location = `/`;
return;
}
@@ -59,7 +60,7 @@ function onIdentify(socket, args)
{
socket.disconnect();
ConnectionState.innerHTML = 'Identify cannot proceed, corrupted user';
document.location.href += '../';
window.location = `/`;
return;
}
@@ -69,7 +70,7 @@ function onIdentify(socket, args)
{
socket.disconnect();
ConnectionState.innerHTML = 'Identify cannot proceed, corrupted lobby';
document.location.href += '../';
window.location = `/`;
return;
}

View File

@@ -28,18 +28,21 @@ TILE OBJECT
*/
let PiecesDrawer = [];
// Expects structure [{letter: '', score: int}]
// Returns array of tile IDs that were added
function addPiecesToDrawer(pieces)
{
const piece = document.createElement('piece');
piece.innerText = 'A';
piece.classList.add('unselectable');
piece.classList.add('unplayed-piece');
const score = document.createElement('score');
score.innerText = '2';
piece.appendChild(score);
Drawer.appendChild(piece);
for (const piece of pieces)
{
const domPiece = document.createElement('piece');
domPiece.innerText = piece.letter;
domPiece.classList.add('unselectable');
domPiece.classList.add('unplayed-piece');
const score = document.createElement('score');
score.innerText = piece.score;
domPiece.appendChild(score);
Drawer.appendChild(domPiece);
}
setupPieces();
updatePieceEventListeners();
}