Skip to content

Commit

Permalink
live version
Browse files Browse the repository at this point in the history
  • Loading branch information
redwing555 committed Sep 27, 2021
1 parent 126128d commit ab9ced7
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/

dist/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Additional description about the project and its features.
- Webpack
- JavaScript

<!-- ## Live Demo
## Live Demo

[Live Demo Link](https://livedemo.com) -->
[Live Demo Link](https://redwing555.github.io/todo-list/)


## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css"
integrity="sha384-DyZ88mC6Up2uqS4h/KRgHuoeGwBcD4Ng9SiP4dIRy0EXTlnuz47vAwmeGwVChigm" crossorigin="anonymous">
<title>TODO App</title>
<script defer src="main.js"></script></head>
<script defer src="/todo-list/main.js"></script></head>


<body>
Expand Down
10 changes: 7 additions & 3 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17725,19 +17725,23 @@ function deleteCompletedTask(taskArr) {
localStorage.setItem('tasksList', JSON.stringify(taskArr));

window.location.reload();
taskArr.forEach((task, i) => task.index === Array.from(Array(storeLength).keys())[i]);
/* eslint-disable */
taskArr.forEach((task, i) => task.index = Array.from(Array(storeLength).keys())[i]);
/* eslint-enable */
localStorage.setItem('tasksList', JSON.stringify(taskArr));
}

function moveToTrash(taskArr) {
const trashCan = [...document.querySelectorAll('.trash')];
const storeLength = JSON.parse(localStorage.getItem('tasksList')).length;

trashCan.forEach((can) => can.addEventListener('click', () => {
const storeLength = JSON.parse(localStorage.getItem('tasksList')).length;
taskArr = taskArr.filter((task) => task.index !== parseInt(can.id[6], 10));
localStorage.setItem('tasksList', JSON.stringify(taskArr));
window.location.reload();
taskArr.forEach((task, i) => task.index === Array.from(Array(storeLength).keys())[i]);
/* eslint-disable */
taskArr.forEach((task, i) => task.index = Array.from(Array(storeLength).keys())[i]);
/* eslint-enable */
localStorage.setItem('tasksList', JSON.stringify(taskArr));
}));
}
Expand Down

0 comments on commit ab9ced7

Please sign in to comment.