-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
181 lines (156 loc) · 4.84 KB
/
home.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html>
<head>
<title> Home</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>
<?php include 'globalExternals/components.php'; ?>
</head>
<style>
/**************************** home PAGE - to do list ******************************************************/
body {
font-family: "Lato", sans-serif;
color: #2c3338;
background: #2c3338; /* fallback for old browsers */
}
#container {
margin: 100px auto;
width: 360px;
background-color: #e5ce48;
box-shadow: 0px 0px 20px rgba(0,0,0,.3);
border-radius: 2px;
}
h1 {
text-transform: uppercase;
margin: 0;
padding: 10px 20px;
}
input {
outline: none;
font-family: "Lato", sans-serif;
color: #333333;
background-color: #e5ce48;
font-size: 16px;
border: none;
}
#new-todo {
box-sizing: border-box;
width: 100%;
padding: 10px 20px;
}
#new-todo:hover {
border: 1px solid #E3DAAE;
}
.fa-square-o, .fa-check-square-o {
margin-right: 8px;
font-size: 16px;
}
.completed {
color: gray;
text-decoration: line-through;
}
ul {
padding: 0;
margin: 0;
list-style: none;
}
li {
height: 40px;
line-height: 40px;
padding: 0 10px;
}
li:hover{
border: 1px solid #E3DAAE;
}
.todo {
width: 80%;
}
#first {
display: none;
float: right;
}
li:hover #first {
display: inline-block;
}
.fa-times {
font-size: 14px;
color: gray;
}
.fa-times:hover {
color: #333333;
}
</style>
<body>
<?php include 'navigations/NavigationBar.php'; ?>
<!--*************************to do list ***************************************-->
<div></div>
<div id="container">
<h1>To do List:</h1>
<input id="new-todo" type="text" placeholder="Add new todo">
<ul>
<li>
<span id="first">
<i class="fa fa-times" aria-hidden="true"></i>
</span>
<span id="last">
<i class="fa fa-square-o"></i>
</span>
<input class="todo" type="text" value="Check Payments">
</li>
<li>
<span id="first">
<i class="fa fa-times" aria-hidden="true"></i>
</span>
<span id="last">
<i class="fa fa-square-o"></i>
</span>
<input class="todo" type="text" value="Follow up with this member">
</li>
<li>
<span id="first">
<i class="fa fa-times" aria-hidden="true"></i>
</span>
<span id="last">
<i class="fa fa-square-o"></i>
</span>
<input class="todo" type="text" value="Check Schedule Reservation">
</li>
</ul>
</div>
<script>
//check checkbox to complete todo
$("ul").on("click", "#last", function() {
$(this).parent().find("input:text").toggleClass("completed");
$(this).find("i:last").toggleClass("fa-square-o fa-check-square-o");
});
//delete todos via x icon
$("ul").on("click", "#first", function(event) {
$(this).parent().fadeOut('500',function(){
$(this).remove();
});
event.stopPropagation();
});
//delete empty todos via backspace
$("ul").on("keyup", ".todo", function(event) {
//if backspace on empty text input
if(event.which === 8 && $(this).val() === "") {
$(this).parent().fadeOut('.5',function(){
$(this).remove();
});
}
event.stopPropagation();
});
//add new todo
$("#new-todo").on("keypress", function(event) {
if(event.which === 13) {
var newTodo = $(this).val();
$(this).val("");
$("ul").append("<li><span id='first'><i class='fa fa-times' aria-hidden='true'></i></span><span id='last'><i class='fa fa-square-o'></i></span><input class='todo' type='text' value='" +newTodo+ "'></li>");
}
});
</script>
</body>
</html>