bugfix and more celebrations
This commit is contained in:
parent
6218869917
commit
56c458aac5
@ -54,5 +54,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p id="seeed">Seeed: <span id="seeed-value"></span> <span id="copy-permalink">📋</span></p>
|
<p id="seeed">Seeed: <span id="seeed-value"></span> <span id="copy-permalink">📋</span></p>
|
||||||
|
<div id="winner-message">
|
||||||
|
<div>B</div>
|
||||||
|
<div>I</div>
|
||||||
|
<div>N</div>
|
||||||
|
<div>G</div>
|
||||||
|
<div>O</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -57,6 +57,7 @@ const centerFieldImage = document.querySelector('#center-field-image');
|
|||||||
const bingoFields = document.querySelectorAll('#bingo td.bingo-field');
|
const bingoFields = document.querySelectorAll('#bingo td.bingo-field');
|
||||||
const refreshBingoButton = document.querySelector('#refresh-bingo');
|
const refreshBingoButton = document.querySelector('#refresh-bingo');
|
||||||
const copyPermalinkButton = document.querySelector('#copy-permalink');
|
const copyPermalinkButton = document.querySelector('#copy-permalink');
|
||||||
|
const winnerMessage = document.querySelector('#winner-message');
|
||||||
|
|
||||||
centerFieldImage.src = "img/7-vs-wild-logo.svg";
|
centerFieldImage.src = "img/7-vs-wild-logo.svg";
|
||||||
centerFieldImage.alt = "7 vs. Wild Logo";
|
centerFieldImage.alt = "7 vs. Wild Logo";
|
||||||
@ -95,8 +96,8 @@ const checkForBingo = (field) => {
|
|||||||
let clickedCol = parseInt(field.dataset.col);
|
let clickedCol = parseInt(field.dataset.col);
|
||||||
|
|
||||||
//check horizontal and vertical axis
|
//check horizontal and vertical axis
|
||||||
if (document.querySelectorAll(`#bingo td.bingo-field.drawn[data-row='${clickedRow}']`).length === 5
|
if (document.querySelectorAll(`#bingo td.drawn[data-row='${clickedRow}']`).length === 5
|
||||||
|| document.querySelectorAll(`#bingo td.bingo-field.drawn[data-col='${clickedCol}']`).length === 5) {
|
|| document.querySelectorAll(`#bingo td.drawn[data-col='${clickedCol}']`).length === 5) {
|
||||||
bingo = true
|
bingo = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ const checkForBingo = (field) => {
|
|||||||
}
|
}
|
||||||
if (bingo) {
|
if (bingo) {
|
||||||
window.fireworks.start();
|
window.fireworks.start();
|
||||||
|
winnerMessage.classList.add('won');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,6 +201,7 @@ drawTable();
|
|||||||
|
|
||||||
|
|
||||||
const redrawTable = function () {
|
const redrawTable = function () {
|
||||||
|
winnerMessage.classList.remove('won');
|
||||||
bingoFields.forEach(elem => elem.classList.remove('drawn'));
|
bingoFields.forEach(elem => elem.classList.remove('drawn'));
|
||||||
seed = Date.now().toString();
|
seed = Date.now().toString();
|
||||||
drawTable();
|
drawTable();
|
||||||
|
23
style.css
23
style.css
@ -25,6 +25,10 @@ td {
|
|||||||
font-size: xx-large;
|
font-size: xx-large;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
td:hover {
|
td:hover {
|
||||||
background-color: blueviolet;
|
background-color: blueviolet;
|
||||||
}
|
}
|
||||||
@ -53,4 +57,23 @@ p#seeed {
|
|||||||
|
|
||||||
span#copy-permalink, span#refresh-bingo {
|
span#copy-permalink, span#refresh-bingo {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#winner-message {
|
||||||
|
display: flex;
|
||||||
|
position: fixed;
|
||||||
|
font-size: 3000%;
|
||||||
|
left: 50%;
|
||||||
|
top: 100%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
text-shadow: 10px 10px 20px black;
|
||||||
|
color: orange;
|
||||||
|
transition: all ease-out .75s;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#winner-message.won {
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user