Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

HomeWork-Week3-Nouri #73

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 51 additions & 10 deletions Week-3/Homework/mandatory/1-alarmclock/alarmclock.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,66 @@
function setAlarm() {}
function setAlarm() {
let timeSet = document.querySelector('#alarmSet').value;
function countDown() {
let minutes;
let seconds;
if (timeSet >= 10 && timeSet < 60) {
(minutes = '00'), (seconds = '' + timeSet);
document.querySelector('#timeRemaining').innerText = 'Time Remaining:00:' + timeSet;
}
if (timeSet < 10) {
(minutes = '00'), (seconds = '0' + timeSet);
document.querySelector('#timeRemaining').innerText = 'Time Remaining:00:0' + timeSet;
} else if (timeSet > 59) {
let testMinutes = Math.floor(timeSet / 60);
let testSeconds = timeSet % 60;

if (testMinutes < 10 && testSeconds < 10) {
document.querySelector('#timeRemaining').innerText =
'Time Remaining: 0' + Math.floor(timeSet / 60) + ':0' + timeSet % 60;
}
if (testMinutes < 10 && testSeconds > 10) {
document.querySelector('#timeRemaining').innerText =
'Time Remaining: 0' + Math.floor(timeSet / 60) + ':' + timeSet % 60;
}
if (testMinutes > 10 && testSeconds < 10) {
document.querySelector('#timeRemaining').innerText =
'Time Remaining:' + Math.floor(timeSet / 60) + ':0' + timeSet % 60;
}
if (testMinutes > 10 && testSeconds > 10) {
document.querySelector('#timeRemaining').innerText =
'Time Remaining:' + Math.floor(timeSet / 60) + ':' + timeSet % 60;
}
}

if (timeSet === 0) {
clearInterval(myaAlarm);
playAlarm();
document.body.style.backgroundColor = 'aqua';
}
timeSet--;
}
}

// DO NOT EDIT BELOW HERE

var audio = new Audio("alarmsound.mp3");
var audio = new Audio('alarmsound.mp3');

function setup() {
document.getElementById("set").addEventListener("click", () => {
setAlarm();
});
document.getElementById('set').addEventListener('click', () => {
setAlarm();
});

document.getElementById("stop").addEventListener("click", () => {
pauseAlarm();
});
document.getElementById('stop').addEventListener('click', () => {
pauseAlarm();
});
}

function playAlarm() {
audio.play();
audio.play();
}

function pauseAlarm() {
audio.pause();
audio.pause();
}

window.onload = setup;
17 changes: 17 additions & 0 deletions Week-3/Homework/mandatory/2-quotegenerator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,25 @@
crossorigin="anonymous"
/>
<link rel="stylesheet" href="style.css" />


<script src="https://kit.fontawesome.com/a076d05399.js"></script>
</head>
<body>
<!-- Write your HTML in here -->
<div class="main">
<div id="quoatDiv">
<i class="fas fa-quote-left"></i>
<i class="fas fa-quote-right" id="rightQouat"></i>
<h1 id="quote">Life isn’t about getting and having, it’s about giving and being.</h1>

</div>
<div id="authorNdButton">
<h4 id="author">Kevin Kruse</h4>
<button id="next" onclick="showNextQuoat()">New quoat</button>
</div>
</div>


</body>
</html>
Loading