Skip to content
Open
Prev Previous commit
Next Next commit
Booklist bug fixed
  • Loading branch information
Stef-Lev committed Feb 16, 2020
commit b8b0eb4447ce40b240c7a3016915fb00bac6c1ae
Binary file not shown.
1 change: 1 addition & 0 deletions Week2/Homework/project-PomodoroClock/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h2>Session</h2>
<h3 id="time-display">0:00</h3>
<i class="fas fa-play time-buttons" id="play"></i>
<i class=" fas fa-pause time-buttons" id="pause"></i>
<audio src="alarm-sound.mp3"></audio>
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion Week2/Homework/project-PomodoroClock/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ let lengthDisplay = document.querySelector("#length-display");
let play = document.querySelector("#play");
let pause = document.querySelector("#pause");
let timeDisplay = document.querySelector("#time-display");
let audio = document.querySelector("audio");
let totalSeconds;
let paused = false;

Expand Down Expand Up @@ -39,7 +40,8 @@ function timer(sec) {
const secondsLeft = Math.round((then - Date.now()) / 1000);
if (secondsLeft < 0) {
clearInterval(countdown);
timeDisplay.innerHTML = "Time's up!"
timeDisplay.innerHTML = "Time's up!";
audio.play();
return;
}

Expand Down
4 changes: 1 addition & 3 deletions Week3/homework/codeAlong/booklist-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ <h1 class="display-4 text-center logo-header"><i class="fas fa-book-open"></i><s
<th></th>
</tr>
</thead>
<tbody id="book-list">

</tbody>
<tbody id="book-list"></tbody>
</table>

</div>
Expand Down
10 changes: 5 additions & 5 deletions Week3/homework/codeAlong/booklist-app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UI {

const books = Store.getBooks();

books.forEach(book => UI.addBookToList(book));
books.forEach((book) => UI.addBookToList(book));
}
static addBookToList(book) {
const list = document.querySelector("#book-list");
Expand All @@ -31,7 +31,7 @@ class UI {
}
static deleteBook(el) {
if (el.classList.contains("delete")) {
el.parentElement.remove();
el.parentElement.parentElement.remove();
}
}

Expand Down Expand Up @@ -65,7 +65,7 @@ class Store {
return books;
}

static addBook() {
static addBook(book) {
const books = Store.getBooks();

books.push(book);
Expand All @@ -88,7 +88,7 @@ class Store {
document.addEventListener("DOMContentLoaded", UI.displayBooks);

//Add a book
document.querySelector("#book-form").addEventListener("submit", e => {
document.querySelector("#book-form").addEventListener("submit", (e) => {
e.preventDefault();

const title = document.querySelector("#title").value;
Expand All @@ -112,7 +112,7 @@ document.querySelector("#book-form").addEventListener("submit", e => {
});

//Remove a book
document.querySelector("#book-list").addEventListener("click", e => {
document.querySelector("#book-list").addEventListener("click", (e) => {
UI.deleteBook(e.target);

Store.removeBook(e.target.parentElement.previousElementSibling.textContent);
Expand Down