From 087fb8cda37f807293fbcc92a578ff03c43a4110 Mon Sep 17 00:00:00 2001 From: Harshil Gupta Date: Fri, 9 Aug 2024 22:47:04 +0530 Subject: [PATCH 1/2] fixed validation --- js/validation.js | 11 +- styles/index.style.css | 242 +++++++++++++++++++++++------------------ 2 files changed, 139 insertions(+), 114 deletions(-) diff --git a/js/validation.js b/js/validation.js index 8bb25d4..44dae07 100644 --- a/js/validation.js +++ b/js/validation.js @@ -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"); @@ -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) => { @@ -43,5 +39,6 @@ document.addEventListener("DOMContentLoaded", () => { }); // Initial validation + validateAllInputs(); }); diff --git a/styles/index.style.css b/styles/index.style.css index 542edb7..33dea24 100644 --- a/styles/index.style.css +++ b/styles/index.style.css @@ -111,7 +111,7 @@ input:out-of-range { border: 5px solid red; } -input:out-of-range + .error::after { +input:out-of-range+.error::after { content: "Please enter value between 5 and 30"; font-size: 12px; font-style: italic; @@ -119,7 +119,7 @@ input:out-of-range + .error::after { color: hsl(0, 100%, 40%); } -input:out-of-range + .player::after { +input:out-of-range+.player::after { content: "Please enter value between 2 and 6"; font-size: 12px; font-style: italic; @@ -255,7 +255,7 @@ input:out-of-range + .player::after { opacity: 1; } -.difficulty:hover > :not(.d-type:hover) { +.difficulty:hover> :not(.d-type:hover) { transition: 300ms; filter: blur(1px); transform: scale(0.95, 0.95); @@ -298,82 +298,90 @@ input:out-of-range + .player::after { background-color: grey; } -p,h3,h2{ +p, +h3, +h2 { font-family: 'Press Start 2P', cursive !important; } /* Modal styles */ .modal { -display: none; -position: fixed; -z-index: 1000; -left: 0; -top: 0; -width: 100%; -height: 150%; -overflow: auto; -background-color: rgba(0, 0, 0, 0.4); -backdrop-filter: blur(5px); + display: none; + position: fixed; + z-index: 1000; + left: 0; + top: 0; + width: 100%; + height: 150%; + overflow: auto; + background-color: rgba(0, 0, 0, 0.4); + backdrop-filter: blur(5px); } .modal-content { -background-color: white; -margin: 15% auto; -padding: 20px; -border-radius: 10px; -width: 50%; -max-width: 650px; -box-shadow: 0 5px 15px rgba(0,0,0,0.3); -animation: fadeIn 0.5s; + background-color: white; + margin: 15% auto; + padding: 20px; + border-radius: 10px; + width: 50%; + max-width: 650px; + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); + animation: fadeIn 0.5s; } .close { -color: #aaa; -float: right; -font-size: 28px; -font-weight: bold; + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; } .close:hover, .close:focus { -color: black; -text-decoration: none; -cursor: pointer; + color: black; + text-decoration: none; + cursor: pointer; } form { -display: flex; -flex-direction: column; -gap: 15px; + display: flex; + flex-direction: column; + gap: 15px; } .form-group { -display: flex; -flex-direction: column; + display: flex; + flex-direction: column; } .form-group label { -margin-bottom: 5px; -font-weight: bold; -color: white; -text-shadow: 1px 1px 5px rgba(255, 0, 0, 0.685); + margin-bottom: 5px; + font-weight: bold; + color: white; + text-shadow: 1px 1px 5px rgba(255, 0, 0, 0.685); } + .form-group-1 { -display: flex; + display: flex; } .submitbtn { -display: flex; -justify-content: space-between; + display: flex; + justify-content: space-between; } @keyframes fadeIn { -from { opacity: 0; } -to { opacity: 1; } + from { + opacity: 0; + } + + to { + opacity: 1; + } } @@ -406,7 +414,7 @@ to { opacity: 1; } animation: formAppear 0.5s ease-out; } -.right-background{ +.right-background { font-family: 'Press Start 2P', cursive; } @@ -414,8 +422,9 @@ to { opacity: 1; } from { opacity: 0; transform: scale(0.8); - + } + to { opacity: 1; transform: scale(1); @@ -434,9 +443,9 @@ to { opacity: 1; } font-size: 27px; color: #fffefe; margin: 0; - font-family:Tahoma, Geneva, Verdana, sans-serif; + font-family: Tahoma, Geneva, Verdana, sans-serif; text-align: center; - text-shadow: 2px 2px 2px rgba(0, 20, 123, 0.87),2px 2px 4px rgba(157, 0, 255, 0.81), 2px 6px 7px rgba(248, 112, 255, 0.81); + text-shadow: 2px 2px 2px rgba(0, 20, 123, 0.87), 2px 2px 4px rgba(157, 0, 255, 0.81), 2px 6px 7px rgba(248, 112, 255, 0.81); } .close-button { @@ -445,8 +454,8 @@ to { opacity: 1; } cursor: pointer; transition: transform 0.3s ease; position: relative; - bottom:16px; - left:6px + bottom: 16px; + left: 6px } .close-button:hover { @@ -458,9 +467,9 @@ to { opacity: 1; } /* border-radius: 15px; */ padding: 15px; /* margin-bottom: 0px; */ - max-width:400px; + max-width: 400px; width: 100%; - + /* box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); */ } @@ -495,19 +504,19 @@ to { opacity: 1; } width: 80%; } -#star-2:checked ~ .content .emojis .slideImg { +#star-2:checked~.content .emojis .slideImg { margin-top: -135px; } -#star-3:checked ~ .content .emojis .slideImg { +#star-3:checked~.content .emojis .slideImg { margin-top: -270px; } -#star-4:checked ~ .content .emojis .slideImg { +#star-4:checked~.content .emojis .slideImg { margin-top: -405px; } -#star-5:checked ~ .content .emojis .slideImg { +#star-5:checked~.content .emojis .slideImg { margin-top: -540px; } @@ -528,36 +537,36 @@ to { opacity: 1; } transform: scale(1.2) rotate(15deg); } -#star-1:hover ~ .content .stars .star-1, -#star-1:checked ~ .content .stars .star-1, -#star-2:hover ~ .content .stars .star-1, -#star-2:hover ~ .content .stars .star-2, -#star-2:checked ~ .content .stars .star-1, -#star-2:checked ~ .content .stars .star-2, -#star-3:hover ~ .content .stars .star-1, -#star-3:hover ~ .content .stars .star-2, -#star-3:hover ~ .content .stars .star-3, -#star-3:checked ~ .content .stars .star-1, -#star-3:checked ~ .content .stars .star-2, -#star-3:checked ~ .content .stars .star-3, -#star-4:hover ~ .content .stars .star-1, -#star-4:hover ~ .content .stars .star-2, -#star-4:hover ~ .content .stars .star-3, -#star-4:hover ~ .content .stars .star-4, -#star-4:checked ~ .content .stars .star-1, -#star-4:checked ~ .content .stars .star-2, -#star-4:checked ~ .content .stars .star-3, -#star-4:checked ~ .content .stars .star-4, -#star-5:hover ~ .content .stars .star-1, -#star-5:hover ~ .content .stars .star-2, -#star-5:hover ~ .content .stars .star-3, -#star-5:hover ~ .content .stars .star-4, -#star-5:hover ~ .content .stars .star-5, -#star-5:checked ~ .content .stars .star-1, -#star-5:checked ~ .content .stars .star-2, -#star-5:checked ~ .content .stars .star-3, -#star-5:checked ~ .content .stars .star-4, -#star-5:checked ~ .content .stars .star-5 { +#star-1:hover~.content .stars .star-1, +#star-1:checked~.content .stars .star-1, +#star-2:hover~.content .stars .star-1, +#star-2:hover~.content .stars .star-2, +#star-2:checked~.content .stars .star-1, +#star-2:checked~.content .stars .star-2, +#star-3:hover~.content .stars .star-1, +#star-3:hover~.content .stars .star-2, +#star-3:hover~.content .stars .star-3, +#star-3:checked~.content .stars .star-1, +#star-3:checked~.content .stars .star-2, +#star-3:checked~.content .stars .star-3, +#star-4:hover~.content .stars .star-1, +#star-4:hover~.content .stars .star-2, +#star-4:hover~.content .stars .star-3, +#star-4:hover~.content .stars .star-4, +#star-4:checked~.content .stars .star-1, +#star-4:checked~.content .stars .star-2, +#star-4:checked~.content .stars .star-3, +#star-4:checked~.content .stars .star-4, +#star-5:hover~.content .stars .star-1, +#star-5:hover~.content .stars .star-2, +#star-5:hover~.content .stars .star-3, +#star-5:hover~.content .stars .star-4, +#star-5:hover~.content .stars .star-5, +#star-5:checked~.content .stars .star-1, +#star-5:checked~.content .stars .star-2, +#star-5:checked~.content .stars .star-3, +#star-5:checked~.content .stars .star-4, +#star-5:checked~.content .stars .star-5 { color: gold; text-shadow: 0 0 5px #ff8800; animation: starPulse 0.5s infinite alternate; @@ -567,6 +576,7 @@ to { opacity: 1; } from { transform: scale(1); } + to { transform: scale(1.1); } @@ -588,7 +598,7 @@ to { opacity: 1; } font-size: 18px; font-weight: 600; color: #eeeeee; - font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; + font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; text-shadow: 1px 1px 2px rgb(48, 158, 209), 0 0 1em rgb(7, 0, 109), 0 0 0.4em rgb(7, 0, 109); } @@ -609,6 +619,7 @@ input[type="email"] { font-size: 14px; transition: all 0.3s ease; } + textarea { background-color: #fff; border: 2px solid #0168ce; @@ -627,7 +638,8 @@ input[type="email"]:focus { border-color: #00438e; outline: none; } -.buttons { + +.buttons { /* background: linear-gradient(45deg, #4ecdc4, #45b7aa); */ background: linear-gradient(45deg, #cd4e4e, #fe165f); color: #fff; @@ -639,7 +651,7 @@ input[type="email"]:focus { font-size: 16px; font-weight: bold; transition: all 0.3s ease; - + } .buttons:hover { @@ -690,43 +702,43 @@ input[type="email"]:focus { content: "0 out of 5"; } -#star-1:checked ~ .footer .text::before { +#star-1:checked~.footer .text::before { content: "I just hate it 😣"; } -#star-1:checked ~ .footer .numb::before { +#star-1:checked~.footer .numb::before { content: "1 out of 5"; } -#star-2:checked ~ .footer .text::before { +#star-2:checked~.footer .text::before { content: "I don't like it 😓"; } -#star-2:checked ~ .footer .numb::before { +#star-2:checked~.footer .numb::before { content: "2 out of 5"; } -#star-3:checked ~ .footer .text::before { +#star-3:checked~.footer .text::before { content: "This is awesome 😄"; } -#star-3:checked ~ .footer .numb::before { +#star-3:checked~.footer .numb::before { content: "3 out of 5"; } -#star-4:checked ~ .footer .text::before { +#star-4:checked~.footer .text::before { content: "I just like it 😃"; } -#star-4:checked ~ .footer .numb::before { +#star-4:checked~.footer .numb::before { content: "4 out of 5"; } -#star-5:checked ~ .footer .text::before { +#star-5:checked~.footer .text::before { content: "I just love it ❤️"; } -#star-5:checked ~ .footer .numb::before { +#star-5:checked~.footer .numb::before { content: "5 out of 5"; } @@ -743,12 +755,14 @@ input[type="email"]:focus { max-width: 300px; max-height: 600px; } - .emojis li img{ + + .emojis li img { width: 60%; height: 60%; margin-left: 20%; } - .stars{ + + .stars { display: flex; } @@ -769,6 +783,7 @@ input[type="email"]:focus { max-width: 100vw !important; overflow-x: hidden !important; } + .settings { max-width: 100vw !important; } @@ -788,18 +803,21 @@ input[type="email"]:focus { padding-left: 0px !important; margin-right: 0px !important; } - .footer .text, .footer .numb{ + + .footer .text, + .footer .numb { display: flex; margin-right: 15px; font-size: 15px !important; - } - .form-group textarea{ + } + + .form-group textarea { resize: none; - } + } .heading { width: max-content; - font-size: 1.2rem; + font-size: 1.2rem; } button.d-type { @@ -811,7 +829,8 @@ input[type="email"]:focus { width: 100% !important; flex-wrap: wrap !important; } - .button-container button{ + + .button-container button { width: 100% !important; } @@ -819,7 +838,8 @@ input[type="email"]:focus { margin-bottom: 300px !important; } - .author, .author .fotbar { + .author, + .author .fotbar { max-width: 100vw !important; flex-wrap: wrap !important; } @@ -866,19 +886,27 @@ input[type="email"]:focus { gap: 30px; top: 25vh; } + body { overflow: visible !important; } + .settings .form { padding: 1rem 6rem; margin: 4px 13rem; left: 15%; position: relative; } + .settings { top: -33px; } } + #copyright { color: white; } + +.disabled { + opacity: 0.75; +} \ No newline at end of file From 08ecbf74b1b5e18f31d4fc09de031f04187bdab3 Mon Sep 17 00:00:00 2001 From: Harshil Gupta Date: Fri, 9 Aug 2024 22:47:37 +0530 Subject: [PATCH 2/2] minor fixes --- index.html | 435 +++++++++++++++++++++--------------------------- pages/game.html | 427 +++++++++++++++++++++++------------------------ 2 files changed, 395 insertions(+), 467 deletions(-) diff --git a/index.html b/index.html index 9988a63..3185b04 100644 --- a/index.html +++ b/index.html @@ -1,270 +1,211 @@ - - - - - - - - - - - - - - - - - Dots & Boxes Game - - - + + + + + + + + + + + + + + + + + Dots & Boxes Game + - -
- -
- - - -
-
-
-
-
We'd Love Your Feedback!
- × -
-
- - - - - -
-
-
-
  • - emoji -
  • -
  • - emoji -
  • -
  • - emoji -
  • -
  • - emoji -
  • -
  • - emoji -
  • -
    -
    -
    - - - - - + + + + +
    + +
    + + + +
    +
    +
    +
    +
    We'd Love Your Feedback!
    + × +
    +
    + + + + + +
    +
    +
    +
  • + emoji +
  • +
  • + emoji +
  • +
  • + emoji +
  • +
  • + emoji +
  • +
  • + emoji +
  • - + +
    -
    -
    -
    - - -
    -
    - - -
    -
    + +
    - - + +
    -
    - - +
    + +
    - -
    +
    +
    + + +
    +
    + + +
    +
    - + -
    - -

    ▂ ▄ █ MAXIMISE BOXES!! █ ▄ ▂

    -

    - Instructions -

    -

    - 1. 🧩 Select the number of rows, columns, and players.
    - 2. 🏆 The player who has the maximum number of boxes on the board is - the winner.
    - 3. 🔄 Players will switch after every turn. But the player who fills - the last box will get one extra chance consecutively. 🎉
    -

    +
    + +

    ▂ ▄ █ MAXIMISE BOXES!! █ ▄ ▂

    +

    + Instructions +

    +

    + 1. 🧩 Select the number of rows, columns, and players.
    + 2. 🏆 The player who has the maximum number of boxes on the board is + the winner.
    + 3. 🔄 Players will switch after every turn. But the player who fills + the last box will get one extra chance consecutively. 🎉
    +

    - Read Detailed Instructions -
    -
    -
    -
    - - -
    -
    - -
    - - - - -
    + Read Detailed Instructions +
    +
    +
    +
    + + +
    +
    + +
    + + + +
    +
    -
    - - - -
    +
    + + + +
    -
    - - START - - - -
    +
    + + START + + +
    -
    - - - Chrome Gaming - + + + Chrome Gaming +
    - - - + + + + - - + \ No newline at end of file diff --git a/pages/game.html b/pages/game.html index 3f20291..0557df4 100644 --- a/pages/game.html +++ b/pages/game.html @@ -1,256 +1,245 @@ - - - - - - - - - - - - - - - - - - - - - Dots & Boxes Game - - - - - - - -
    -
    -
    - -
    -
    - - - - - - - Back - -
    + + + + + + + + + + + + + + + + + + + + + + Dots & Boxes Game + + + + + + + +
    +
    +
    +
    -
    - -
    -

    Select Avatar

    -
    -
    - - +
    + + + + + + + + Back +
    +
    + +
    +

    Select Avatar

    +
    +
    + + +
    +
    -
    - -