Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
devinburnette committed Aug 28, 2016
0 parents commit 3af5032
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 0 deletions.
141 changes: 141 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
body {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: "Roboto";
font-size: 20px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

body::before {
content: '';
position: fixed;
z-index: -1;
top: 0;
left: 0;
background: black;
/* IE Fallback */
width: 100%;
height: 100%;
}

#main {
background: #16a085;
}

h1 {
color: white;
text-align: center;
}

.list {
position: absolute;
width: 360px;
top: 50%;
left: 50%;
margin: -122px 0 100px -180px;
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
}

.list h1 a {
position: absolute;
top: 50%;
right: 20px;
background: #fff;
/* IE Fallback */
background: rgba(255, 255, 255, 0.15);
width: 24px;
height: 24px;
margin: -12px 0 0 0;
color: #fff;
font-size: 14px;
line-height: 24px;
text-align: center;
text-decoration: none;
-webkit-transition: 0.3s linear;
-moz-transition: 0.3s linear;
-ms-transition: 0.3s linear;
-o-transition: 0.3s linear;
transition: 0.3s linear;
}

.list h1 a:hover { background: rgba(255, 255, 255, 0.2); }

.list ul {
list-style: none;
margin: 0;
padding: 0;
}

.list ul li {
background: #fff;
height: 40px;
color: #666;
line-height: 40px;
padding: 0 20px 0 0;
font-size: 20px;
}

.list ul li a {
display: inline-block;
width: 0px;
height: 40px;
margin-right: 16px;
color: #2ecc71;
text-align: center;
text-decoration: none;
opacity: 0;
-webkit-transition: 0.2s linear;
-moz-transition: 0.2s linear;
-ms-transition: 0.2s linear;
-o-transition: 0.2s linear;
transition: 0.2s linear;
}

.list ul li:nth-child(2n) { background: #f7f7f7; }

.list ul li:hover a {
width: 40px;
opacity: 1;
}

form {
text-align: center;
}

#button {
display: none;
}

#item {
background-color:transparent;
border: none;
color: white;
width: 360px;
text-align: center;
font-size: 20px;
}

#item:focus {
outline: none;
}

::-webkit-input-placeholder {
color: white;
}

:-moz-placeholder { /* Firefox 18- */
color: white;
}

::-moz-placeholder { /* Firefox 19+ */
color: white;
}

:-ms-input-placeholder {
color: white;
}
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<head>
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">
</head>

<body>
<div id="main" class="list animated tada">
<h1>My To Do List</h1>
<form>
<input id="item" placeholder="Enter an item" type="text"/>
<input id="button" type="submit" value="save"/>
</form>
<ul id="list">
</ul>
</div>
<div id="empty" class="dialog error" title="Oops! You must enter an item.">
</div>
<div id="duplicate" class="dialog error" title="Oops! That item is already on your list.">
</div>
<div id="congrats" class="dialog success" title="Congrats! You did everything on your list.">
</div>


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

</body>
48 changes: 48 additions & 0 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
function checkItem(event) {
var item = $('#item').val();
if ($('ul').length > 0) {
var already_there = $('ul').text().includes(item);
if (already_there === true && item !== '') {
$('#duplicate').dialog({
height: 50,
width: 500
});
return false;
}
}
return true;
}

$('form').on('submit', function(event) {
if (checkItem(event) === true) {
var item = $('#item').val();
if (item !== '') {
$('#list').append('<li><a href="" onClick="event.preventDefault();cleanUp($(this).parent());"><div class="fa fa-check"></div></a>' + item + '</li>');
} else {
$('#empty').dialog({
height: 50,
width: 400
});
}
event.preventDefault();
} else {
event.preventDefault();
}
});

function removeItem(obj) {
obj.slideUp(500, function() {
obj.remove();
});
}

function cleanUp(obj) {
var items = $('ul li');
if (items.length === 1) {
$('#congrats').dialog({
height: 50,
width: 500
});
}
removeItem(obj);
}

0 comments on commit 3af5032

Please sign in to comment.