mirror of
https://github.com/AndrioCelos/TableturfBattleApp.git
synced 2026-09-10 04:15:14 -05:00
Change results page labels and add a leave game link
This commit is contained in:
@@ -68,7 +68,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div id="resultContainer" hidden>
|
||||
<div id="result">Result</div>
|
||||
<a id="resultLeaveButton" href="#">Leave game</a>
|
||||
</div>
|
||||
|
||||
<div class="playerBar" data-index="0">
|
||||
|
||||
@@ -140,6 +140,7 @@ function showResult() {
|
||||
if (currentGame == null) return;
|
||||
midGameContainer.hidden = true;
|
||||
resultContainer.hidden = false;
|
||||
turnNumberLabel.setTurnNumber(null);
|
||||
|
||||
let winners = [ 0 ]; let maxPoints = playerBars[0].points;
|
||||
for (let i = 1; i < currentGame.players.length; i++) {
|
||||
@@ -158,18 +159,18 @@ function showResult() {
|
||||
el.classList.add('win');
|
||||
el.classList.remove('lose');
|
||||
el.classList.remove('draw');
|
||||
el.innerText = 'Win!';
|
||||
el.innerText = 'Victory';
|
||||
} else {
|
||||
el.classList.remove('win');
|
||||
el.classList.remove('lose');
|
||||
el.classList.add('draw');
|
||||
el.innerText = 'Draw!';
|
||||
el.innerText = 'Draw';
|
||||
}
|
||||
} else {
|
||||
el.classList.remove('win');
|
||||
el.classList.add('lose');
|
||||
el.classList.remove('draw');
|
||||
el.innerText = 'Lose...';
|
||||
el.innerText = 'Defeat';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,3 +307,14 @@ board.onclick = (x, y) => {
|
||||
board.autoHighlight = false;
|
||||
}
|
||||
};
|
||||
|
||||
document.getElementById('resultLeaveButton')!.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
document.getElementById('preGameDefaultSection')!.hidden = false;
|
||||
document.getElementById('preGameJoinSection')!.hidden = true;
|
||||
window.location.hash = '#';
|
||||
currentGame = null;
|
||||
gameIDBox.value = '';
|
||||
showSection('preGame');
|
||||
newGameButton.focus();
|
||||
});
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
const newGameButton = document.getElementById('newGameButton')!;
|
||||
const joinGameButton = document.getElementById('joinGameButton')!;
|
||||
const nameBox = document.getElementById('nameBox') as HTMLInputElement;
|
||||
const gameIDBox = document.getElementById('gameIDBox') as HTMLInputElement;
|
||||
|
||||
(document.getElementById('preGameForm') as HTMLFormElement).addEventListener('submit', e => {
|
||||
e.preventDefault();
|
||||
if (e.submitter?.id == 'joinGameButton') {
|
||||
const name = (document.getElementById('nameBox') as HTMLInputElement).value;
|
||||
const name = nameBox.value;
|
||||
window.localStorage.setItem('name', name);
|
||||
tryJoinGame(name, (document.getElementById('gameIDBox') as HTMLInputElement).value);
|
||||
tryJoinGame(name, gameIDBox.value);
|
||||
} else {
|
||||
const name = (document.getElementById('nameBox') as HTMLInputElement).value;
|
||||
const name = nameBox.value;
|
||||
window.localStorage.setItem('name', name);
|
||||
|
||||
let request = new XMLHttpRequest();
|
||||
|
||||
@@ -322,10 +322,6 @@ footer {
|
||||
height: 28em;
|
||||
}
|
||||
|
||||
#resultContainer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Score bar */
|
||||
|
||||
#scoreSection {
|
||||
|
||||
Reference in New Issue
Block a user