From 859a5352d321b751af5aedaa013f17a4bee38895 Mon Sep 17 00:00:00 2001 From: puneet7 Date: Tue, 12 Apr 2016 14:51:40 +0000 Subject: [PATCH 1/6] To do completed --- index.html~ | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ main.css~ | 3 +++ main.js~ | 1 + 3 files changed, 75 insertions(+) create mode 100644 index.html~ create mode 100644 main.css~ create mode 100644 main.js~ diff --git a/index.html~ b/index.html~ new file mode 100644 index 0000000..668fcbc --- /dev/null +++ b/index.html~ @@ -0,0 +1,71 @@ + + + + + To-Do List + + + + + + + + + + + + +
+

To-Do

+
+ + + +
+
+ + +
+
+ + + +
+ +
+ +
+ To-Do List: +

+ +
+ +
+ +
+ + + +
+ +
+ Completed Tasks: +

+ +
+ +
+ +
+ +
+ +
+
+ + + + + + + diff --git a/main.css~ b/main.css~ new file mode 100644 index 0000000..cdda92f --- /dev/null +++ b/main.css~ @@ -0,0 +1,3 @@ +body { + padding: 20px; +} \ No newline at end of file diff --git a/main.js~ b/main.js~ new file mode 100644 index 0000000..c80ec08 --- /dev/null +++ b/main.js~ @@ -0,0 +1 @@ +console.log('test'); \ No newline at end of file From 5ad89f954436b8620b61273bd5e67b08ac2bfcae Mon Sep 17 00:00:00 2001 From: puneet7 Date: Tue, 12 Apr 2016 15:21:16 +0000 Subject: [PATCH 2/6] completed to do --- index.html | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++--- index.html~ | 2 +- main.css | 72 ++++++++++++++++++++++++++++++++++++++++++++++++--- main.js | 70 +++++++++++++++++++++++++++++++++++++++++++++++++- main.js~ | 70 +++++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 279 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 47f39d4..668fcbc 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,71 @@ - -

todo!

- \ No newline at end of file + + + + + To-Do List + + + + + + + + + + + + +
+

To-Do

+
+ + + +
+
+ + +
+
+ + + +
+ +
+ +
+ To-Do List: +

+ +
+ +
+ +
+ + + +
+ +
+ Completed Tasks: +

