From 7daefd8ae8ad2981f65d46d49e7df77db3240a69 Mon Sep 17 00:00:00 2001 From: sukruthi sanampudi Date: Sat, 22 Oct 2022 03:10:45 +0530 Subject: [PATCH 1/3] changed index.html, added countdown.js --- check.js | 1 + countdown.js | 27 +++++++++++++++++++++++++++ index.html | 14 +++++++++++--- style.css | 26 ++++++++++++++++++++++++++ styles.css | 8 ++++++++ 5 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 countdown.js create mode 100644 style.css create mode 100644 styles.css diff --git a/check.js b/check.js index 6ce2dc6..761480a 100644 --- a/check.js +++ b/check.js @@ -33,3 +33,4 @@ function check(){ } } setTimeout( function ( ) { alert( "Time is up!!!" ); location.reload();}, 300000 ) //added a timer to reset the gane after 5 mins + diff --git a/countdown.js b/countdown.js new file mode 100644 index 0000000..3b46039 --- /dev/null +++ b/countdown.js @@ -0,0 +1,27 @@ +document.getElementById('timer').innerHTML = + 05 + ":" + 00; +startTimer(); + + +function startTimer() { + var presentTime = document.getElementById('timer').innerHTML; + var timeArray = presentTime.split(/[:]+/); + var m = timeArray[0]; + var s = checkSecond((timeArray[1] - 1)); + if(s==59){m=m-1} + if(m<0){ + return + } + + document.getElementById('timer').innerHTML = + m + ":" + s; + console.log(m) + setTimeout(startTimer, 1000); + +} + +function checkSecond(sec) { + if (sec < 10 && sec >= 0) {sec = "0" + sec}; // add zero in front of numbers < 10 + if (sec < 0) {sec = "59"}; + return sec; +} \ No newline at end of file diff --git a/index.html b/index.html index bdc89ee..12269d4 100644 --- a/index.html +++ b/index.html @@ -21,15 +21,22 @@ + + +
+ +

Wordle Clone

+
Time left =
-
Easy
-
Medium
-
Hard
+ +
+
+
@@ -42,5 +49,6 @@

Rules

+ \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..d24ab91 --- /dev/null +++ b/style.css @@ -0,0 +1,26 @@ +@import url('https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap'); + +button:focus, +input:focus{ + outline: none; + box-shadow: none; +} +a, +a:hover{ + text-decoration: none; +} + +body{ + font-family: 'Roboto', sans-serif; +} + +/*------------------ */ +.otp-countdown{ + display: inline-block; + margin: 0 auto; + padding: 8px 30px; + background-color: #333; + border-radius: 50px; + color: #fff; + +} \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..aa6be16 --- /dev/null +++ b/styles.css @@ -0,0 +1,8 @@ +#timertext{ + font-size: 35px; + text-align: center; +} + +#virtual-keyboard{ + align-items: center; +} \ No newline at end of file From bedcc865d8af0c5a43e0d2b4339311505791535c Mon Sep 17 00:00:00 2001 From: sukruthi sanampudi Date: Sat, 22 Oct 2022 04:03:56 +0530 Subject: [PATCH 2/3] changed timer difficulty, added countdown.js --- countdown.js | 14 ++++++++++++-- index.html | 6 +++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/countdown.js b/countdown.js index 3b46039..6713217 100644 --- a/countdown.js +++ b/countdown.js @@ -1,6 +1,16 @@ -document.getElementById('timer').innerHTML = - 05 + ":" + 00; +function diff_time(num){ + if(num==1){ + document.getElementById('timer').innerHTML = + 07 + ":" + 00;} + else if(num==2){ + document.getElementById('timer').innerHTML = + 05 + ":" + 00;} + else{ + document.getElementById('timer').innerHTML = + 03 + ":" + 00;} + startTimer(); +} function startTimer() { diff --git a/index.html b/index.html index 12269d4..bcd342e 100644 --- a/index.html +++ b/index.html @@ -34,9 +34,9 @@

Wordle Clone

-
-
-
+
Easy
+
Medium
+
Hard
From 8a1db4cb1ddc5ea31b079f84ddb33855e07dfeb8 Mon Sep 17 00:00:00 2001 From: sukruthi sanampudi Date: Sat, 22 Oct 2022 06:02:27 +0530 Subject: [PATCH 3/3] changed timer difficulty, added countdown.js --- countdown.js | 32 ++++++++++++++++++++++++-------- index.html | 11 ++++++++--- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/countdown.js b/countdown.js index 6713217..35f4865 100644 --- a/countdown.js +++ b/countdown.js @@ -1,17 +1,33 @@ -function diff_time(num){ - if(num==1){ +function diff_easy(num) +{ startTimer(); + if(num==1){ document.getElementById('timer').innerHTML = 07 + ":" + 00;} - else if(num==2){ + else{ + reset();} + } + +function diff_med(num) +{ startTimer(); + if(num==2){ document.getElementById('timer').innerHTML = 05 + ":" + 00;} else{ - document.getElementById('timer').innerHTML = - 03 + ":" + 00;} - -startTimer(); -} + reset();} + } + +function diff_hard(num) + { startTimer(); + if(num==3){ + document.getElementById('timer').innerHTML = + 03 + ":" + 00;} + else{ + reset();} + } +function reset(){ + window.location.reload(); +} function startTimer() { var presentTime = document.getElementById('timer').innerHTML; diff --git a/index.html b/index.html index bcd342e..a1ec572 100644 --- a/index.html +++ b/index.html @@ -31,13 +31,18 @@

Wordle Clone

Time left =
+
-
Easy
-
Medium
-
Hard
+
Easy
+
Medium
+
Hard
+
Reset
+
+
+

Choose "RESET" if you want to change the difficulty timer

Rules