Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5606a31

Browse files
committed
some details left for pomodoro
1 parent 2f05a7d commit 5606a31

File tree

15 files changed

+101
-7
lines changed

15 files changed

+101
-7
lines changed

Week2/Homework/js-exercises/mondayWorth.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@ const mondayTasks = [
1818
},
1919
];
2020

21+
function mondayWorth() {
22+
let totalRate = mondayTasks.map(function (activity) {
23+
//Converting each duration to hours and multiplying by hourly rate
24+
return (activity.duration / 60) * 25
25+
//Adding all rates
26+
}).reduce(function (acc, cur) {
27+
return acc + cur;
28+
}, 0)
29+
return `€${+totalRate.toFixed(2)}`;
30+
}
2131

Week2/Homework/project-PomodoroClock/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
<div class="container text-center in-the-box">
2121
<h1 class="display-3">Pomodoro Clock</h1>
2222
<h2 class="display-5">Session Length</h2>
23-
<a href="" class="length-button"><i class="fas fa-caret-up mt-3 "></i></a>
24-
<p class="display-4">25</p>
25-
<a href="" class="length-button"><i class="fas fa-caret-down mb-3"></i></a>
23+
<i class="fas fa-caret-up mb-3 length-button" id="length-up"></i>
24+
<p class="display-4" id="length-display">25</p>
25+
<i class="fas fa-caret-down mb-3 length-button" id="length-down"></i>
2626
<div class="container-fluid timer d-flex flex-column align-items-center justify-content-center">
2727
<div class="inside-text">
2828
<h2>Session</h2>
29-
<h3 class="display-3">25:00</h3>
30-
<a href="" class="time-buttons" id="play"><i class="fas fa-play"></i></a>
31-
<a href="" class="time-buttons" id="pause"><i class=" fas fa-pause"></i></a>
29+
<h3 class="display-3" id="duration"><span id="min">25</span>:<span id="sec">00</span></h3>
30+
<i class="fas fa-play time-buttons" id="play"></i>
31+
<i class=" fas fa-pause time-buttons" id="pause"></i>
3232
</div>
3333
</div>
3434
</div>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"use strict"
2+
//DOM elements selection
3+
const lengthUp = document.querySelector("#length-up");
4+
const lengthDown = document.querySelector("#length-down");
5+
const lengthDisplay = document.querySelector("#length-display");
6+
const play = document.querySelector("#play");
7+
const pause = document.querySelector("#pause");
8+
const duration = document.querySelector("#duration");
9+
const minutes = document.querySelector("#min");
10+
const seconds = document.querySelector("#sec");
11+
12+
13+
//Increasing and decreasing the session length
14+
lengthUp.addEventListener("click", () => {
15+
let plusOne = parseInt(lengthDisplay.innerHTML) + 1;
16+
lengthDisplay.innerHTML = plusOne;
17+
duration.innerHTML = `<span id="min">${lengthDisplay.innerHTML}</span>:<span id="sec">00</span>`
18+
});
19+
lengthDown.addEventListener("click", () => {
20+
let minusOne = parseInt(lengthDisplay.innerHTML) - 1;
21+
lengthDisplay.innerHTML = minusOne;
22+
duration.innerHTML = `<span id="min">${lengthDisplay.innerHTML}</span>:<span id="sec">00</span>`
23+
})
24+
25+
//Start timer
26+
let counter = {}
27+
28+
play.addEventListener("click", function () {
29+
counter.end = parseInt(minutes.innerHTML);
30+
31+
counter.min = minutes;
32+
counter.sec = seconds;
33+
34+
if (counter.end > 0) {
35+
counter.ticker = setInterval(function () {
36+
counter.end--;
37+
if (counter.end <= 0) {
38+
clearInterval(counter.ticker);
39+
counter.end = 0;
40+
}
41+
let secRemain = counter.end;
42+
let minRemain = Math.floor(secRemain / 60);
43+
secRemain -= minRemain * 60;
44+
45+
counter.min.innerHTML = minRemain;
46+
counter.sec.innerHTML = secRemain;
47+
}, 1000);
48+
}
49+
});
50+
51+
52+

Week2/Homework/project-PomodoroClock/style.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ body {
1919
.length-button {
2020
font-size: 2.7rem;
2121
color: white;
22+
cursor: pointer;
2223
}
2324
.length-button:link {
2425
color: white;
@@ -33,7 +34,6 @@ body {
3334
color: sandybrown;
3435
}
3536

36-
3737
.timer {
3838
font-family: 'Orbitron', sans-serif;
3939
border: 15px solid rgb(121, 33, 33) ;
@@ -45,6 +45,7 @@ body {
4545
font-size: 2.2rem;
4646
margin: 3px 10px 3px 10px;
4747
color: white;
48+
cursor: pointer;
4849
}
4950
.time-buttons:link {
5051
color: white;

Week3/homework/codeAlong/booklist-app/index.html

Whitespace-only changes.

Week3/homework/codeAlong/booklist-app/main.js

Whitespace-only changes.

Week3/homework/codeAlong/booklist-app/style.css

Whitespace-only changes.

Week3/homework/js-exercises/addSix.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"use strict"
2+
function createBase() {
3+
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//f1(x) --> 10 | The function adds 1 to the value of the variable x
2+
//console.log(x); --> 9 | It just prints out the initial variable
3+
//f2(y) --> {x:10} | The function adds 1 to the value of the key x (object)
4+
//console.log(y); --> {x:9} | It prints out the value of the variable which is an object
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//It will return 12.
2+
//The variable a inside the function x scope takes the value of 12.
3+
//So the function with the alert method will use the upper function scope and display 12.
4+
//The first variable declaration has nothing to do with the function scope.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"use strict"
2+
function threeFive(startIndex, stopIndex, threeCallback, fiveCallback) {
3+
const numbers = [];
4+
// make array
5+
// start at beginning of array and check if you should call threeCallback or fiveCallback or go on to next
6+
}
7+
8+
threeFive(10, 15, sayThree, sayFive);
9+
10+
// Should create an array [10,11,12,13,14,15]
11+
// and call sayFive, sayThree, sayThree, sayFive
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use strict"
2+
const letters = ['a', 'b', 'c', 'd', 'a', 'e', 'f', 'c', 'b'];
3+
4+
function removeDuplicates(arr) {
5+
let noDuplicates = arr.filter((item, index) => arr.indexOf(item) === index);
6+
return noDuplicates;
7+
}
8+
console.log(removeDuplicates(letters));

Week3/homework/project-TipCalculator/index.html

Whitespace-only changes.

Week3/homework/project-TipCalculator/main.js

Whitespace-only changes.

Week3/homework/project-TipCalculator/style.css

Whitespace-only changes.

0 commit comments

Comments
 (0)