Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
aeabc14
Fix the bug in address.js file
Nov 14, 2025
26642e0
Fix the bug in author.js file
Nov 14, 2025
ab693e3
Fix the bug in recipe.js file
Nov 14, 2025
7105146
Implement a function in contains.js file
Nov 16, 2025
19ca88d
Adding tests in contains.test.js file
Nov 16, 2025
63b7d45
Implementing a function in lookup.js file
Nov 16, 2025
ed3cee8
Adding tests in lookup.test.js file
Nov 16, 2025
1babce8
Fix the implement function in querysrting.js file
Nov 16, 2025
fd422f1
Adding tests in querystring.test.js file
Nov 16, 2025
9279df9
Fix the implement function in tally.js file
Nov 16, 2025
1c6ccc3
Adding tests in tally.test.js file
Nov 16, 2025
8465e56
Answering questions and fix the implemention and adding tests
Nov 16, 2025
81769d1
Adding implementation and test to the file
Nov 24, 2025
d5a5bcd
Answering questions
Nov 24, 2025
f5a92f8
Answering till.js questions
Nov 24, 2025
6d8e6c5
Implementing a alarmclock function
Nov 26, 2025
7221a18
Editing file index.html
Nov 26, 2025
31437ef
Revert "Answering till.js questions"
Fares-Bakhet Nov 29, 2025
071964a
Revert "Answering questions"
Fares-Bakhet Nov 29, 2025
ef1c676
Revert "Adding implementation and test to the file"
Fares-Bakhet Nov 29, 2025
ea7fdc5
Revert "Answering questions and fix the implemention and adding tests"
Fares-Bakhet Nov 29, 2025
0a5d399
Revert "Adding tests in tally.test.js file"
Fares-Bakhet Nov 29, 2025
f6a85eb
Revert "Fix the implement function in tally.js file"
Fares-Bakhet Nov 29, 2025
c5cc816
Revert "Adding tests in querystring.test.js file"
Fares-Bakhet Nov 29, 2025
c9bd82d
Revert "Fix the implement function in querysrting.js file"
Fares-Bakhet Nov 29, 2025
cdd80b2
Revert "Adding tests in lookup.test.js file"
Fares-Bakhet Nov 29, 2025
9ff6503
Revert "Implementing a function in lookup.js file"
Fares-Bakhet Nov 29, 2025
3963062
Revert "Adding tests in contains.test.js file"
Fares-Bakhet Nov 29, 2025
35731ee
Revert "Implement a function in contains.js file"
Fares-Bakhet Nov 29, 2025
324a6b3
Revert "Fix the bug in recipe.js file"
Fares-Bakhet Nov 29, 2025
191a3ee
Revert "Fix the bug in author.js file"
Fares-Bakhet Nov 29, 2025
2185993
Revert "Fix the bug in address.js file"
Fares-Bakhet Nov 29, 2025
501a3cd
Fix the alarm app
Fares-Bakhet Dec 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion Sprint-3/alarmclock/alarmclock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,50 @@
function setAlarm() {}
let intervalId = null;

function setAlarm() {
let time = Number(document.getElementById("alarmSet").value);
const heading = document.getElementById("timeRemaining");

audio.loop = true;

if (isNaN(time) || time <= 0) {
heading.innerText = "Please enter a valid positive number.";
return;
}

time = Math.floor(time);

if (intervalId !== null) {
clearInterval(intervalId);
}

audio.pause();
audio.currentTime = 0;

document.body.style.backgroundColor = "";
function updateDisplay(t) {
const minutes = String(Math.floor(t / 60)).padStart(2, "0");
const seconds = String(t % 60).padStart(2, "0");
heading.innerText = `Time Remaining: ${minutes}:${seconds}`;
}

updateDisplay(time);

intervalId = setInterval(() => {
time--;

if (time <= 0) {
clearInterval(intervalId);
intervalId = null;

updateDisplay(0);

document.body.style.backgroundColor = "red";
playAlarm();
} else {
updateDisplay(time);
}
}, 1000);
}

// DO NOT EDIT BELOW HERE

Expand Down
2 changes: 1 addition & 1 deletion Sprint-3/alarmclock/alarmclock.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { JSDOM } = require("jsdom");
let page = null;

beforeEach(async () => {
page = await JSDOM.fromFile(path.join(__dirname, "index.html"), {
page = await JSDOM.fromFile(path.join(__dirname, "alarmclockapp.html"), {
resources: "usable",
runScripts: "dangerously",
});
Expand Down
2 changes: 1 addition & 1 deletion Sprint-3/alarmclock/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Title here</title>
<title>Alarm Clock App</title>
</head>
<body>
<div class="centre">
Expand Down