Spaces:
Running
Running
Add 2 files
Browse files- README.md +6 -4
- index.html +670 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: blue
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: to-do-list
|
3 |
+
emoji: 🐳
|
4 |
colorFrom: blue
|
5 |
+
colorTo: blue
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,670 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Cosmic Task Manager</title>
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
8 |
+
<style>
|
9 |
+
:root {
|
10 |
+
--primary: #6c5ce7;
|
11 |
+
--secondary: #a29bfe;
|
12 |
+
--dark: #2d3436;
|
13 |
+
--light: #f5f6fa;
|
14 |
+
--success: #00b894;
|
15 |
+
--danger: #d63031;
|
16 |
+
--warning: #fdcb6e;
|
17 |
+
}
|
18 |
+
|
19 |
+
* {
|
20 |
+
margin: 0;
|
21 |
+
padding: 0;
|
22 |
+
box-sizing: border-box;
|
23 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
24 |
+
}
|
25 |
+
|
26 |
+
body {
|
27 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
28 |
+
min-height: 100vh;
|
29 |
+
display: flex;
|
30 |
+
justify-content: center;
|
31 |
+
align-items: center;
|
32 |
+
padding: 20px;
|
33 |
+
color: var(--dark);
|
34 |
+
}
|
35 |
+
|
36 |
+
.app-container {
|
37 |
+
width: 100%;
|
38 |
+
max-width: 600px;
|
39 |
+
background-color: rgba(255, 255, 255, 0.9);
|
40 |
+
border-radius: 20px;
|
41 |
+
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
|
42 |
+
overflow: hidden;
|
43 |
+
animation: fadeIn 0.5s ease-out;
|
44 |
+
}
|
45 |
+
|
46 |
+
@keyframes fadeIn {
|
47 |
+
from { opacity: 0; transform: translateY(20px); }
|
48 |
+
to { opacity: 1; transform: translateY(0); }
|
49 |
+
}
|
50 |
+
|
51 |
+
.app-header {
|
52 |
+
background: linear-gradient(to right, var(--primary), var(--secondary));
|
53 |
+
color: white;
|
54 |
+
padding: 25px;
|
55 |
+
text-align: center;
|
56 |
+
position: relative;
|
57 |
+
}
|
58 |
+
|
59 |
+
.app-header h1 {
|
60 |
+
font-size: 2.2rem;
|
61 |
+
margin-bottom: 10px;
|
62 |
+
font-weight: 700;
|
63 |
+
letter-spacing: 1px;
|
64 |
+
}
|
65 |
+
|
66 |
+
.app-header p {
|
67 |
+
opacity: 0.9;
|
68 |
+
font-size: 0.9rem;
|
69 |
+
}
|
70 |
+
|
71 |
+
.date-display {
|
72 |
+
margin-top: 10px;
|
73 |
+
font-size: 0.85rem;
|
74 |
+
display: flex;
|
75 |
+
justify-content: center;
|
76 |
+
align-items: center;
|
77 |
+
gap: 5px;
|
78 |
+
}
|
79 |
+
|
80 |
+
.input-container {
|
81 |
+
padding: 20px;
|
82 |
+
display: flex;
|
83 |
+
gap: 10px;
|
84 |
+
background-color: var(--light);
|
85 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
86 |
+
}
|
87 |
+
|
88 |
+
.task-input {
|
89 |
+
flex: 1;
|
90 |
+
padding: 15px 20px;
|
91 |
+
border: none;
|
92 |
+
border-radius: 50px;
|
93 |
+
font-size: 1rem;
|
94 |
+
outline: none;
|
95 |
+
box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
|
96 |
+
transition: all 0.3s;
|
97 |
+
}
|
98 |
+
|
99 |
+
.task-input:focus {
|
100 |
+
box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
|
101 |
+
}
|
102 |
+
|
103 |
+
.add-btn {
|
104 |
+
padding: 0 25px;
|
105 |
+
background-color: var(--primary);
|
106 |
+
color: white;
|
107 |
+
border: none;
|
108 |
+
border-radius: 50px;
|
109 |
+
cursor: pointer;
|
110 |
+
font-weight: 600;
|
111 |
+
transition: all 0.3s;
|
112 |
+
display: flex;
|
113 |
+
align-items: center;
|
114 |
+
justify-content: center;
|
115 |
+
gap: 8px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.add-btn:hover {
|
119 |
+
background-color: #5a4bd8;
|
120 |
+
transform: translateY(-2px);
|
121 |
+
}
|
122 |
+
|
123 |
+
.task-controls {
|
124 |
+
display: flex;
|
125 |
+
padding: 15px 20px;
|
126 |
+
background-color: var(--light);
|
127 |
+
justify-content: space-between;
|
128 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
129 |
+
}
|
130 |
+
|
131 |
+
.filter-buttons {
|
132 |
+
display: flex;
|
133 |
+
gap: 10px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.filter-btn {
|
137 |
+
padding: 8px 15px;
|
138 |
+
border: none;
|
139 |
+
border-radius: 20px;
|
140 |
+
background-color: transparent;
|
141 |
+
cursor: pointer;
|
142 |
+
font-size: 0.8rem;
|
143 |
+
transition: all 0.2s;
|
144 |
+
}
|
145 |
+
|
146 |
+
.filter-btn.active {
|
147 |
+
background-color: var(--primary);
|
148 |
+
color: white;
|
149 |
+
}
|
150 |
+
|
151 |
+
.clear-btn {
|
152 |
+
padding: 8px 15px;
|
153 |
+
background-color: var(--danger);
|
154 |
+
color: white;
|
155 |
+
border: none;
|
156 |
+
border-radius: 20px;
|
157 |
+
cursor: pointer;
|
158 |
+
font-size: 0.8rem;
|
159 |
+
transition: all 0.2s;
|
160 |
+
}
|
161 |
+
|
162 |
+
.clear-btn:hover {
|
163 |
+
background-color: #c0392b;
|
164 |
+
}
|
165 |
+
|
166 |
+
.task-list {
|
167 |
+
padding: 20px;
|
168 |
+
max-height: 400px;
|
169 |
+
overflow-y: auto;
|
170 |
+
}
|
171 |
+
|
172 |
+
.task-item {
|
173 |
+
display: flex;
|
174 |
+
align-items: center;
|
175 |
+
padding: 15px;
|
176 |
+
margin-bottom: 10px;
|
177 |
+
background-color: white;
|
178 |
+
border-radius: 10px;
|
179 |
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
|
180 |
+
transition: all 0.3s;
|
181 |
+
position: relative;
|
182 |
+
overflow: hidden;
|
183 |
+
}
|
184 |
+
|
185 |
+
.task-item:hover {
|
186 |
+
transform: translateY(-2px);
|
187 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
188 |
+
}
|
189 |
+
|
190 |
+
.task-item.completed {
|
191 |
+
background-color: rgba(0, 184, 148, 0.1);
|
192 |
+
}
|
193 |
+
|
194 |
+
.task-checkbox {
|
195 |
+
width: 22px;
|
196 |
+
height: 22px;
|
197 |
+
margin-right: 15px;
|
198 |
+
cursor: pointer;
|
199 |
+
accent-color: var(--success);
|
200 |
+
}
|
201 |
+
|
202 |
+
.task-text {
|
203 |
+
flex: 1;
|
204 |
+
font-size: 1rem;
|
205 |
+
word-break: break-word;
|
206 |
+
}
|
207 |
+
|
208 |
+
.task-text.completed {
|
209 |
+
text-decoration: line-through;
|
210 |
+
color: #888;
|
211 |
+
}
|
212 |
+
|
213 |
+
.task-actions {
|
214 |
+
display: flex;
|
215 |
+
gap: 10px;
|
216 |
+
margin-left: 15px;
|
217 |
+
}
|
218 |
+
|
219 |
+
.edit-btn, .delete-btn {
|
220 |
+
background: none;
|
221 |
+
border: none;
|
222 |
+
cursor: pointer;
|
223 |
+
width: 28px;
|
224 |
+
height: 28px;
|
225 |
+
border-radius: 50%;
|
226 |
+
display: flex;
|
227 |
+
align-items: center;
|
228 |
+
justify-content: center;
|
229 |
+
transition: all 0.2s;
|
230 |
+
}
|
231 |
+
|
232 |
+
.edit-btn {
|
233 |
+
color: var(--primary);
|
234 |
+
}
|
235 |
+
|
236 |
+
.edit-btn:hover {
|
237 |
+
background-color: rgba(108, 92, 231, 0.1);
|
238 |
+
}
|
239 |
+
|
240 |
+
.delete-btn {
|
241 |
+
color: var(--danger);
|
242 |
+
}
|
243 |
+
|
244 |
+
.delete-btn:hover {
|
245 |
+
background-color: rgba(214, 48, 49, 0.1);
|
246 |
+
}
|
247 |
+
|
248 |
+
.empty-state {
|
249 |
+
text-align: center;
|
250 |
+
padding: 40px 20px;
|
251 |
+
color: #888;
|
252 |
+
}
|
253 |
+
|
254 |
+
.empty-state i {
|
255 |
+
font-size: 3rem;
|
256 |
+
margin-bottom: 20px;
|
257 |
+
color: var(--secondary);
|
258 |
+
opacity: 0.5;
|
259 |
+
}
|
260 |
+
|
261 |
+
.empty-state p {
|
262 |
+
margin-top: 10px;
|
263 |
+
font-size: 0.9rem;
|
264 |
+
}
|
265 |
+
|
266 |
+
.stats-container {
|
267 |
+
display: flex;
|
268 |
+
justify-content: space-between;
|
269 |
+
padding: 15px 20px;
|
270 |
+
background-color: var(--light);
|
271 |
+
font-size: 0.85rem;
|
272 |
+
color: #555;
|
273 |
+
}
|
274 |
+
|
275 |
+
.progress-bar {
|
276 |
+
height: 5px;
|
277 |
+
width: 100%;
|
278 |
+
background-color: #eee;
|
279 |
+
border-radius: 5px;
|
280 |
+
margin-top: 5px;
|
281 |
+
overflow: hidden;
|
282 |
+
}
|
283 |
+
|
284 |
+
.progress-fill {
|
285 |
+
height: 100%;
|
286 |
+
background: linear-gradient(to right, var(--primary), var(--secondary));
|
287 |
+
border-radius: 5px;
|
288 |
+
transition: width 0.3s ease;
|
289 |
+
}
|
290 |
+
|
291 |
+
/* Animations */
|
292 |
+
@keyframes slideIn {
|
293 |
+
from { opacity: 0; transform: translateX(20px); }
|
294 |
+
to { opacity: 1; transform: translateX(0); }
|
295 |
+
}
|
296 |
+
|
297 |
+
@keyframes slideOut {
|
298 |
+
from { opacity: 1; transform: translateX(0); }
|
299 |
+
to { opacity: 0; transform: translateX(20px); }
|
300 |
+
}
|
301 |
+
|
302 |
+
.task-item.slide-in {
|
303 |
+
animation: slideIn 0.3s forwards;
|
304 |
+
}
|
305 |
+
|
306 |
+
.task-item.slide-out {
|
307 |
+
animation: slideOut 0.3s forwards;
|
308 |
+
}
|
309 |
+
|
310 |
+
/* Responsive */
|
311 |
+
@media (max-width: 600px) {
|
312 |
+
.app-container {
|
313 |
+
border-radius: 15px;
|
314 |
+
}
|
315 |
+
|
316 |
+
.app-header {
|
317 |
+
padding: 20px;
|
318 |
+
}
|
319 |
+
|
320 |
+
.app-header h1 {
|
321 |
+
font-size: 1.8rem;
|
322 |
+
}
|
323 |
+
|
324 |
+
.input-container {
|
325 |
+
flex-direction: column;
|
326 |
+
}
|
327 |
+
|
328 |
+
.add-btn {
|
329 |
+
padding: 12px;
|
330 |
+
}
|
331 |
+
|
332 |
+
.task-controls {
|
333 |
+
flex-direction: column;
|
334 |
+
gap: 10px;
|
335 |
+
}
|
336 |
+
|
337 |
+
.filter-buttons {
|
338 |
+
justify-content: center;
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
+
/* Dark mode toggle */
|
343 |
+
.theme-toggle {
|
344 |
+
position: absolute;
|
345 |
+
top: 20px;
|
346 |
+
right: 20px;
|
347 |
+
background: none;
|
348 |
+
border: none;
|
349 |
+
color: white;
|
350 |
+
cursor: pointer;
|
351 |
+
font-size: 1.2rem;
|
352 |
+
z-index: 10;
|
353 |
+
}
|
354 |
+
|
355 |
+
body.dark-mode {
|
356 |
+
background: linear-gradient(135deg, #2c3e50 0%, #000000 100%);
|
357 |
+
}
|
358 |
+
|
359 |
+
body.dark-mode .app-container {
|
360 |
+
background-color: #1e272e;
|
361 |
+
color: #f5f6fa;
|
362 |
+
}
|
363 |
+
|
364 |
+
body.dark-mode .task-input {
|
365 |
+
background-color: #2d3436;
|
366 |
+
color: #f5f6fa;
|
367 |
+
}
|
368 |
+
|
369 |
+
body.dark-mode .task-item {
|
370 |
+
background-color: #2d3436;
|
371 |
+
color: #f5f6fa;
|
372 |
+
}
|
373 |
+
|
374 |
+
body.dark-mode .task-text.completed {
|
375 |
+
color: #7f8c8d;
|
376 |
+
}
|
377 |
+
|
378 |
+
body.dark-mode .empty-state {
|
379 |
+
color: #7f8c8d;
|
380 |
+
}
|
381 |
+
|
382 |
+
body.dark-mode .input-container,
|
383 |
+
body.dark-mode .task-controls,
|
384 |
+
body.dark-mode .stats-container {
|
385 |
+
background-color: #2d3436;
|
386 |
+
border-bottom-color: rgba(255, 255, 255, 0.05);
|
387 |
+
}
|
388 |
+
</style>
|
389 |
+
</head>
|
390 |
+
<body>
|
391 |
+
<div class="app-container">
|
392 |
+
<button class="theme-toggle" id="themeToggle">
|
393 |
+
<i class="fas fa-moon"></i>
|
394 |
+
</button>
|
395 |
+
<div class="app-header">
|
396 |
+
<h1>Cosmic Task Manager</h1>
|
397 |
+
<p>Organize your universe, one task at a time</p>
|
398 |
+
<div class="date-display">
|
399 |
+
<i class="far fa-calendar-alt"></i>
|
400 |
+
<span id="currentDate"></span>
|
401 |
+
</div>
|
402 |
+
</div>
|
403 |
+
|
404 |
+
<div class="input-container">
|
405 |
+
<input type="text" class="task-input" id="taskInput" placeholder="What's on your mind today?">
|
406 |
+
<button class="add-btn" id="addTaskBtn">
|
407 |
+
<i class="fas fa-plus"></i>
|
408 |
+
Add
|
409 |
+
</button>
|
410 |
+
</div>
|
411 |
+
|
412 |
+
<div class="task-controls">
|
413 |
+
<div class="filter-buttons">
|
414 |
+
<button class="filter-btn active" data-filter="all">All</button>
|
415 |
+
<button class="filter-btn" data-filter="active">Active</button>
|
416 |
+
<button class="filter-btn" data-filter="completed">Completed</button>
|
417 |
+
</div>
|
418 |
+
<button class="clear-btn" id="clearCompletedBtn">
|
419 |
+
<i class="fas fa-trash"></i>
|
420 |
+
Clear Completed
|
421 |
+
</button>
|
422 |
+
</div>
|
423 |
+
|
424 |
+
<div class="task-list" id="taskList">
|
425 |
+
<div class="empty-state">
|
426 |
+
<i class="fas fa-tasks"></i>
|
427 |
+
<h3>No tasks yet</h3>
|
428 |
+
<p>Add your first task and start organizing your day!</p>
|
429 |
+
</div>
|
430 |
+
</div>
|
431 |
+
|
432 |
+
<div class="stats-container">
|
433 |
+
<div class="tasks-count">
|
434 |
+
<span id="totalTasks">0</span> tasks total
|
435 |
+
</div>
|
436 |
+
<div class="completion-rate">
|
437 |
+
<span id="completedTasks">0</span> completed
|
438 |
+
<div class="progress-bar">
|
439 |
+
<div class="progress-fill" id="progressFill"></div>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
</div>
|
443 |
+
</div>
|
444 |
+
|
445 |
+
<script>
|
446 |
+
document.addEventListener('DOMContentLoaded', function() {
|
447 |
+
// DOM Elements
|
448 |
+
const taskInput = document.getElementById('taskInput');
|
449 |
+
const addTaskBtn = document.getElementById('addTaskBtn');
|
450 |
+
const taskList = document.getElementById('taskList');
|
451 |
+
const totalTasksSpan = document.getElementById('totalTasks');
|
452 |
+
const completedTasksSpan = document.getElementById('completedTasks');
|
453 |
+
const progressFill = document.getElementById('progressFill');
|
454 |
+
const clearCompletedBtn = document.getElementById('clearCompletedBtn');
|
455 |
+
const filterButtons = document.querySelectorAll('.filter-btn');
|
456 |
+
const themeToggle = document.getElementById('themeToggle');
|
457 |
+
const currentDateSpan = document.getElementById('currentDate');
|
458 |
+
|
459 |
+
// Set current date
|
460 |
+
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
461 |
+
currentDateSpan.textContent = new Date().toLocaleDateString('en-US', options);
|
462 |
+
|
463 |
+
// Tasks array
|
464 |
+
let tasks = JSON.parse(localStorage.getItem('tasks')) || [];
|
465 |
+
|
466 |
+
// Filter state
|
467 |
+
let currentFilter = 'all';
|
468 |
+
|
469 |
+
// Theme state
|
470 |
+
const darkMode = localStorage.getItem('darkMode') === 'true';
|
471 |
+
if (darkMode) {
|
472 |
+
document.body.classList.add('dark-mode');
|
473 |
+
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
|
474 |
+
}
|
475 |
+
|
476 |
+
// Initialize
|
477 |
+
renderTasks();
|
478 |
+
|
479 |
+
// Event Listeners
|
480 |
+
addTaskBtn.addEventListener('click', addTask);
|
481 |
+
taskInput.addEventListener('keypress', function(e) {
|
482 |
+
if (e.key === 'Enter') addTask();
|
483 |
+
});
|
484 |
+
clearCompletedBtn.addEventListener('click', clearCompletedTasks);
|
485 |
+
themeToggle.addEventListener('click', toggleTheme);
|
486 |
+
|
487 |
+
// Filter buttons
|
488 |
+
filterButtons.forEach(button => {
|
489 |
+
button.addEventListener('click', function() {
|
490 |
+
filterButtons.forEach(btn => btn.classList.remove('active'));
|
491 |
+
this.classList.add('active');
|
492 |
+
currentFilter = this.dataset.filter;
|
493 |
+
renderTasks();
|
494 |
+
});
|
495 |
+
});
|
496 |
+
|
497 |
+
// Functions
|
498 |
+
function addTask() {
|
499 |
+
const taskText = taskInput.value.trim();
|
500 |
+
if (taskText === '') return;
|
501 |
+
|
502 |
+
const newTask = {
|
503 |
+
id: Date.now(),
|
504 |
+
text: taskText,
|
505 |
+
completed: false
|
506 |
+
};
|
507 |
+
|
508 |
+
tasks.push(newTask);
|
509 |
+
saveTasks();
|
510 |
+
renderTasks();
|
511 |
+
|
512 |
+
// Clear input
|
513 |
+
taskInput.value = '';
|
514 |
+
taskInput.focus();
|
515 |
+
}
|
516 |
+
|
517 |
+
function renderTasks() {
|
518 |
+
// Filter tasks
|
519 |
+
let filteredTasks = tasks;
|
520 |
+
if (currentFilter === 'active') {
|
521 |
+
filteredTasks = tasks.filter(task => !task.completed);
|
522 |
+
} else if (currentFilter === 'completed') {
|
523 |
+
filteredTasks = tasks.filter(task => task.completed);
|
524 |
+
}
|
525 |
+
|
526 |
+
if (filteredTasks.length === 0) {
|
527 |
+
taskList.innerHTML = `
|
528 |
+
<div class="empty-state">
|
529 |
+
<i class="fas ${currentFilter === 'all' ? 'fa-tasks' : currentFilter === 'active' ? 'fa-clipboard-list' : 'fa-check-circle'}"></i>
|
530 |
+
<h3>No ${currentFilter === 'all' ? 'tasks' : currentFilter} yet</h3>
|
531 |
+
<p>${currentFilter === 'all' ? 'Add your first task and start organizing your day!' : currentFilter === 'active' ? 'All tasks are completed! You rock!' : 'Complete some tasks to see them here'}</p>
|
532 |
+
</div>
|
533 |
+
`;
|
534 |
+
} else {
|
535 |
+
taskList.innerHTML = '';
|
536 |
+
filteredTasks.forEach(task => {
|
537 |
+
const taskElement = document.createElement('div');
|
538 |
+
taskElement.className = 'task-item';
|
539 |
+
if (task.completed) taskElement.classList.add('completed');
|
540 |
+
taskElement.dataset.id = task.id;
|
541 |
+
taskElement.innerHTML = `
|
542 |
+
<input type="checkbox" class="task-checkbox" ${task.completed ? 'checked' : ''}>
|
543 |
+
<div class="task-text ${task.completed ? 'completed' : ''}">${task.text}</div>
|
544 |
+
<div class="task-actions">
|
545 |
+
<button class="edit-btn">
|
546 |
+
<i class="fas fa-edit"></i>
|
547 |
+
</button>
|
548 |
+
<button class="delete-btn">
|
549 |
+
<i class="fas fa-trash"></i>
|
550 |
+
</button>
|
551 |
+
</div>
|
552 |
+
`;
|
553 |
+
taskList.appendChild(taskElement);
|
554 |
+
taskElement.classList.add('slide-in');
|
555 |
+
});
|
556 |
+
|
557 |
+
// Add event listeners to new elements
|
558 |
+
document.querySelectorAll('.task-checkbox').forEach(checkbox => {
|
559 |
+
checkbox.addEventListener('change', toggleTask);
|
560 |
+
});
|
561 |
+
|
562 |
+
document.querySelectorAll('.delete-btn').forEach(button => {
|
563 |
+
button.addEventListener('click', deleteTask);
|
564 |
+
});
|
565 |
+
|
566 |
+
document.querySelectorAll('.edit-btn').forEach(button => {
|
567 |
+
button.addEventListener('click', editTask);
|
568 |
+
});
|
569 |
+
|
570 |
+
document.querySelectorAll('.task-text').forEach(textElement => {
|
571 |
+
textElement.addEventListener('dblclick', function() {
|
572 |
+
this.closest('.task-item').querySelector('.edit-btn').click();
|
573 |
+
});
|
574 |
+
});
|
575 |
+
}
|
576 |
+
|
577 |
+
// Update stats
|
578 |
+
updateStats();
|
579 |
+
}
|
580 |
+
|
581 |
+
function toggleTask(e) {
|
582 |
+
const taskId = parseInt(e.target.closest('.task-item').dataset.id);
|
583 |
+
const taskIndex = tasks.findIndex(task => task.id === taskId);
|
584 |
+
|
585 |
+
tasks[taskIndex].completed = e.target.checked;
|
586 |
+
saveTasks();
|
587 |
+
renderTasks();
|
588 |
+
}
|
589 |
+
|
590 |
+
function deleteTask(e) {
|
591 |
+
const taskItem = e.target.closest('.task-item');
|
592 |
+
taskItem.classList.add('slide-out');
|
593 |
+
|
594 |
+
setTimeout(() => {
|
595 |
+
const taskId = parseInt(taskItem.dataset.id);
|
596 |
+
tasks = tasks.filter(task => task.id !== taskId);
|
597 |
+
saveTasks();
|
598 |
+
renderTasks();
|
599 |
+
}, 300);
|
600 |
+
}
|
601 |
+
|
602 |
+
function editTask(e) {
|
603 |
+
const taskItem = e.target.closest('.task-item');
|
604 |
+
const taskId = parseInt(taskItem.dataset.id);
|
605 |
+
const taskIndex = tasks.findIndex(task => task.id === taskId);
|
606 |
+
const taskTextEl = taskItem.querySelector('.task-text');
|
607 |
+
|
608 |
+
const currentText = taskTextEl.textContent;
|
609 |
+
const input = document.createElement('input');
|
610 |
+
input.type = 'text';
|
611 |
+
input.value = currentText;
|
612 |
+
input.className = 'task-edit-input';
|
613 |
+
input.style.width = '100%';
|
614 |
+
input.style.padding = '8px';
|
615 |
+
input.style.borderRadius = '4px';
|
616 |
+
input.style.border = '1px solid #ddd';
|
617 |
+
|
618 |
+
taskTextEl.replaceWith(input);
|
619 |
+
input.focus();
|
620 |
+
|
621 |
+
function saveEdit() {
|
622 |
+
const newText = input.value.trim();
|
623 |
+
if (newText && newText !== currentText) {
|
624 |
+
tasks[taskIndex].text = newText;
|
625 |
+
saveTasks();
|
626 |
+
}
|
627 |
+
renderTasks();
|
628 |
+
}
|
629 |
+
|
630 |
+
input.addEventListener('blur', saveEdit);
|
631 |
+
input.addEventListener('keypress', function(e) {
|
632 |
+
if (e.key === 'Enter') saveEdit();
|
633 |
+
});
|
634 |
+
}
|
635 |
+
|
636 |
+
function clearCompletedTasks() {
|
637 |
+
tasks = tasks.filter(task => !task.completed);
|
638 |
+
saveTasks();
|
639 |
+
renderTasks();
|
640 |
+
}
|
641 |
+
|
642 |
+
function updateStats() {
|
643 |
+
const total = tasks.length;
|
644 |
+
const completed = tasks.filter(task => task.completed).length;
|
645 |
+
const progress = total > 0 ? Math.round((completed / total) * 100) : 0;
|
646 |
+
|
647 |
+
totalTasksSpan.textContent = total;
|
648 |
+
completedTasksSpan.textContent = completed;
|
649 |
+
progressFill.style.width = `${progress}%`;
|
650 |
+
}
|
651 |
+
|
652 |
+
function saveTasks() {
|
653 |
+
localStorage.setItem('tasks', JSON.stringify(tasks));
|
654 |
+
}
|
655 |
+
|
656 |
+
function toggleTheme() {
|
657 |
+
document.body.classList.toggle('dark-mode');
|
658 |
+
const isDark = document.body.classList.contains('dark-mode');
|
659 |
+
localStorage.setItem('darkMode', isDark);
|
660 |
+
|
661 |
+
if (isDark) {
|
662 |
+
themeToggle.innerHTML = '<i class="fas fa-sun"></i>';
|
663 |
+
} else {
|
664 |
+
themeToggle.innerHTML = '<i class="fas fa-moon"></i>';
|
665 |
+
}
|
666 |
+
}
|
667 |
+
});
|
668 |
+
</script>
|
669 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">This website has been generated by <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
|
670 |
+
</html>
|