-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
265 lines (222 loc) · 7.47 KB
/
index.html
File metadata and controls
265 lines (222 loc) · 7.47 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html>
<head>
<meta name="theme-color" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;600;800&family=Raleway&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="css/cavemancssalfa.css">
<title>Let's Do it | ToDo List</title>
<style>
/* font-family: 'Poppins', sans-serif;
font-family: 'Raleway', sans-serif; */
body {
min-width: 200px;
}
/* Remove margins and padding from the list */
ul {
margin: 0;
padding: 0;
}
/* Style the list items */
ul li {
cursor: pointer;
position: relative;
padding: 12px 8px 12px 40px;
list-style-type: none;
font-family: 'Poppins', sans-serif;
font-weight: 800;
max-width: 100%;
background: transparent;
transition: 0.2s;
font-size: 1.5rem;
/* make the list items unselectable */
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Set all odd list items to a different color (zebra-stripes) */
ul li:nth-child(odd) {
background: transparent;
}
/* Darker background-color on hover */
ul li:hover {
background-color: rgb(255, 255, 255, 0.2);
}
/* When clicked on, add a background color and strike out text */
ul li.checked {
background: transparent;
color: #121212;
text-decoration: line-through;
text-decoration-thickness: 5px;
}
/* Style the close button */
.close {
position: absolute;
right: 0;
top: 0;
padding: 12px 16px 12px 16px;
}
.close:hover {
background-color: #f44336;
color: white;
}
/* Style the header */
.header {
padding: 1.5rem;
color: #121212;
}
/* Clear floats after the header */
.header:after {
content: "";
display: table;
clear: both;
}
.header .header-title {
font-family: 'Poppins', sans-serif;
line-height: 1;
}
/* Style the input */
input {
margin: 0;
background: none;
border: 5px solid #121212;
font-family: 'Poppins', sans-serif;
font-weight: 800;
color: #121212;
padding: 10px;
}
input::placeholder {
font-family: 'Poppins', sans-serif;
font-weight: 800;
color: #333;
}
input:focus {
border: none;
outline: none;
transition: 300ms ease-in-out;
border: 5px solid #121212;
}
/* Style the "Add" button */
.addBtn {
padding: 10px 30px;
border: 5px solid #121212;
font-family: 'Poppins', sans-serif;
font-weight: 800;
background: transparent;
color: #121212;
float: left;
text-align: center;
cursor: pointer;
transition: 0.3s;
border-radius: 0;
}
.addBtn:hover {
transition: 300ms ease-in-out;
}
.addBtn:focus {
transition: 300ms ease-in-out;
}
</style>
</head>
<body>
<div id="myDIV" class="header">
<h1 class="header-title">Let's <br> Do it</h1><br><br>
<div class="input-text">
<input type="text" id="myInput" placeholder="What's next work">
</div><br>
<div class="btn">
<button id="myBtn" class="addBtn" onclick="newElement()" type="submit">Add</button>
</div>
<!-- <span onclick="newElement()" class="addBtn">Add</span> -->
</div>
<br> <br> <br>
<ul id="myUL">
<li>Task 1 </li>
<li>Task 2 </li>
<li>Task 3</li>
<li class="checked">Completed Task</li>
</ul>
<script>
var input = document.getElementById("myInput");
input.addEventListener("keyup", function (event) {
if (event.keyCode === 13) {
event.preventDefault();
document.getElementById("myBtn").click();
}
});
</script>
<script>
// Create a "close" button and append it to each list item
var myNodelist = document.getElementsByTagName("LI");
var i;
for (i = 0; i < myNodelist.length; i++) {
var span = document.createElement("SPAN");
var txt = document.createTextNode("\u00D7");
span.className = "close";
span.appendChild(txt);
myNodelist[i].appendChild(span);
}
// Click on a close button to hide the current list item
var close = document.getElementsByClassName("close");
var i;
for (i = 0; i < close.length; i++) {
close[i].onclick = function () {
var div = this.parentElement;
div.style.display = "none";
}
}
// Add a "checked" symbol when clicking on a list item
var list = document.querySelector('ul');
list.addEventListener('click', function (ev) {
if (ev.target.tagName === 'LI') {
ev.target.classList.toggle('checked');
}
}, false);
// Create a new list item when clicking on the "Add" button
function newElement() {
var li = document.createElement("li");
var inputValue = document.getElementById("myInput").value;
var t = document.createTextNode(inputValue);
li.appendChild(t);
if (inputValue === '') {
alert("You must write something!");
} else {
document.getElementById("myUL").appendChild(li);
}
document.getElementById("myInput").value = "";
var span = document.createElement("SPAN");
var txt = document.createTextNode("\u00D7");
span.className = "close";
span.appendChild(txt);
li.appendChild(span);
for (i = 0; i < close.length; i++) {
close[i].onclick = function () {
var div = this.parentElement;
div.style.display = "none";
}
}
}
</script>
<script>
var input = document.getElementById("myInput");
input.addEventListener("keyup", function (event) {
if (event.keyCode === 13) {
event.preventDefault();
document.getElementById("addBtn").click();
}
});
</script>
<script>
var colors = ['#F6F300', '#71F99C', '#FF7D01', '#16a596', '#a05344', '#bc6ff1'];
var changeBackground = function () {
var colorChange = colors[Math.floor(Math.random() * colors.length)];
document.body.style.background = colorChange;
// var metaThemeColor = document.querySelector("meta[name=theme-color]").metaThemeColor = colorChange;
document.querySelector('meta[name="theme-color"]').setAttribute('content', colorChange);
};
changeBackground();
</script>
</body>
</html>