-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Suzi216/interactive-list
TO-DO Iterative-list
- Loading branch information
Showing
10 changed files
with
97 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>To-do-list</title><script src="../dist/main.js" defer="defer"></script><script src="https://use.fontawesome.com/0b80aea469.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"><script defer="defer" src="main.js"></script></head><body><div class="d-flex p-3 w-50 border border-secondary justify-content-start flex-column align-content-start align-items-start flex-wrap"><h1>Today's To Do</h1><input id="fname" class="input w-75" name="fname" placeholder="Addd to your list..."><br><ul id="lists" class="d-flex flex-column w-75 p-0"></ul></div><script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script></body></html> | ||
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>To-do-list</title><script src="../dist/main.js" defer="defer"></script><script src="https://use.fontawesome.com/0b80aea469.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"><script defer="defer" src="main.js"></script></head><body><div class="d-flex p-3 w-50 border border-secondary justify-content-start flex-column align-content-start align-items-start flex-wrap"><h1>Today's To Do</h1><input id="fname" class="input w-75" name="fname" placeholder="Addd to your list..."><br><ul id="lists" class="d-flex flex-column w-75 p-0"></ul><p id="out" class="align-self-center"><u>Clear All the completed</u></p></div><script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script></body></html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Edit task discription | ||
|
||
const complete = (check, id, input) => { | ||
let arr = []; | ||
|
||
const listArrStr = localStorage.getItem('ls'); | ||
arr = JSON.parse(listArrStr); | ||
|
||
if (check === true) { | ||
input.style.textDecoration = 'line-through'; | ||
const updateTask = arr.filter((item) => { | ||
if (item.index === id) { | ||
item.complete = true; | ||
} | ||
return item; | ||
}); | ||
localStorage.setItem('ls', JSON.stringify(updateTask)); | ||
} else { | ||
input.style.textDecoration = 'none'; | ||
const updateTask = arr.filter((item) => { | ||
if (item.index === id) { | ||
item.complete = false; | ||
} | ||
return item; | ||
}); | ||
localStorage.setItem('ls', JSON.stringify(updateTask)); | ||
} | ||
// display(); | ||
}; | ||
|
||
export default complete; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { list } from './getelements.js'; | ||
import display from './display.js'; | ||
|
||
const deleteAll = () => { | ||
let listArr = []; | ||
const listArrStr = localStorage.getItem('ls'); | ||
listArr = JSON.parse(listArrStr); | ||
|
||
for (let length = listArr.length - 1; length >= 0; length -= 1) { | ||
if (listArr[length].complete === true) { | ||
listArr.splice(length, 1); | ||
} | ||
} | ||
// Updated index | ||
const updateData = listArr.filter((updatedIndex, index) => { | ||
if (updatedIndex.index !== index) { | ||
updatedIndex.index = index; | ||
} | ||
return updatedIndex; | ||
}); | ||
localStorage.setItem('ls', JSON.stringify(updateData)); | ||
const str = ''; | ||
list.innerHTML = str; | ||
display(); | ||
}; | ||
|
||
export default deleteAll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const list = document.getElementById('lists'); | ||
const input = document.querySelector('.input'); | ||
|
||
export { list, input }; | ||
const out = document.getElementById('out'); | ||
export { list, input, out }; |
Oops, something went wrong.