From 8631a7edc3b0157b96efc1aee460b1e29ee67dbc Mon Sep 17 00:00:00 2001 From: Tyler-leigh Ross Date: Wed, 11 Nov 2026 09:38:07 +0200 Subject: [PATCH 1/6] Changed title to Alarm clock app --- 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 48e2e80d99..ff2d3b4532 100644 --- a/Sprint-3/alarmclock/index.html +++ b/Sprint-3/alarmclock/index.html @@ -4,7 +4,7 @@ - Title here + Alarm clock app
From f8bede4d4bd9e7c659841da7915ed2ee806b7650 Mon Sep 17 00:00:00 2001 From: Tyler-leigh Ross Date: Wed, 11 Nov 2026 09:52:46 +0200 Subject: [PATCH 2/6] added placeholder styling for the buttons: set alarm and stop alarm --- Sprint-3/alarmclock/style.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sprint-3/alarmclock/style.css b/Sprint-3/alarmclock/style.css index 0c72de38b2..4249b066f6 100644 --- a/Sprint-3/alarmclock/style.css +++ b/Sprint-3/alarmclock/style.css @@ -13,3 +13,12 @@ h1 { text-align: center; } + + +#set { + font: serif; +} + +#stop { + font: serif; +} \ No newline at end of file From 429a01e01a4c83c1ff103d942c74994a12e8ee13 Mon Sep 17 00:00:00 2001 From: Tyler-leigh Ross Date: Wed, 11 Nov 2026 10:15:54 +0200 Subject: [PATCH 3/6] implemented a function to convert seconds to mm:ss --- Sprint-3/alarmclock/alarmclock.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 6ca81cd3b1..90468dcc31 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,5 +1,27 @@ function setAlarm() {} +function formatTime(totalSeconds){ + // converts the seconds to minutes and seconds and returns "mm:ss" + const convertToMinutes = Math.floor(totalSeconds / 60) + const remainderSeconds = totalSeconds % 60 + const paddedMinutes = String(convertToMinutes).padStart(2, "0") + const paddedSeconds = String(remainderSeconds).padStart(2, "0") + return `${paddedMinutes}:${paddedSeconds}` +} + + + + + + + + + + + + + + // DO NOT EDIT BELOW HERE var audio = new Audio("alarmsound.mp3"); From bfa790f31a270247c8310eb818b958b032bf1404 Mon Sep 17 00:00:00 2001 From: Tyler-leigh Ross Date: Wed, 11 Nov 2026 10:45:23 +0200 Subject: [PATCH 4/6] Implemented setAlarm function to set the alarm and interval for the count down --- Sprint-3/alarmclock/alarmclock.js | 39 ++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 90468dcc31..18c3bfd6a0 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,4 +1,28 @@ -function setAlarm() {} +let countdownTimer; +let currentSeconds; + +function setAlarm() { + // fetch seconds input + currentSeconds = Number(document.getElementById("alarmSet").value) + + // set time remaining to seconds input + document.getElementById("timeRemaining").textContent = `Time Remaining: ${formatTime(currentSeconds)}` + + // handling the interval and alarm end + countdownTimer = setInterval(() => { + currentSeconds = currentSeconds - 1 + + document.getElementById("timeRemaining").textContent = + `Time Remaining: ${formatTime(currentSeconds)}` + + if (currentSeconds <= 0){ + clearInterval(countdownTimer) + playAlarm() + document.getElementById("timeRemaining").textContent = + `Time Remaining: 00:00` + } + }, 1000) +} function formatTime(totalSeconds){ // converts the seconds to minutes and seconds and returns "mm:ss" @@ -9,19 +33,6 @@ function formatTime(totalSeconds){ return `${paddedMinutes}:${paddedSeconds}` } - - - - - - - - - - - - - // DO NOT EDIT BELOW HERE var audio = new Audio("alarmsound.mp3"); From e21d19b6fe12f2691b819453e52b8ee4c53d654d Mon Sep 17 00:00:00 2001 From: Tyler-leigh Ross Date: Wed, 11 Nov 2026 11:45:57 +0200 Subject: [PATCH 5/6] added funny hamster image change when alarm is set and stopped. box flashes red when alarm goes off. --- Sprint-3/alarmclock/alarmclock.js | 57 ++++++++++++------ .../alarmclock/alarmplaysoundhamster.jfif | Bin 0 -> 4208 bytes ...alarmplaysoundhamster.jfif:Zone.Identifier | Bin 0 -> 25 bytes Sprint-3/alarmclock/alarmsethamster.jfif | Bin 0 -> 4180 bytes .../alarmsethamster.jfif:Zone.Identifier | Bin 0 -> 25 bytes Sprint-3/alarmclock/style.css | 16 +++++ 6 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 Sprint-3/alarmclock/alarmplaysoundhamster.jfif create mode 100644 Sprint-3/alarmclock/alarmplaysoundhamster.jfif:Zone.Identifier create mode 100644 Sprint-3/alarmclock/alarmsethamster.jfif create mode 100644 Sprint-3/alarmclock/alarmsethamster.jfif:Zone.Identifier diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index 18c3bfd6a0..e1d8c8a137 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -1,36 +1,50 @@ let countdownTimer; +let flashTimer; let currentSeconds; function setAlarm() { + clearInterval(countdownTimer); // fetch seconds input - currentSeconds = Number(document.getElementById("alarmSet").value) - + currentSeconds = Number(document.getElementById("alarmSet").value); + document.body.style.backgroundImage = "url('alarmsethamster.jfif')"; + document.body.style.backgroundPosition = "centre"; // set time remaining to seconds input - document.getElementById("timeRemaining").textContent = `Time Remaining: ${formatTime(currentSeconds)}` + document.getElementById("timeRemaining").textContent = + `Time Remaining: ${formatTime(currentSeconds)}`; // handling the interval and alarm end countdownTimer = setInterval(() => { - currentSeconds = currentSeconds - 1 + currentSeconds = currentSeconds - 1; document.getElementById("timeRemaining").textContent = - `Time Remaining: ${formatTime(currentSeconds)}` - - if (currentSeconds <= 0){ - clearInterval(countdownTimer) - playAlarm() + `Time Remaining: ${formatTime(currentSeconds)}`; + + if (currentSeconds <= 0) { + clearInterval(countdownTimer); + playAlarm(); document.getElementById("timeRemaining").textContent = - `Time Remaining: 00:00` + `Time Remaining: 00:00`; + + // img change + document.body.style.backgroundImage = "url('alarmplaysoundhamster.jfif')"; + document.body.style.backgroundPosition = "centre"; + + // box turns red + const box = document.querySelector(".centre"); + flashTimer = setInterval(() => { + box.classList.toggle("red-bg"); + }, 500); } - }, 1000) + }, 1000); } -function formatTime(totalSeconds){ +function formatTime(totalSeconds) { // converts the seconds to minutes and seconds and returns "mm:ss" - const convertToMinutes = Math.floor(totalSeconds / 60) - const remainderSeconds = totalSeconds % 60 - const paddedMinutes = String(convertToMinutes).padStart(2, "0") - const paddedSeconds = String(remainderSeconds).padStart(2, "0") - return `${paddedMinutes}:${paddedSeconds}` + const convertToMinutes = Math.floor(totalSeconds / 60); + const remainderSeconds = totalSeconds % 60; + const paddedMinutes = String(convertToMinutes).padStart(2, "0"); + const paddedSeconds = String(remainderSeconds).padStart(2, "0"); + return `${paddedMinutes}:${paddedSeconds}`; } // DO NOT EDIT BELOW HERE @@ -56,3 +70,12 @@ function pauseAlarm() { } window.onload = setup; + +window.onload = setup; + +document.getElementById("stop").addEventListener("click", () => { + document.body.style.backgroundImage = "url('alarmsethamster.jfif')"; + document.body.style.backgroundPosition = "centre"; + clearInterval(countdownTimer); + clearInterval(flashTimer); +}); \ No newline at end of file diff --git a/Sprint-3/alarmclock/alarmplaysoundhamster.jfif b/Sprint-3/alarmclock/alarmplaysoundhamster.jfif new file mode 100644 index 0000000000000000000000000000000000000000..ea0eab44bfde91acf3201fb850e7ae2660b0e3ea GIT binary patch literal 4208 zcmcInXHXMrmrfv%AS9tnNJ3Xo>4x6BD1wR#d1szK=b2~DdCQ#loKKxE0GMy<>gxi4KmY)Eu>j{3 zz@GpHdN2e`&j0~KE?r_^gmS{6OiWNDI|nl-A6h_w56#OfB!UqYx+*2i%PXcLCM6@M zsHiA-Lrq&vUJIk3CEWq;) z0O}$^8d~5#x&9k;^gs}pmIiVWRc8hOK|mT1h!zB)Vf;t)j~c{6$4}2HrNJg}-;Uio zf9u#yT7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^-X;scVMH5dpEn{@iN3{@|Ig` z{|JS&v1CK8yHyNYVe;X+IY9FWbLt3zL_z3iDH=Q-utG1I={K41l>r7!FwH(Rd`CDj&yG46;@z2y&o;hb42Tsj$O zB?9*8uN{-~`7^j?WMIlH2$_VUetWb-@>OX6chLqoM__og*rN6TxsTq1odj6Y39E zB%ScEa4793A6cJ^*sj0o%WV)JQ|4+rwi@Xemh7KW7JHN>lK~~~z2I8Bg?w3)TaO5- z+m^TUPLEcnw6{%pc?der%go9uqZndUx>1wGoZPY}N6fYNuK@{a_B<>|7o|r?I+U6N`hT#QK*BgMCn~h+tEVJ_O0svuUGwC_W*N z{xilx9W{}ym|mdBD4+Ak6%l0;o^$c0i;rSVpLII1)J@&_>jL!CmX*cmYY6H!#l8M) zdnhihp|FMxFcrxR|Mye~>aRKBbu8`i|Jko3l00!CXQ@q`s5%gzNRoF6$f@RM^m|V> z^`03TxjO8+wpWB^XIY||AmigNEYHGH3~&nCk<_5suT78YC#JL+Ld;6&PHzk2dA#l9zs6|YeJ~D+%TTO*`p;_&|$Oh{}$D6W&P)HIsada`&~f* literal 0 HcmV?d00001 diff --git a/Sprint-3/alarmclock/alarmsethamster.jfif:Zone.Identifier b/Sprint-3/alarmclock/alarmsethamster.jfif:Zone.Identifier new file mode 100644 index 0000000000000000000000000000000000000000..d6c1ec682968c796b9f5e9e080cc6f674b57c766 GIT binary patch literal 25 dcma!!%Fjy;DN4*MPD?F{<>dl#JyUFr831@K2x Date: Wed, 11 Nov 2026 11:51:24 +0200 Subject: [PATCH 6/6] Restricted flashing to 20 times but alarm sound still plays --- Sprint-3/alarmclock/alarmclock.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sprint-3/alarmclock/alarmclock.js b/Sprint-3/alarmclock/alarmclock.js index e1d8c8a137..dac10c71b2 100644 --- a/Sprint-3/alarmclock/alarmclock.js +++ b/Sprint-3/alarmclock/alarmclock.js @@ -27,12 +27,17 @@ function setAlarm() { // img change document.body.style.backgroundImage = "url('alarmplaysoundhamster.jfif')"; - document.body.style.backgroundPosition = "centre"; + document.body.style.backgroundPosition = "center"; // box turns red + let flashCount = 0; const box = document.querySelector(".centre"); flashTimer = setInterval(() => { box.classList.toggle("red-bg"); + flashCount++ + if (flashCount >= 20){ + clearInterval(flashTimer); + } }, 500); } }, 1000); @@ -71,11 +76,9 @@ function pauseAlarm() { window.onload = setup; -window.onload = setup; - document.getElementById("stop").addEventListener("click", () => { document.body.style.backgroundImage = "url('alarmsethamster.jfif')"; - document.body.style.backgroundPosition = "centre"; + document.body.style.backgroundPosition = "center"; clearInterval(countdownTimer); clearInterval(flashTimer); }); \ No newline at end of file