Start with Python
This commit is contained in:
24
2- javascript/8-todo-list/README.md
Normal file
24
2- javascript/8-todo-list/README.md
Normal file
@ -0,0 +1,24 @@
|
||||
To Do List
|
||||
==========
|
||||
|
||||
When it comes to learning new web languages, the todo list has become a "Hello World". So expect to revisit this in Python.
|
||||
|
||||
But until then, we will do it in front-end Javascript.
|
||||
|
||||
You will find the toDoList prototype and constructor at the top of the main.js file.
|
||||
|
||||
#### Create the List
|
||||
|
||||
The add method adds a todo to the list, using the text input and form.
|
||||
|
||||
The complete method marks the appropriate todo item complete. The user wants to click the item itself and strike the item, noting it done.
|
||||
|
||||
Use toggle to toggle it done struck and unstruck.
|
||||
|
||||
Feel free to add any other methods, lists or objects you may want. You will want a separate function to print the list to the #printout div.
|
||||
|
||||
#### Woah! Client's demands have changed
|
||||
|
||||
Now the client who was going to buy your sweet todo list wants a new feature. Is it going to break your whole code, or is your code modular and extendable?
|
||||
|
||||
They want it so after a user completes a task, it is displayed struck for 10 seconds, but then disappears from your list. Google the setTimeout method.
|
22
2- javascript/8-todo-list/index.html
Normal file
22
2- javascript/8-todo-list/index.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!doctype HTML>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="reset.css">
|
||||
<link rel="stylesheet" type="text/css" href="main.css">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class = "container">
|
||||
<nav id="top">
|
||||
<h1>To Do List</h1>
|
||||
</nav>
|
||||
<form id="todoform" action="#" method="post">
|
||||
<input type="text" id= "todo" name="todo" placeholder="Enter Your Todo">
|
||||
<input type="submit" value="Add" id="addTodo">
|
||||
</form>
|
||||
<div id = "printout"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
41
2- javascript/8-todo-list/main.css
Normal file
41
2- javascript/8-todo-list/main.css
Normal file
@ -0,0 +1,41 @@
|
||||
body{
|
||||
background-color: #D1D1D1
|
||||
}
|
||||
|
||||
nav{
|
||||
position: absolute;
|
||||
background-color: black;
|
||||
width: 100%;
|
||||
height: 4em;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
line-height: 4em;
|
||||
}
|
||||
|
||||
nav h1{
|
||||
font-size: 3em;
|
||||
font-family: monospace;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#todoform{
|
||||
margin: 5em auto 0 auto;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
#printout{
|
||||
width: 800px;
|
||||
min-height: 1000px;
|
||||
background-color: white;
|
||||
margin: 1em auto 0 auto;
|
||||
color: black;
|
||||
text-indent: 1em;
|
||||
}
|
||||
|
||||
#printout p{
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#printout p:nth-child(even) {
|
||||
background-color: #D1D1D1;
|
||||
}
|
20
2- javascript/8-todo-list/main.js
Normal file
20
2- javascript/8-todo-list/main.js
Normal file
@ -0,0 +1,20 @@
|
||||
// all jquery dom actions can only be called inside document ready.
|
||||
|
||||
function toDoList(){
|
||||
|
||||
}
|
||||
|
||||
toDoList.prototype.add = function(todo){
|
||||
|
||||
}
|
||||
|
||||
toDoList.prototype.complete = function(todo){
|
||||
|
||||
}
|
||||
|
||||
var myList = new toDoList();
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
})
|
47
2- javascript/8-todo-list/reset.css
Normal file
47
2- javascript/8-todo-list/reset.css
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
|
||||
* http://cssreset.com
|
||||
*/
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
Reference in New Issue
Block a user