+ +
+ +
+ +
+ +
+ +
+
+ + + + + + + diff --git a/index.html~ b/index.html~ index 668fcbc..fa052cb 100644 --- a/index.html~ +++ b/index.html~ @@ -7,7 +7,7 @@ - + diff --git a/main.css b/main.css index cdda92f..470e33f 100644 --- a/main.css +++ b/main.css @@ -1,3 +1,69 @@ -body { - padding: 20px; -} \ No newline at end of file + diff --git a/main.js b/main.js index c80ec08..911afab 100644 --- a/main.js +++ b/main.js @@ -1 +1,69 @@ -console.log('test'); \ No newline at end of file + $(document).ready(function() { + + function makeCounter() { // This part will run ONLY once after the page loads + var count = 0; // count will be visible to inner function. + + return function() { // + count++; // Increment count everytime a variable assigns itself to makeCounter(); + return count; // This can happen everytime a button is clicked + }; + + }; + + todo_counter = makeCounter(); // Will be equal to inner function of makeCounter + completed_counter = makeCounter(); // + + $("#todo_sub").click(function(e){ + + var todoitem = document.getElementById("todo_item").value; //Get the Task from the input text area. + document.getElementById("todo_item").value = ""; //Reset the value of input text area. + + if(todoitem.trim().length == 0) //Reject Blank submissions. + return false; + + var i = todo_counter(); //Use the counter to create unique id for every 'x' in the anchor tag and every div under To-Do list. + + //Create HTML for the newest task submitted and append it under To-Do List. + var html_todo = "
" + todoitem + "x
"; + $(html_todo).hide().fadeIn(300).appendTo("#todo_items"); + + e.preventDefault(); //Prevent form submission (page refresh) to avoid resetting data. + + }); + + + $(document).on('click', 'a', function() { + + var date = new Date(); //Create Timestamp in 12Hr Format. + var completed_time_stamp = " " + (date.getHours() > 12 ? (date.getHours()-12).toString() : date.getHours().toString()) + ":" + date.getMinutes().toString() + ":" + date.getSeconds().toString(); + + var comp_no = completed_counter(); //Use the counter to create unique id's for 'x' and '←' anchor tags. + + $par_div = $(this).parent("div"); //Get the Parent Element. + par_div_id = $par_div.attr("id"); //Get the id of the Parent Element. + + var check_parent_div = par_div_id.toString().split(""); //Gets the First letter of parent id + if(check_parent_div[0] =="c"){ //If first letter is c, the anchor tag clicked belongs to Completed Task and + if(this.id.toString().split("")[0] == "r"){ //Checks whether user wants to delete the task or 'r'-evert back to Unfinished Tasks. + + var rev_task = $par_div.find("span").text().split(" "); //Split the words of reverting task in an array, Last element will be the timestamp. + var redo_task = ""; + + for(var i = 0; i " + complete + "" + completed_time_stamp + " x← "; + $(html_completed).hide().fadeIn(300).appendTo("#completed_tasks"); //Move from To-Do List to Completed Tasks. + + }); + +}); diff --git a/main.js~ b/main.js~ index c80ec08..911afab 100644 --- a/main.js~ +++ b/main.js~ @@ -1 +1,69 @@ -console.log('test'); \ No newline at end of file + $(document).ready(function() { + + function makeCounter() { // This part will run ONLY once after the page loads + var count = 0; // count will be visible to inner function. + + return function() { // + count++; // Increment count everytime a variable assigns itself to makeCounter(); + return count; // This can happen everytime a button is clicked + }; + + }; + + todo_counter = makeCounter(); // Will be equal to inner function of makeCounter + completed_counter = makeCounter(); // + + $("#todo_sub").click(function(e){ + + var todoitem = document.getElementById("todo_item").value; //Get the Task from the input text area. + document.getElementById("todo_item").value = ""; //Reset the value of input text area. + + if(todoitem.trim().length == 0) //Reject Blank submissions. + return false; + + var i = todo_counter(); //Use the counter to create unique id for every 'x' in the anchor tag and every div under To-Do list. + + //Create HTML for the newest task submitted and append it under To-Do List. + var html_todo = "
" + todoitem + "x
"; + $(html_todo).hide().fadeIn(300).appendTo("#todo_items"); + + e.preventDefault(); //Prevent form submission (page refresh) to avoid resetting data. + + }); + + + $(document).on('click', 'a', function() { + + var date = new Date(); //Create Timestamp in 12Hr Format. + var completed_time_stamp = " " + (date.getHours() > 12 ? (date.getHours()-12).toString() : date.getHours().toString()) + ":" + date.getMinutes().toString() + ":" + date.getSeconds().toString(); + + var comp_no = completed_counter(); //Use the counter to create unique id's for 'x' and '←' anchor tags. + + $par_div = $(this).parent("div"); //Get the Parent Element. + par_div_id = $par_div.attr("id"); //Get the id of the Parent Element. + + var check_parent_div = par_div_id.toString().split(""); //Gets the First letter of parent id + if(check_parent_div[0] =="c"){ //If first letter is c, the anchor tag clicked belongs to Completed Task and + if(this.id.toString().split("")[0] == "r"){ //Checks whether user wants to delete the task or 'r'-evert back to Unfinished Tasks. + + var rev_task = $par_div.find("span").text().split(" "); //Split the words of reverting task in an array, Last element will be the timestamp. + var redo_task = ""; + + for(var i = 0; i " + complete + "" + completed_time_stamp + " x← "; + $(html_completed).hide().fadeIn(300).appendTo("#completed_tasks"); //Move from To-Do List to Completed Tasks. + + }); + +}); From 42721900b2087eb94af01a0cc99cf0cef35efa37 Mon Sep 17 00:00:00 2001 From: puneet7 Date: Tue, 12 Apr 2016 15:28:11 +0000 Subject: [PATCH 3/6] Delete index.html~ --- index.html~ | 71 ----------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 index.html~ diff --git a/index.html~ b/index.html~ deleted file mode 100644 index fa052cb..0000000 --- a/index.html~ +++ /dev/null @@ -1,71 +0,0 @@ - - - - - To-Do List - - - - - - - - - - - - -
-

To-Do

-
- - - -
-
- - -
-
- - - -
- -
- -
- To-Do List: -

- -
- -
- -
- - - -
- -
- Completed Tasks: -

- -
- -
- -
- -
- -
-
- - - - - - - From 9432e9f1a9ae1ebb8852f221dc0ba7facd95eb69 Mon Sep 17 00:00:00 2001 From: puneet7 Date: Tue, 12 Apr 2016 15:28:40 +0000 Subject: [PATCH 4/6] Delete main.css~ --- main.css~ | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 main.css~ diff --git a/main.css~ b/main.css~ deleted file mode 100644 index cdda92f..0000000 --- a/main.css~ +++ /dev/null @@ -1,3 +0,0 @@ -body { - padding: 20px; -} \ No newline at end of file From 20dfc8c5bdc7c10e0d895f5414ce613a217d3780 Mon Sep 17 00:00:00 2001 From: puneet7 Date: Tue, 12 Apr 2016 15:28:59 +0000 Subject: [PATCH 5/6] Delete main.js~ --- main.js~ | 69 -------------------------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 main.js~ diff --git a/main.js~ b/main.js~ deleted file mode 100644 index 911afab..0000000 --- a/main.js~ +++ /dev/null @@ -1,69 +0,0 @@ - $(document).ready(function() { - - function makeCounter() { // This part will run ONLY once after the page loads - var count = 0; // count will be visible to inner function. - - return function() { // - count++; // Increment count everytime a variable assigns itself to makeCounter(); - return count; // This can happen everytime a button is clicked - }; - - }; - - todo_counter = makeCounter(); // Will be equal to inner function of makeCounter - completed_counter = makeCounter(); // - - $("#todo_sub").click(function(e){ - - var todoitem = document.getElementById("todo_item").value; //Get the Task from the input text area. - document.getElementById("todo_item").value = ""; //Reset the value of input text area. - - if(todoitem.trim().length == 0) //Reject Blank submissions. - return false; - - var i = todo_counter(); //Use the counter to create unique id for every 'x' in the anchor tag and every div under To-Do list. - - //Create HTML for the newest task submitted and append it under To-Do List. - var html_todo = "
" + todoitem + "x
"; - $(html_todo).hide().fadeIn(300).appendTo("#todo_items"); - - e.preventDefault(); //Prevent form submission (page refresh) to avoid resetting data. - - }); - - - $(document).on('click', 'a', function() { - - var date = new Date(); //Create Timestamp in 12Hr Format. - var completed_time_stamp = " " + (date.getHours() > 12 ? (date.getHours()-12).toString() : date.getHours().toString()) + ":" + date.getMinutes().toString() + ":" + date.getSeconds().toString(); - - var comp_no = completed_counter(); //Use the counter to create unique id's for 'x' and '←' anchor tags. - - $par_div = $(this).parent("div"); //Get the Parent Element. - par_div_id = $par_div.attr("id"); //Get the id of the Parent Element. - - var check_parent_div = par_div_id.toString().split(""); //Gets the First letter of parent id - if(check_parent_div[0] =="c"){ //If first letter is c, the anchor tag clicked belongs to Completed Task and - if(this.id.toString().split("")[0] == "r"){ //Checks whether user wants to delete the task or 'r'-evert back to Unfinished Tasks. - - var rev_task = $par_div.find("span").text().split(" "); //Split the words of reverting task in an array, Last element will be the timestamp. - var redo_task = ""; - - for(var i = 0; i " + complete + "" + completed_time_stamp + " x← "; - $(html_completed).hide().fadeIn(300).appendTo("#completed_tasks"); //Move from To-Do List to Completed Tasks. - - }); - -}); From 7e5329379eecc6ac1c3ddc7728a5ea6b1774d021 Mon Sep 17 00:00:00 2001 From: puneet7 Date: Tue, 12 Apr 2016 08:48:35 -0700 Subject: [PATCH 6/6] Update index.html To Do Completed --- index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.html b/index.html index 668fcbc..22b9099 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,6 @@ -
@@ -65,7 +64,6 @@

To-Do

-