Skip to content

Commit

Permalink
Merge branch 'main' into sound
Browse files Browse the repository at this point in the history
  • Loading branch information
hars-21 authored Aug 9, 2024
2 parents 540b3b0 + 2130ff9 commit e1768da
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 227 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<button class="req1">Cancel</button>
<button class="req2" style="background-color: rgb(0, 200, 255);">Allow</button>
</div>

<div class="settings">
<video autoplay muted class="video" loop id="myVideo">
<source src="/assets/videos/1.mp4" type="video/mp4" />
Expand Down
11 changes: 4 additions & 7 deletions js/validation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
document.addEventListener("DOMContentLoaded", () => {
const rowsInput = document.getElementById("rows");
const columnsInput = document.getElementById("columns");
const playersInput = document.getElementById("players-count");
const startBtn = document.querySelector(".start-btn");
const validationMessage = document.getElementById("validation-message");
Expand All @@ -19,21 +17,19 @@ document.addEventListener("DOMContentLoaded", () => {
};

const validateAllInputs = () => {
const invalidRows = !validateInput(rowsInput, 5, 30);
const invalidColumns = !validateInput(columnsInput, 5, 30);
const invalidPlayers = !validateInput(playersInput, 2, 6);

if (invalidRows || invalidColumns || invalidPlayers) {
if (invalidPlayers) {
startBtn.disabled = true;
startBtn.classList.add("disabled");
showValidationMessage(true);
} else {
startBtn.disabled = false;
startBtn.classList.remove("disabled");
showValidationMessage(false);
}
};

rowsInput.addEventListener("input", validateAllInputs);
columnsInput.addEventListener("input", validateAllInputs);
playersInput.addEventListener("input", validateAllInputs);

startBtn.addEventListener("click", (event) => {
Expand All @@ -43,5 +39,6 @@ document.addEventListener("DOMContentLoaded", () => {
});

// Initial validation

validateAllInputs();
});
Loading

0 comments on commit e1768da

Please sign in to comment.