From 7df742bf603771b18fb9172025f50ade380aca54 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Tue, 17 Mar 2026 10:09:35 +0000 Subject: [PATCH 01/17] Changes to Alarm Clock --- Sprint-3/alarmclock/alarmclock.js | 45 ++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 6ca81cd3b..c6119a98e 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,4 +1,47 @@ -function setAlarm() {} +let countdownId = null; + +function formatTime(totalSeconds) {// Convert total seconds to minutes and seconds + const minutes = Math.floor(totalSeconds / 60); + const seconds = totalSeconds % 60; + + return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; +} + +function updateHeading(totalSeconds) {// Update the heading with the formatted time remaining + const heading = document.getElementById("timeRemaining");// Get the heading element using its DOM ID + heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`;// Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" +} + +function setAlarm() { + const input = document.getElementById("alarmSet");// Get the input element using its DOM ID + let remainingSeconds = Number(input.value);// Convert the input value to a number representing the total seconds for the countdown + + if (!Number.isFinite(remainingSeconds) || remainingSeconds < 0) {// Check if the input is a valid number and non-negative + remainingSeconds = 0;// If the input is invalid, set remainingSeconds to 0 + } + + if (countdownId !== null) {// If there is an existing countdown, clear it before starting a new one + + clearInterval(countdownId); + } + + updateHeading(remainingSeconds);// Update the heading to show the initial time remaining before starting the countdown + + countdownId = setInterval(() => {// Start a new interval that will execute the provided function every 1000 milliseconds (1 second) + remainingSeconds -= 1; + + if (remainingSeconds <= 0) {// If the remaining seconds reach 0 or below, stop the countdown and play the alarm + updateHeading(0); + clearInterval(countdownId); + countdownId = null; + playAlarm(); + document.body.style.backgroundColor = "red"; // change background colour + return; + } + + updateHeading(remainingSeconds); + }, 1000); +} // DO NOT EDIT BELOW HERE From 508a059973632916fea334e38665c96814b4f46a Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Tue, 24 Mar 2026 16:00:38 +0000 Subject: [PATCH 02/17] updated alarmclock to set screen to white when alarm set --- Sprint-3/alarmclock/alarmclock.js | 44 +++++++++++++++++++++--------- Sprint-3/alarmclock/style.css | 15 ---------- Sprint-3/quote-generator/style.css | 41 +++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 29 deletions(-) delete mode 100644 Sprint-3/alarmclock/style.css diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index c6119a98e..9cf8c9e46 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,42 +1,55 @@ let countdownId = null; +let alarmTimeoutId = null; // Track the alarm timeout to clear it if needed +const originalBackgroundColor = document.body.style.backgroundColor || "white"; // Store the original background color -function formatTime(totalSeconds) {// Convert total seconds to minutes and seconds +function formatTime(totalSeconds) { + // Convert total seconds to minutes and seconds const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; } -function updateHeading(totalSeconds) {// Update the heading with the formatted time remaining - const heading = document.getElementById("timeRemaining");// Get the heading element using its DOM ID - heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`;// Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" +function updateHeading(totalSeconds) { + // Update the heading with the formatted time remaining + const heading = document.getElementById("timeRemaining"); // Get the heading element using its DOM ID + heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`; // Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" } function setAlarm() { - const input = document.getElementById("alarmSet");// Get the input element using its DOM ID - let remainingSeconds = Number(input.value);// Convert the input value to a number representing the total seconds for the countdown + const input = document.getElementById("alarmSet"); // Get the input element using its DOM ID + let remainingSeconds = Number(input.value); // Convert the input value to a number representing the total seconds for the countdown - if (!Number.isFinite(remainingSeconds) || remainingSeconds < 0) {// Check if the input is a valid number and non-negative - remainingSeconds = 0;// If the input is invalid, set remainingSeconds to 0 + if (!Number.isFinite(remainingSeconds) || remainingSeconds < 0) { + // Check if the input is a valid number and non-negative + remainingSeconds = 0; // If the input is invalid, set remainingSeconds to 0 } - if (countdownId !== null) {// If there is an existing countdown, clear it before starting a new one + if (countdownId !== null) { + // If there is an existing countdown, clear it before starting a new one clearInterval(countdownId); } - updateHeading(remainingSeconds);// Update the heading to show the initial time remaining before starting the countdown + // Reset background and stop alarm sound when setting a new alarm + document.body.style.backgroundColor = originalBackgroundColor; + pauseAlarm(); - countdownId = setInterval(() => {// Start a new interval that will execute the provided function every 1000 milliseconds (1 second) + updateHeading(remainingSeconds); // Update the heading to show the initial time remaining before starting the countdown + + countdownId = setInterval(() => { + // Start a new interval that will execute the provided function every 1000 milliseconds (1 second) remainingSeconds -= 1; - if (remainingSeconds <= 0) {// If the remaining seconds reach 0 or below, stop the countdown and play the alarm + if (remainingSeconds <= 0) { + // If the remaining seconds reach 0 or below, stop the countdown and play the alarm updateHeading(0); clearInterval(countdownId); countdownId = null; playAlarm(); document.body.style.backgroundColor = "red"; // change background colour - return; + + return; // Exit the function to prevent further execution } updateHeading(remainingSeconds); @@ -63,6 +76,11 @@ function playAlarm() { function pauseAlarm() { audio.pause(); + // Clear the alarm timeout if it exists + if (alarmTimeoutId !== null) { + clearTimeout(alarmTimeoutId); + alarmTimeoutId = null; + } } window.onload = setup; diff --git a/Sprint-3/alarmclock/style.css b/Sprint-3/alarmclock/style.css deleted file mode 100644 index 0c72de38b..000000000 --- a/Sprint-3/alarmclock/style.css +++ /dev/null @@ -1,15 +0,0 @@ -.centre { - position: fixed; - top: 50%; - left: 50%; - -webkit-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); -} - -#alarmSet { - margin: 20px; -} - -h1 { - text-align: center; -} diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..0cf31b97b 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,40 @@ -/** Write your CSS in here **/ +body { + margin: 0; + min-height: 100vh; + display: grid; + place-items: center; + background-color: orange; + font-family: Arial, sans-serif; +} + +.quote-box { + width: min(600px, 90vw); + background-color: white; + border-radius: 12px; + padding: 24px; + box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16); + text-align: center; +} + +#quote { + font-size: 1.25rem; + color: orange; + line-height: 1.5; + margin: 20px 0 12px; + text-align: left; +} + +#author { + font-weight: 700; + color: orange; + margin-bottom: 20px; + text-align: right; +} + +#new-quote { + border: none; + border-radius: 8px; + padding: 10px 16px; + font-size: 1rem; + cursor: pointer; +} From e24cff14874fa3f5dff0d21e30bd85ee7a4e5109 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Tue, 24 Mar 2026 16:07:26 +0000 Subject: [PATCH 03/17] updated alarmclock to reject 0 and negative inputs --- Sprint-3/alarmclock/alarmclock.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 9cf8c9e46..8e0dc25e0 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -20,9 +20,11 @@ function setAlarm() { const input = document.getElementById("alarmSet"); // Get the input element using its DOM ID let remainingSeconds = Number(input.value); // Convert the input value to a number representing the total seconds for the countdown - if (!Number.isFinite(remainingSeconds) || remainingSeconds < 0) { - // Check if the input is a valid number and non-negative - remainingSeconds = 0; // If the input is invalid, set remainingSeconds to 0 + // Guard against edge cases: empty input, non-numeric, negative values, and 0 + if (!Number.isFinite(remainingSeconds) || remainingSeconds <= 0) { + // Check if the input is a valid number and strictly greater than 0 + alert("Please enter a positive number greater than 0"); + return; // Exit early without starting the countdown } if (countdownId !== null) { From e3a54b694871e727bf3f6710f986264d3d024902 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Tue, 24 Mar 2026 16:24:10 +0000 Subject: [PATCH 04/17] remoc-ved quote-generator\style.css added in error --- Sprint-3/quote-generator/style.css | 40 ------------------------------ 1 file changed, 40 deletions(-) delete mode 100644 Sprint-3/quote-generator/style.css diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css deleted file mode 100644 index 0cf31b97b..000000000 --- a/Sprint-3/quote-generator/style.css +++ /dev/null @@ -1,40 +0,0 @@ -body { - margin: 0; - min-height: 100vh; - display: grid; - place-items: center; - background-color: orange; - font-family: Arial, sans-serif; -} - -.quote-box { - width: min(600px, 90vw); - background-color: white; - border-radius: 12px; - padding: 24px; - box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16); - text-align: center; -} - -#quote { - font-size: 1.25rem; - color: orange; - line-height: 1.5; - margin: 20px 0 12px; - text-align: left; -} - -#author { - font-weight: 700; - color: orange; - margin-bottom: 20px; - text-align: right; -} - -#new-quote { - border: none; - border-radius: 8px; - padding: 10px 16px; - font-size: 1rem; - cursor: pointer; -} From 4fd4b8156c67283d83bb596d9b4a1287fc63fa06 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Wed, 25 Mar 2026 11:09:01 +0000 Subject: [PATCH 05/17] cleaning up style.css filkes --- Sprint-3/alarmclock/style.css | 15 +++++++++++++++ Sprint-3/quote-generator/style.css | 1 + 2 files changed, 16 insertions(+) create mode 100644 Sprint-3/alarmclock/style.css create mode 100644 Sprint-3/quote-generator/style.css diff --git a/Sprint-3/alarmclock/style.css b/Sprint-3/alarmclock/style.css new file mode 100644 index 000000000..0c72de38b --- /dev/null +++ b/Sprint-3/alarmclock/style.css @@ -0,0 +1,15 @@ +.centre { + position: fixed; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); +} + +#alarmSet { + margin: 20px; +} + +h1 { + text-align: center; +} diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css new file mode 100644 index 000000000..63cedf2d2 --- /dev/null +++ b/Sprint-3/quote-generator/style.css @@ -0,0 +1 @@ +/** Write your CSS in here **/ From 99e81392a29f91b122a55070336bbe967a0c8b6c Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Wed, 25 Mar 2026 11:26:01 +0000 Subject: [PATCH 06/17] reverting to cahes to before style.css added --- Sprint-3/alarmclock/alarmclock.js | 43 ++++++++++--------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 8e0dc25e0..d642e39ee 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,57 +1,42 @@ let countdownId = null; -let alarmTimeoutId = null; // Track the alarm timeout to clear it if needed -const originalBackgroundColor = document.body.style.backgroundColor || "white"; // Store the original background color -function formatTime(totalSeconds) { - // Convert total seconds to minutes and seconds +function formatTime(totalSeconds) {// Convert total seconds to minutes and seconds const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; } -function updateHeading(totalSeconds) { - // Update the heading with the formatted time remaining - const heading = document.getElementById("timeRemaining"); // Get the heading element using its DOM ID - heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`; // Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" +function updateHeading(totalSeconds) {// Update the heading with the formatted time remaining + const heading = document.getElementById("timeRemaining");// Get the heading element using its DOM ID + heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`;// Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" } function setAlarm() { - const input = document.getElementById("alarmSet"); // Get the input element using its DOM ID - let remainingSeconds = Number(input.value); // Convert the input value to a number representing the total seconds for the countdown - - // Guard against edge cases: empty input, non-numeric, negative values, and 0 - if (!Number.isFinite(remainingSeconds) || remainingSeconds <= 0) { - // Check if the input is a valid number and strictly greater than 0 - alert("Please enter a positive number greater than 0"); - return; // Exit early without starting the countdown + const input = document.getElementById("alarmSet");// Get the input element using its DOM ID + let remainingSeconds = Number(input.value);// Convert the input value to a number representing the total seconds for the countdown + + if (!Number.isFinite(remainingSeconds) || remainingSeconds < 0) {// Check if the input is a valid number and non-negative + remainingSeconds = 0;// If the input is invalid, set remainingSeconds to 0 } - if (countdownId !== null) { - // If there is an existing countdown, clear it before starting a new one + if (countdownId !== null) {// If there is an existing countdown, clear it before starting a new one clearInterval(countdownId); } - // Reset background and stop alarm sound when setting a new alarm - document.body.style.backgroundColor = originalBackgroundColor; - pauseAlarm(); - - updateHeading(remainingSeconds); // Update the heading to show the initial time remaining before starting the countdown + updateHeading(remainingSeconds);// Update the heading to show the initial time remaining before starting the countdown - countdownId = setInterval(() => { - // Start a new interval that will execute the provided function every 1000 milliseconds (1 second) + countdownId = setInterval(() => {// Start a new interval that will execute the provided function every 1000 milliseconds (1 second) remainingSeconds -= 1; - if (remainingSeconds <= 0) { - // If the remaining seconds reach 0 or below, stop the countdown and play the alarm + if (remainingSeconds <= 0) {// If the remaining seconds reach 0 or below, stop the countdown and play the alarm updateHeading(0); clearInterval(countdownId); countdownId = null; playAlarm(); document.body.style.backgroundColor = "red"; // change background colour - - return; // Exit the function to prevent further execution + return; } updateHeading(remainingSeconds); From 4ddc2eb48965ab36297d53ac855497eeb7782264 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Wed, 25 Mar 2026 11:30:14 +0000 Subject: [PATCH 07/17] restoring changes to alarmclock.js --- Sprint-3/alarmclock/alarmclock.js | 43 +++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index d642e39ee..8e0dc25e0 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,42 +1,57 @@ let countdownId = null; +let alarmTimeoutId = null; // Track the alarm timeout to clear it if needed +const originalBackgroundColor = document.body.style.backgroundColor || "white"; // Store the original background color -function formatTime(totalSeconds) {// Convert total seconds to minutes and seconds +function formatTime(totalSeconds) { + // Convert total seconds to minutes and seconds const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; } -function updateHeading(totalSeconds) {// Update the heading with the formatted time remaining - const heading = document.getElementById("timeRemaining");// Get the heading element using its DOM ID - heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`;// Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" +function updateHeading(totalSeconds) { + // Update the heading with the formatted time remaining + const heading = document.getElementById("timeRemaining"); // Get the heading element using its DOM ID + heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`; // Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" } function setAlarm() { - const input = document.getElementById("alarmSet");// Get the input element using its DOM ID - let remainingSeconds = Number(input.value);// Convert the input value to a number representing the total seconds for the countdown - - if (!Number.isFinite(remainingSeconds) || remainingSeconds < 0) {// Check if the input is a valid number and non-negative - remainingSeconds = 0;// If the input is invalid, set remainingSeconds to 0 + const input = document.getElementById("alarmSet"); // Get the input element using its DOM ID + let remainingSeconds = Number(input.value); // Convert the input value to a number representing the total seconds for the countdown + + // Guard against edge cases: empty input, non-numeric, negative values, and 0 + if (!Number.isFinite(remainingSeconds) || remainingSeconds <= 0) { + // Check if the input is a valid number and strictly greater than 0 + alert("Please enter a positive number greater than 0"); + return; // Exit early without starting the countdown } - if (countdownId !== null) {// If there is an existing countdown, clear it before starting a new one + if (countdownId !== null) { + // If there is an existing countdown, clear it before starting a new one clearInterval(countdownId); } - updateHeading(remainingSeconds);// Update the heading to show the initial time remaining before starting the countdown + // Reset background and stop alarm sound when setting a new alarm + document.body.style.backgroundColor = originalBackgroundColor; + pauseAlarm(); + + updateHeading(remainingSeconds); // Update the heading to show the initial time remaining before starting the countdown - countdownId = setInterval(() => {// Start a new interval that will execute the provided function every 1000 milliseconds (1 second) + countdownId = setInterval(() => { + // Start a new interval that will execute the provided function every 1000 milliseconds (1 second) remainingSeconds -= 1; - if (remainingSeconds <= 0) {// If the remaining seconds reach 0 or below, stop the countdown and play the alarm + if (remainingSeconds <= 0) { + // If the remaining seconds reach 0 or below, stop the countdown and play the alarm updateHeading(0); clearInterval(countdownId); countdownId = null; playAlarm(); document.body.style.backgroundColor = "red"; // change background colour - return; + + return; // Exit the function to prevent further execution } updateHeading(remainingSeconds); From 39e4ac5bbbf9e03d1edc609b1c20f94ff0b8c43d Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 26 Mar 2026 15:17:51 +0000 Subject: [PATCH 08/17] updating index.html as per Readme with title --- Sprint-3/quote-generator/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..8bbffd98a 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,7 +3,7 @@ - Title here + Alarm clock app From 57f529170fd32dda3363d46346c1f625a62771af Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 26 Mar 2026 15:44:04 +0000 Subject: [PATCH 09/17] moving the clear alarm timeout from below line 61 (lines 81-84) and placing in the guards line 33 --- Sprint-3/alarmclock/alarmclock.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 8e0dc25e0..6099cb3df 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -33,6 +33,12 @@ function setAlarm() { clearInterval(countdownId); } + // Clear the alarm timeout if it exists + if (alarmTimeoutId !== null) { + clearTimeout(alarmTimeoutId); + alarmTimeoutId = null; + } + // Reset background and stop alarm sound when setting a new alarm document.body.style.backgroundColor = originalBackgroundColor; pauseAlarm(); @@ -78,11 +84,6 @@ function playAlarm() { function pauseAlarm() { audio.pause(); - // Clear the alarm timeout if it exists - if (alarmTimeoutId !== null) { - clearTimeout(alarmTimeoutId); - alarmTimeoutId = null; - } } window.onload = setup; From 5af3ad49f97c1940c4557ff58e877b7aae828f18 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Thu, 26 Mar 2026 15:47:51 +0000 Subject: [PATCH 10/17] cleaning up branch --- Sprint-3/quote-generator/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 8bbffd98a..30b434bcf 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,7 +3,7 @@ - Alarm clock app + Title here From 038c1c5e4aec959525a90a20a0e746c449bac7c6 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Fri, 27 Mar 2026 11:53:32 +0000 Subject: [PATCH 11/17] update to title, using chached wrapper to store time remaining text, removal of alarmtimeoutID, which was not doing anything --- Sprint-3/alarmclock/alarmclock.js | 20 +++++++++++--------- Sprint-3/quote-generator/index.html | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 6099cb3df..84e6c3807 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,6 +1,14 @@ let countdownId = null; -let alarmTimeoutId = null; // Track the alarm timeout to clear it if needed const originalBackgroundColor = document.body.style.backgroundColor || "white"; // Store the original background color +let timeRemainingHeading = null; + +function getTimeRemainingHeading() { + if (timeRemainingHeading === null) { + timeRemainingHeading = document.getElementById("timeRemaining"); + } + + return timeRemainingHeading; +} function formatTime(totalSeconds) { // Convert total seconds to minutes and seconds @@ -12,7 +20,7 @@ function formatTime(totalSeconds) { function updateHeading(totalSeconds) { // Update the heading with the formatted time remaining - const heading = document.getElementById("timeRemaining"); // Get the heading element using its DOM ID + const heading = getTimeRemainingHeading(); // Query once, then reuse the cached DOM node on each tick heading.innerText = `Time Remaining: ${formatTime(totalSeconds)}`; // Set the text of the heading to show the time remaining in the format "Time Remaining: MM:SS" } @@ -33,15 +41,9 @@ function setAlarm() { clearInterval(countdownId); } - // Clear the alarm timeout if it exists - if (alarmTimeoutId !== null) { - clearTimeout(alarmTimeoutId); - alarmTimeoutId = null; - } - + // Reset background and stop alarm sound when setting a new alarm document.body.style.backgroundColor = originalBackgroundColor; - pauseAlarm(); updateHeading(remainingSeconds); // Update the heading to show the initial time remaining before starting the countdown diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..973c465ea 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,7 +3,7 @@ - Title here + Alarm Clock app From 8c88fd0ca34672efab93e57e5ccd805ab7fbcc9b Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Fri, 27 Mar 2026 11:55:20 +0000 Subject: [PATCH 12/17] restoring quote-generator index.html --- Sprint-3/quote-generator/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 973c465ea..30b434bcf 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -3,7 +3,7 @@ - Alarm Clock app + Title here From 78d5a6aabd313f3f19ee96821ce07e04fdec5a12 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Sat, 28 Mar 2026 10:45:52 +0000 Subject: [PATCH 13/17] update to title --- Sprint-3/alarmclock/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/alarmclock/index.html b/Sprint-3/alarmclock/index.html index 48e2e80d9..4a91379d3 100644 --- a/Sprint-3/alarmclock/index.html +++ b/Sprint-3/alarmclock/index.html @@ -4,7 +4,7 @@ - Title here + Alarm Clock App
From 017db976cafd193631a94db84c2fd066b665701d Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Sat, 28 Mar 2026 14:03:07 +0000 Subject: [PATCH 14/17] update to title --- Sprint-3/alarmclock/alarmclock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 84e6c3807..6318ab7d3 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -4,7 +4,7 @@ let timeRemainingHeading = null; function getTimeRemainingHeading() { if (timeRemainingHeading === null) { - timeRemainingHeading = document.getElementById("timeRemaining"); + timeRemainingHeading = document.getElementById("timeRemaining");// Cache the DOM node for the time remaining heading to avoid querying it multiple times during the countdown } return timeRemainingHeading; From 7531a6f117bc286751ead188edc1205fa48258e2 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Sat, 28 Mar 2026 15:24:31 +0000 Subject: [PATCH 15/17] update to title --- Sprint-3/alarmclock/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/alarmclock/index.html b/Sprint-3/alarmclock/index.html index 4a91379d3..cbb968cb0 100644 --- a/Sprint-3/alarmclock/index.html +++ b/Sprint-3/alarmclock/index.html @@ -8,7 +8,7 @@
-

Time Remaining: 00:00

+

Time Remaining: 00:00

From d9b0a4540caffc75b6bd8379fe2ac443f88d60e0 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Sat, 28 Mar 2026 15:27:23 +0000 Subject: [PATCH 16/17] Revert "update to title" This reverts commit 017db976cafd193631a94db84c2fd066b665701d. --- Sprint-3/alarmclock/alarmclock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 6318ab7d3..84e6c3807 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -4,7 +4,7 @@ let timeRemainingHeading = null; function getTimeRemainingHeading() { if (timeRemainingHeading === null) { - timeRemainingHeading = document.getElementById("timeRemaining");// Cache the DOM node for the time remaining heading to avoid querying it multiple times during the countdown + timeRemainingHeading = document.getElementById("timeRemaining"); } return timeRemainingHeading; From e4d87713dcd30d4cdbbbb44c65607beda7f57da1 Mon Sep 17 00:00:00 2001 From: Damian_Dunkley Date: Sat, 28 Mar 2026 15:39:15 +0000 Subject: [PATCH 17/17] updates to Index.html title --- Sprint-3/alarmclock/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/alarmclock/index.html b/Sprint-3/alarmclock/index.html index cbb968cb0..73760b8fc 100644 --- a/Sprint-3/alarmclock/index.html +++ b/Sprint-3/alarmclock/index.html @@ -1,4 +1,4 @@ - +