Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sivam2.0 #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 78 additions & 26 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,83 @@
<!DOCTYPE html>
<html lang="en">

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UniversuMM - ToDo App</title>
<link rel="stylesheet" href="style.css">
<title>My Todo List</title>
<style>
body { background: #0f0f0f; font-family: Tahoma, sans-serif; font-size: 11px; }
header, section, footer { display: block; }
#container { background-color: #eee; margin: 0 auto; width: 300px; border: 4px solid #222; }
header h1 { text-align: center; margin: 0; padding: 15px 0;}
label { display: block; padding-bottom: 5px; text-align: center; }
#task { border: 1px solid #888; margin-left: 50px; width: 200px; }
#tasks { margin: 20px; padding: 0; }
#tasks li { list-style-type: none; padding: 5px; }
#tasks li:nth-child(2n) { background-color: #e8e8e8; }
#tasks li:nth-child(2n+1) { background-color: #ddd; }
#tasks li:hover { background-color: #ccc; }
#tasks li a { color: red; display: block; float: right; text-decoration: none; }
footer { background-color: #000; color: #aaa; padding: 20px; }
footer a { color: #aaa; }
footer a:hover { color: #eee; }
</style>
</head>

<body>
<header id="header">
<h1>To-Do App</h1>
</header>

<form class="task-form">
<textarea name="task-input" id="task-input" autofocus></textarea>
<input type="button" value="ADD TASK" id="task-add">
</form>
<div id="container">
<header>
<h1>Universiumm Todo App</h1>
</header>

<section id="main-content">
<div class="form-area">
<form id="tasks-form">
<label for="task">Add a task here and hit enter</label>
<input id="task" autofocus>
</form>
</div>

<ul id="tasks"></ul>
</section>

<footer>
<a href="#">App Created for MMDU Project</a> |

</footer>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

var i = 0;

// Initial loading of tasks
for( i = 0; i < localStorage.length; i++)
$("#tasks").append("<li id='task-"+ i +"'>" + localStorage.getItem('task-'+i) + " <a href='#'>x</a></li>");

// Add a task
$("#tasks-form").submit(function() {
if ( $("#task").val() != "" ) {
localStorage.setItem( "task-"+i, $("#task").val() );
$("#tasks").append("<li id='task-"+i+"'>"+localStorage.getItem("task-"+i)+" <a href='#'>x</a></li>")
$("#task-" + i).css('display', 'none');
$("#task-" + i).slideDown();
$("#task").val("");
i++;
}
return false;
});

// Remove a task
$("#tasks li a").live("click", function() {
localStorage.removeItem($(this).parent().attr("id"));
$(this).parent().slideUp('slow', function() { $(this).remove(); } );
for(i=0; i<localStorage.length; i++) {
if( !localStorage.getItem("task-"+i)) {
localStorage.setItem("task-"+i, localStorage.getItem('task-' + (i+1) ) );
localStorage.removeItem('task-'+ (i+1) );
}
}
});
});
</script>

<main class="tasks-wrapper">
<h2>Tasks</h2>
<ul id="task-list"></ul>
</main>


<script src="app.js"></script>
</body>

</html>
</html>