From ec4441a04507c896f46f1ed95f4d0ebd3f44ad79 Mon Sep 17 00:00:00 2001 From: Fayaz Date: Mon, 23 Mar 2026 22:11:01 +0000 Subject: [PATCH 1/3] implemented the code to make the alarmclock work properly with test cases --- Sprint-3/alarmclock/alarmclock.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 6ca81cd3b..976472745 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,4 +1,31 @@ -function setAlarm() {} +function setAlarm() { + const time = document.getElementById("alarmSet").value; + const heading = document.getElementById("timeRemaining"); + + let remainingTime = Number(time); + + const timer = setInterval(() => { + if (remainingTime <= 0) { + clearInterval(timer); + heading.textContent = "Time Remaining: 00:00"; + playAlarm(); + return; + } + + remainingTime--; + + const minutes = Math.floor(remainingTime / 60); + const seconds = remainingTime % 60; + + heading.textContent = `Time Remaining: ${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; + }, 1000); + + + const minutes = Math.floor(remainingTime / 60); + const seconds = remainingTime % 60; + + heading.textContent = `Time Remaining: ${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; +} // DO NOT EDIT BELOW HERE From 8c2dfaab19e558449fb1422bbe64d9758578d2de Mon Sep 17 00:00:00 2001 From: Fayaz Date: Mon, 23 Mar 2026 23:02:36 +0000 Subject: [PATCH 2/3] completed the quote genertor --- Sprint-3/quote-generator/quotes.js | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..a12a2bdd9 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -491,3 +491,34 @@ const quotes = [ ]; // call pickFromArray with the quotes array to check you get a random quote + +const newQuote = document.querySelector("#new-quote"); +const quoteTxt = document.querySelector("#quote"); +const quoteAuthor = document.querySelector("#author"); +const autoPlay = document.querySelector("#auto-play"); +const autoPlayTxt = document.querySelector("#auto-play-txt"); +const autoPlayTime = 60000; +let autoPlayInterval = null; +newQuote.addEventListener("click", displayQuote); + +initaliseSite(); +autoPlay.addEventListener("change", () => { + if (autoPlay.checked) { + console.log("ON"); + autoPlayTxt.textContent = `Auto-Play: ON, changing quote every ${autoPlayTime / 1000} seconds.`; + autoPlayInterval = setInterval(displayQuote, autoPlayTime); + } else { + console.log("OFF"); + autoPlayTxt.textContent = "Auto-Play: OFF"; + clearInterval(autoPlayInterval); + } +}); +function initaliseSite() { + displayQuote(); +} + +function displayQuote() { + const quote = pickFromArray(quotes); + quoteTxt.innerHTML = `${quote.quote}`; + quoteAuthor.textContent = `- ${quote.author}`; +} \ No newline at end of file From 52422d3e79ddb7d8d7e148a5755fa47ef71f9e12 Mon Sep 17 00:00:00 2001 From: Fayaz Date: Mon, 23 Mar 2026 23:06:54 +0000 Subject: [PATCH 3/3] Made changes to title and styled it --- Sprint-3/quote-generator/index.html | 5 +++-- Sprint-3/quote-generator/style.css | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..67f5e5dc8 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,11 +3,12 @@ - Title here + + Quote Generator -

hello there

+

Quote Generator

diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..9de368280 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,15 @@ /** Write your CSS in here **/ +body { + font-family: Arial, sans-serif; + text-align: center; + padding: 20px; + background-color: aqua; + + +} +button { + padding: 10px 20px; + font-size: 16px; + cursor: pointer; + background-color: aquamarine; +}