-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
763 lines (670 loc) · 23 KB
/
index.html
File metadata and controls
763 lines (670 loc) · 23 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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive To-Do List</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
background: var(--bg-gradient);
min-height: 100vh;
cursor: none;
overflow-x: hidden;
transition: background 0.5s ease;
}
/* Theme Variables */
:root[data-theme="default"] {
--bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--card-bg: rgba(255, 255, 255, 0.95);
--text-primary: #333;
--text-secondary: #888;
--accent-color: #667eea;
--accent-hover: #5a6fd8;
--delete-color: #ff6b6b;
--delete-hover: #ff5252;
--border-color: #e0e0e0;
--completed-bg: rgba(102, 126, 234, 0.1);
}
:root[data-theme="forest"] {
--bg-gradient: linear-gradient(135deg, #2C0F12 0%, #141E30 25%, #28623A 75%, #134E5E 100%);
--card-bg: rgba(255, 255, 255, 0.95);
--text-primary: #2d3748;
--text-secondary: #718096;
--accent-color: #28623A;
--accent-hover: #22543d;
--delete-color: #e53e3e;
--delete-hover: #c53030;
--border-color: #e2e8f0;
--completed-bg: rgba(40, 98, 58, 0.1);
}
:root[data-theme="ocean"] {
--bg-gradient: linear-gradient(135deg, #134E5E 0%, #71B280 100%);
--card-bg: rgba(255, 255, 255, 0.95);
--text-primary: #2d3748;
--text-secondary: #718096;
--accent-color: #134E5E;
--accent-hover: #0f3a47;
--delete-color: #e53e3e;
--delete-hover: #c53030;
--border-color: #e2e8f0;
--completed-bg: rgba(19, 78, 94, 0.1);
}
:root[data-theme="sunset"] {
--bg-gradient: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
--card-bg: rgba(255, 255, 255, 0.95);
--text-primary: #2d3748;
--text-secondary: #718096;
--accent-color: #ff7e5f;
--accent-hover: #ff6b47;
--delete-color: #e53e3e;
--delete-hover: #c53030;
--border-color: #e2e8f0;
--completed-bg: rgba(255, 126, 95, 0.1);
}
/* Custom Cursor - Octagon */
.cursor {
position: fixed;
width: 20px;
height: 20px;
pointer-events: none;
z-index: 9999;
transition: transform 0.1s ease-out;
}
.cursor-octagon {
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.8);
clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
}
.cursor-dot {
width: 4px;
height: 4px;
background: #333;
border-radius: 50%;
}
/* Theme Selector */
.theme-selector {
position: fixed;
top: 2rem;
right: 2rem;
z-index: 1000;
display: flex;
gap: 0.5rem;
background: rgba(255, 255, 255, 0.2);
padding: 0.5rem;
border-radius: 15px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
}
.theme-option {
width: 30px;
height: 30px;
border-radius: 50%;
border: 2px solid rgba(255, 255, 255, 0.5);
cursor: pointer;
transition: all 0.3s ease;
position: relative;
}
.theme-option.active {
border-color: white;
transform: scale(1.1);
}
.theme-option.active::after {
content: '✓';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 0.8rem;
font-weight: bold;
}
.theme-default { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.theme-forest { background: linear-gradient(135deg, #2C0F12 0%, #141E30 25%, #28623A 75%, #134E5E 100%); }
.theme-ocean { background: linear-gradient(135deg, #134E5E 0%, #71B280 100%); }
.theme-sunset { background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); }
/* Main Container */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
min-height: 100vh;
}
/* Header */
.header {
text-align: center;
margin-bottom: 3rem;
color: white;
}
.header h1 {
font-size: 3rem;
font-weight: 700;
margin-bottom: 0.5rem;
text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.header p {
font-size: 1.2rem;
font-weight: 300;
opacity: 0.9;
}
/* Add Section Button */
.add-section-btn {
background: rgba(255, 255, 255, 0.2);
border: 2px solid rgba(255, 255, 255, 0.3);
color: white;
padding: 1rem 2rem;
border-radius: 50px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
margin-bottom: 2rem;
display: block;
margin-left: auto;
margin-right: auto;
}
.add-section-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
/* Sections Grid */
.sections-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
gap: 2rem;
}
/* Section Card */
.section-card {
background: var(--card-bg);
border-radius: 20px;
padding: 2rem;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.section-card:hover {
transform: translateY(-5px);
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 2px solid var(--border-color);
}
.section-title {
font-size: 1.5rem;
font-weight: 600;
color: var(--text-primary);
background: none;
border: none;
outline: none;
flex: 1;
margin-right: 1rem;
}
.section-title:focus {
color: var(--accent-color);
}
.delete-section {
background: var(--delete-color);
border: none;
color: white;
width: 30px;
height: 30px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
font-size: 1rem;
}
.delete-section:hover {
background: var(--delete-hover);
transform: scale(1.1);
}
/* Add Task Form */
.add-task-form {
display: flex;
gap: 0.5rem;
margin-bottom: 1.5rem;
}
.task-input {
flex: 1;
padding: 0.75rem 1rem;
border: 2px solid var(--border-color);
border-radius: 10px;
font-size: 1rem;
outline: none;
transition: all 0.3s ease;
background: rgba(255, 255, 255, 0.8);
color: var(--text-primary);
}
.task-input:focus {
border-color: var(--accent-color);
background: white;
box-shadow: 0 0 0 3px rgba(var(--accent-color), 0.1);
}
.add-task-btn {
padding: 0.75rem 1.5rem;
background: var(--accent-color);
color: white;
border: none;
border-radius: 10px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
font-size: 1rem;
}
.add-task-btn:hover {
background: var(--accent-hover);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(var(--accent-color), 0.4);
}
/* Tasks List */
.tasks-list {
max-height: 300px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: var(--accent-color) transparent;
}
.tasks-list::-webkit-scrollbar {
width: 6px;
}
.tasks-list::-webkit-scrollbar-track {
background: transparent;
}
.tasks-list::-webkit-scrollbar-thumb {
background: var(--accent-color);
border-radius: 10px;
}
.task-item {
display: flex;
align-items: center;
gap: 1rem;
padding: 1rem;
background: rgba(255, 255, 255, 0.6);
border-radius: 10px;
margin-bottom: 0.5rem;
transition: all 0.3s ease;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.task-item:hover {
background: rgba(255, 255, 255, 0.8);
transform: translateX(5px);
}
.task-item.completed {
opacity: 0.6;
background: var(--completed-bg);
}
.task-item.completed .task-text {
text-decoration: line-through;
color: var(--text-secondary);
}
.task-checkbox {
width: 20px;
height: 20px;
border: 2px solid var(--accent-color);
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
background: white;
}
.task-checkbox.checked {
background: var(--accent-color);
color: white;
}
.task-text {
flex: 1;
font-size: 1rem;
color: var(--text-primary);
font-weight: 400;
}
.delete-task {
background: var(--delete-color);
border: none;
color: white;
width: 25px;
height: 25px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
font-size: 0.8rem;
opacity: 0;
}
.task-item:hover .delete-task {
opacity: 1;
}
.delete-task:hover {
background: var(--delete-hover);
transform: scale(1.1);
}
/* Empty state */
.empty-state {
text-align: center;
color: var(--text-secondary);
font-style: italic;
padding: 2rem;
}
/* Save Indicator */
.save-indicator {
position: fixed;
bottom: 2rem;
right: 2rem;
background: rgba(40, 167, 69, 0.9);
color: white;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 500;
opacity: 0;
transform: translateY(20px);
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
.save-indicator.show {
opacity: 1;
transform: translateY(0);
}
/* Responsive */
@media (max-width: 768px) {
.container {
padding: 1rem;
}
.header h1 {
font-size: 2rem;
}
.sections-grid {
grid-template-columns: 1fr;
}
.section-card {
padding: 1.5rem;
}
.theme-selector {
top: 1rem;
right: 1rem;
}
}
/* Smooth animations */
.fade-in {
animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.slide-in {
animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(-20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
</style>
</head>
<body>
<div class="cursor">
<div class="cursor-octagon">
<div class="cursor-dot"></div>
</div>
</div>
<!-- Theme Selector -->
<div class="theme-selector">
<div class="theme-option theme-default active" data-theme="default" title="Default Theme"></div>
<div class="theme-option theme-forest" data-theme="forest" title="Forest Theme"></div>
<div class="theme-option theme-ocean" data-theme="ocean" title="Ocean Theme"></div>
<div class="theme-option theme-sunset" data-theme="sunset" title="Sunset Theme"></div>
</div>
<!-- Save Indicator -->
<div class="save-indicator" id="saveIndicator">
✓ Saved automatically
</div>
<div class="container">
<header class="header">
<h1>Interactive To-Do Lists</h1>
<p>Organize your tasks with style and efficiency - Now with persistent storage!</p>
</header>
<button class="add-section-btn" onclick="addSection()">+ Add New Section</button>
<div class="sections-grid" id="sectionsGrid">
<!-- Sections will be dynamically added here -->
</div>
</div>
<script>
// Cursor following functionality - Octagon
const cursor = document.querySelector('.cursor');
let mouseX = 0;
let mouseY = 0;
document.addEventListener('mousemove', (e) => {
mouseX = e.clientX;
mouseY = e.clientY;
});
function updateCursor() {
cursor.style.left = mouseX - 10 + 'px';
cursor.style.top = mouseY - 10 + 'px';
requestAnimationFrame(updateCursor);
}
updateCursor();
// Local Storage Functions
function saveData() {
const data = {
sections: sections,
currentTheme: document.documentElement.getAttribute('data-theme') || 'default',
sectionCounter: sectionCounter
};
localStorage.setItem('todoListData', JSON.stringify(data));
showSaveIndicator();
}
function loadData() {
const savedData = localStorage.getItem('todoListData');
if (savedData) {
try {
const data = JSON.parse(savedData);
sections = data.sections || [];
sectionCounter = data.sectionCounter || 0;
// Apply saved theme
if (data.currentTheme) {
changeTheme(data.currentTheme);
}
return true;
} catch (e) {
console.error('Error loading saved data:', e);
}
}
return false;
}
function showSaveIndicator() {
const indicator = document.getElementById('saveIndicator');
indicator.classList.add('show');
setTimeout(() => {
indicator.classList.remove('show');
}, 2000);
}
// Theme Management
function changeTheme(themeName) {
document.documentElement.setAttribute('data-theme', themeName);
// Update theme selector
document.querySelectorAll('.theme-option').forEach(option => {
option.classList.remove('active');
});
document.querySelector(`[data-theme="${themeName}"]`).classList.add('active');
saveData();
}
// Theme selector event listeners
document.querySelectorAll('.theme-option').forEach(option => {
option.addEventListener('click', () => {
const theme = option.getAttribute('data-theme');
changeTheme(theme);
});
});
// To-Do List functionality
let sectionCounter = 0;
let sections = [];
function addSection() {
sectionCounter++;
const section = {
id: sectionCounter,
title: `Section ${sectionCounter}`,
tasks: []
};
sections.push(section);
renderSections();
saveData();
}
function deleteSection(sectionId) {
sections = sections.filter(section => section.id !== sectionId);
renderSections();
saveData();
}
function updateSectionTitle(sectionId, newTitle) {
const section = sections.find(s => s.id === sectionId);
if (section) {
section.title = newTitle;
saveData();
}
}
function addTask(sectionId) {
const input = document.getElementById(`task-input-${sectionId}`);
const taskText = input.value.trim();
if (taskText === '') return;
const section = sections.find(s => s.id === sectionId);
if (section) {
const task = {
id: Date.now(),
text: taskText,
completed: false
};
section.tasks.push(task);
input.value = '';
renderSections();
saveData();
}
}
function toggleTask(sectionId, taskId) {
const section = sections.find(s => s.id === sectionId);
if (section) {
const task = section.tasks.find(t => t.id === taskId);
if (task) {
task.completed = !task.completed;
renderSections();
saveData();
}
}
}
function deleteTask(sectionId, taskId) {
const section = sections.find(s => s.id === sectionId);
if (section) {
section.tasks = section.tasks.filter(t => t.id !== taskId);
renderSections();
saveData();
}
}
function renderSections() {
const sectionsGrid = document.getElementById('sectionsGrid');
sectionsGrid.innerHTML = '';
sections.forEach(section => {
const sectionElement = document.createElement('div');
sectionElement.className = 'section-card fade-in';
sectionElement.innerHTML = `
<div class="section-header">
<input
type="text"
class="section-title"
value="${section.title}"
onchange="updateSectionTitle(${section.id}, this.value)"
placeholder="Section Title"
>
<button class="delete-section" onclick="deleteSection(${section.id})">×</button>
</div>
<div class="add-task-form">
<input
type="text"
class="task-input"
id="task-input-${section.id}"
placeholder="Add a new task..."
onkeypress="if(event.key==='Enter') addTask(${section.id})"
>
<button class="add-task-btn" onclick="addTask(${section.id})">Add</button>
</div>
<div class="tasks-list">
${section.tasks.length === 0 ?
'<div class="empty-state">No tasks yet. Add one above!</div>' :
section.tasks.map(task => `
<div class="task-item ${task.completed ? 'completed' : ''} slide-in">
<div class="task-checkbox ${task.completed ? 'checked' : ''}"
onclick="toggleTask(${section.id}, ${task.id})">
${task.completed ? '✓' : ''}
</div>
<span class="task-text">${task.text}</span>
<button class="delete-task" onclick="deleteTask(${section.id}, ${task.id})">×</button>
</div>
`).join('')
}
</div>
`;
sectionsGrid.appendChild(sectionElement);
});
}
// Initialize application
document.addEventListener('DOMContentLoaded', function() {
// Load saved data or initialize with default section
if (!loadData()) {
addSection();
} else {
renderSections();
}
console.log('Interactive To-Do List with persistence loaded successfully!');
});
// Auto-save on page unload
window.addEventListener('beforeunload', function() {
saveData();
});
// Periodic auto-save (every 30 seconds)
setInterval(saveData, 30000);
// Hide default cursor on interactive elements
document.addEventListener('DOMContentLoaded', function() {
const style = document.createElement('style');
style.textContent = `
button, input, .task-item, .task-checkbox, .theme-option {
cursor: none !important;
}
`;
document.head.appendChild(style);
});
</script>
</body>
</html>