-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>TodoList</title> | ||
</head> | ||
<body> | ||
<h1>My Todos</h1> | ||
<input type="text" id="inp"> | ||
<button id="btn">ADD</button> | ||
<hr></hr> | ||
<ul id="todos"> | ||
</ul> | ||
|
||
<script src="todo.js"></script> | ||
<script src="userinput.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var TodoList = (function () { | ||
function TodoList() { | ||
this.todoList = []; | ||
} | ||
TodoList.prototype.add = function (atodo) { | ||
this.todoList.push(atodo); | ||
}; | ||
TodoList.prototype.delete = function (index) { | ||
this.todoList.splice(index, 1); | ||
// this.status.splice(index, 1); | ||
}; | ||
TodoList.prototype.update = function (index, taskUpdate) { | ||
this.todoList[index].task = taskUpdate; | ||
}; | ||
TodoList.prototype.changeStatus = function (index) { | ||
this.todoList[index].done = !this.todoList[index].done; | ||
}; | ||
TodoList.prototype.getList = function () { | ||
return this.todoList; | ||
}; | ||
TodoList.prototype.display = function () { | ||
// console.log('Tasks '+this.todo); | ||
// console.log('Status '+this.status); | ||
var a = 2; | ||
}; | ||
return TodoList; | ||
}()); | ||
// let atodo = {task : "kill him", done : "false"}; | ||
var list = new TodoList(); | ||
function addTodo(task, done) { | ||
list.add({ | ||
task: task, | ||
done: false | ||
}); | ||
} | ||
function deleteTodo(index) { | ||
list.delete(index); | ||
} | ||
function updateTodo(index, taskupdate) { | ||
list.update(index, taskupdate); | ||
} | ||
function changeStatusTodo(index) { | ||
list.changeStatus(index); | ||
} | ||
function getTodos() { | ||
return list.getList(); | ||
} | ||
// list.add({task: "Learn Angular",done: false}); | ||
// Task name | ||
// done | ||
//mark as read | ||
//delete | ||
//update | ||
// list.display() |