Spaces:
Running
Running
File size: 23,677 Bytes
30ee50f |
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 |
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notizblock App</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary-color: #4f46e5;
--primary-light: #818cf8;
--primary-dark: #3730a3;
--secondary-color: #f3f4f6;
--text-color: #1f2937;
--text-light: #6b7280;
--success-color: #10b981;
--warning-color: #f59e0b;
--danger-color: #ef4444;
--border-color: #e5e7eb;
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--radius: 8px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
color: var(--text-color);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 0;
margin-bottom: 30px;
border-bottom: 2px solid var(--border-color);
}
.header h1 {
font-size: 2.5rem;
background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
display: flex;
align-items: center;
gap: 10px;
}
.header h1 i {
font-size: 2.2rem;
}
.header .anycoder {
color: var(--text-light);
font-size: 0.9rem;
text-decoration: none;
transition: color 0.3s;
}
.header .anycoder:hover {
color: var(--primary-color);
}
.app-container {
display: grid;
grid-template-columns: 300px 1fr;
gap: 30px;
}
@media (max-width: 768px) {
.app-container {
grid-template-columns: 1fr;
}
}
.sidebar {
background: white;
border-radius: var(--radius);
padding: 25px;
box-shadow: var(--shadow);
height: fit-content;
}
.note-form {
margin-bottom: 30px;
}
.note-form h2 {
margin-bottom: 15px;
font-size: 1.3rem;
color: var(--primary-color);
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: 500;
}
.form-group input,
.form-group textarea,
.form-group select {
width: 100%;
padding: 10px;
border: 1px solid var(--border-color);
border-radius: var(--radius);
font-size: 1rem;
transition: border-color 0.3s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
outline: none;
border-color: var(--primary-color);
}
.form-group textarea {
min-height: 120px;
resize: vertical;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: var(--radius);
cursor: pointer;
font-weight: 600;
transition: all 0.3s;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.btn-primary {
background: var(--primary-color);
color: white;
}
.btn-primary:hover {
background: var(--primary-dark);
}
.btn-danger {
background: var(--danger-color);
color: white;
}
.btn-danger:hover {
background: #dc2626;
}
.btn-success {
background: var(--success-color);
color: white;
}
.btn-success:hover {
background: #059669;
}
.btn-full {
width: 100%;
}
.filter-section {
margin-top: 25px;
}
.filter-section h3 {
margin-bottom: 15px;
font-size: 1.1rem;
color: var(--primary-color);
}
.filter-options {
display: flex;
flex-direction: column;
gap: 10px;
}
.filter-option {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
border-radius: var(--radius);
cursor: pointer;
transition: background 0.3s;
}
.filter-option:hover {
background: var(--secondary-color);
}
.filter-option.active {
background: var(--primary-light);
color: white;
}
.notes-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 20px;
}
.note-card {
background: white;
border-radius: var(--radius);
padding: 20px;
box-shadow: var(--shadow);
transition: transform 0.3s, box-shadow 0.3s;
position: relative;
overflow: hidden;
}
.note-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.note-card.pinned::before {
content: '';
position: absolute;
top: 10px;
right: 10px;
width: 20px;
height: 20px;
background: var(--warning-color);
border-radius: 50%;
}
.note-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 10px;
}
.note-title {
font-size: 1.2rem;
font-weight: 600;
color: var(--primary-color);
margin-right: 10px;
word-break: break-word;
}
.note-category {
display: inline-block;
padding: 4px 8px;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 500;
background: var(--secondary-color);
}
.note-content {
margin-bottom: 15px;
color: var(--text-color);
line-height: 1.5;
word-break: break-word;
}
.note-footer {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid var(--border-color);
}
.note-date {
font-size: 0.8rem;
color: var(--text-light);
}
.note-actions {
display: flex;
gap: 8px;
}
.note-actions button {
background: none;
border: none;
cursor: pointer;
font-size: 1rem;
color: var(--text-light);
transition: color 0.3s;
padding: 5px;
}
.note-actions button:hover {
color: var(--primary-color);
}
.empty-state {
grid-column: 1 / -1;
text-align: center;
padding: 60px 20px;
color: var(--text-light);
}
.empty-state i {
font-size: 4rem;
margin-bottom: 20px;
color: var(--border-color);
}
.empty-state h3 {
font-size: 1.5rem;
margin-bottom: 10px;
}
.search-bar {
margin-bottom: 20px;
position: relative;
}
.search-bar input {
width: 100%;
padding: 12px 15px 12px 45px;
border: 1px solid var(--border-color);
border-radius: var(--radius);
font-size: 1rem;
transition: border-color 0.3s;
}
.search-bar input:focus {
outline: none;
border-color: var(--primary-color);
}
.search-bar i {
position: absolute;
left: 15px;
top: 50%;
transform: translateY(-50%);
color: var(--text-light);
}
.category-work { background: #e0f2fe; color: #0369a1; }
.category-personal { background: #f0fdf4; color: #15803d; }
.category-ideas { background: #fef7cd; color: #a16207; }
.category-todo { background: #fef2f2; color: #dc2626; }
.category-other { background: #f3f4f6; color: #4b5563; }
.stats {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
padding: 15px;
background: white;
border-radius: var(--radius);
box-shadow: var(--shadow);
}
.stat-item {
text-align: center;
}
.stat-number {
font-size: 1.8rem;
font-weight: 700;
color: var(--primary-color);
}
.stat-label {
font-size: 0.9rem;
color: var(--text-light);
}
@media (max-width: 480px) {
.header {
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
.notes-grid {
grid-template-columns: 1fr;
}
.stats {
flex-direction: column;
gap: 15px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1><i class="fas fa-sticky-note"></i> Notizblock App</h1>
<a href="https://huggingface.co/spaces/akhaliq/anycoder" class="anycoder">Built with anycoder</a>
</div>
<div class="app-container">
<div class="sidebar">
<div class="note-form">
<h2>Neue Notiz</h2>
<div class="form-group">
<label for="note-title">Titel</label>
<input type="text" id="note-title" placeholder="Titel der Notiz">
</div>
<div class="form-group">
<label for="note-content">Inhalt</label>
<textarea id="note-content" placeholder="Notizinhalt..."></textarea>
</div>
<div class="form-group">
<label for="note-category">Kategorie</label>
<select id="note-category">
<option value="personal">Persönlich</option>
<option value="work">Arbeit</option>
<option value="ideas">Ideen</option>
<option value="todo">Aufgaben</option>
<option value="other">Sonstiges</option>
</select>
</div>
<div class="form-group">
<label>
<input type="checkbox" id="note-pinned">
Notiz anheften
</label>
</div>
<button class="btn btn-primary btn-full" id="save-note">
<i class="fas fa-save"></i> Notiz speichern
</button>
</div>
<div class="filter-section">
<h3>Filter</h3>
<div class="filter-options">
<div class="filter-option active" data-filter="all">
<i class="fas fa-list"></i> Alle Notizen
</div>
<div class="filter-option" data-filter="personal">
<i class="fas fa-user"></i> Persönlich
</div>
<div class="filter-option" data-filter="work">
<i class="fas fa-briefcase"></i> Arbeit
</div>
<div class="filter-option" data-filter="ideas">
<i class="fas fa-lightbulb"></i> Ideen
</div>
<div class="filter-option" data-filter="todo">
<i class="fas fa-tasks"></i> Aufgaben
</div>
<div class="filter-option" data-filter="pinned">
<i class="fas fa-thumbtack"></i> Angeheftet
</div>
</div>
</div>
</div>
<div class="main-content">
<div class="search-bar">
<i class="fas fa-search"></i>
<input type="text" id="search-input" placeholder="Notizen durchsuchen...">
</div>
<div class="stats">
<div class="stat-item">
<div class="stat-number" id="total-notes">0</div>
<div class="stat-label">Notizen</div>
</div>
<div class="stat-item">
<div class="stat-number" id="pinned-notes">0</div>
<div class="stat-label">Angeheftet</div>
</div>
<div class="stat-item">
<div class="stat-number" id="categories-count">0</div>
<div class="stat-label">Kategorien</div>
</div>
</div>
<div class="notes-grid" id="notes-container">
<!-- Notizen werden hier dynamisch eingefügt -->
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Elemente referenzieren
const noteTitleInput = document.getElementById('note-title');
const noteContentInput = document.getElementById('note-content');
const noteCategorySelect = document.getElementById('note-category');
const notePinnedCheckbox = document.getElementById('note-pinned');
const saveNoteButton = document.getElementById('save-note');
const searchInput = document.getElementById('search-input');
const notesContainer = document.getElementById('notes-container');
const filterOptions = document.querySelectorAll('.filter-option');
const totalNotesElement = document.getElementById('total-notes');
const pinnedNotesElement = document.getElementById('pinned-notes');
const categoriesCountElement = document.getElementById('categories-count');
// Notizen aus dem localStorage laden oder leeres Array erstellen
let notes = JSON.parse(localStorage.getItem('notes')) || [];
let currentFilter = 'all';
let searchQuery = '';
// Funktion zum Speichern der Notizen im localStorage
function saveNotesToStorage() {
localStorage.setItem('notes', JSON.stringify(notes));
}
// Funktion zum Hinzufügen einer neuen Notiz
function addNote() {
const title = noteTitleInput.value.trim();
const content = noteContentInput.value.trim();
const category = noteCategorySelect.value;
const pinned = notePinnedCheckbox.checked;
const date = new Date().toLocaleDateString('de-DE');
if (title === '' || content === '') {
alert('Bitte geben Sie einen Titel und Inhalt für die Notiz ein.');
return;
}
const newNote = {
id: Date.now(),
title,
content,
category,
pinned,
date
};
notes.unshift(newNote);
saveNotesToStorage();
renderNotes();
// Formular zurücksetzen
noteTitleInput.value = '';
noteContentInput.value = '';
notePinnedCheckbox.checked = false;
}
// Funktion zum Löschen einer Notiz
function deleteNote(id) {
if (confirm('Möchten Sie diese Notiz wirklich löschen?')) {
notes = notes.filter(note => note.id !== id);
saveNotesToStorage();
renderNotes();
}
}
// Funktion zum Bearbeiten einer Notiz
function editNote(id) {
const note = notes.find(note => note.id === id);
if (note) {
noteTitleInput.value = note.title;
noteContentInput.value = note.content;
noteCategorySelect.value = note.category;
notePinnedCheckbox.checked = note.pinned;
// Nach dem Bearbeiten die Notiz löschen
deleteNote(id);
}
// Funktion zum Anheften/Abheften einer Notiz
function togglePin(id) {
const note = notes.find(note => note.id === id);
if (note) {
note.pinned = !note.pinned;
saveNotesToStorage();
renderNotes();
}
}
// Funktion zum Rendern der Notizen
function renderNotes() {
let filteredNotes = notes;
// Filter anwenden
if (currentFilter !== 'all') {
if (currentFilter === 'pinned') {
filteredNotes = notes.filter(note => note.pinned);
} else {
filteredNotes = notes.filter(note => note.category === currentFilter);
}
// Suche anwenden
if (searchQuery) {
const query = searchQuery.toLowerCase();
filteredNotes = filteredNotes.filter(note =>
note.title.toLowerCase().includes(query) ||
note.content.toLowerCase().includes(query)
);
}
// Statistik aktualisieren
updateStats();
// Notizen in den Container rendern
if (filteredNotes.length === 0) {
notesContainer.innerHTML = `
<div class="empty-state">
<i class="fas fa-sticky-note"></i>
<h3>Keine Notizen gefunden</h3>
<p>Erstellen Sie Ihre erste Notiz oder ändern Sie Ihre Filtereinstellungen.</p>
</div>
`;
return;
}
// Sortieren: Angeheftete Notizen zuerst, dann nach Datum (neueste zuerst)
filteredNotes.sort((a, b) => {
if (a.pinned && !b.pinned) return -1;
if (!a.pinned && b.pinned) return 1;
return b.id - a.id;
});
notesContainer.innerHTML = filteredNotes.map(note => `
<div class="note-card ${note.pinned ? 'pinned' : ''}">
<div class="note-header">
<div class="note-title">${note.title}</div>
<span class="note-category category-${note.category}">
${getCategoryLabel(note.category)}
</span>
</div>
<div class="note-content">${note.content}</div>
<div class="note-footer">
<div class="note-date">${note.date}</div>
<div class="note-actions">
<button onclick="togglePin(${note.id})" title="${note.pinned ? 'Abheften' : 'Anheften'}">
<i class="fas fa-thumbtack"></i>
</button>
<button onclick="editNote(${note.id})" title="Bearbeiten">
<i class="fas fa-edit"></i>
</button>
<button onclick="deleteNote(${note.id})" title="Löschen">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
`).join('');
}
// Funktion zum Aktualisieren der Statistik
function updateStats() {
totalNotesElement.textContent = notes.length;
pinnedNotesElement.textContent = notes.filter(note => note.pinned).length;
const uniqueCategories = new Set(notes.map(note => note.category));
categoriesCountElement.textContent = uniqueCategories.size;
}
// Kategorielabel basierend auf Wert abrufen
function getCategoryLabel(category) {
const labels = {
'personal': 'Persönlich',
'work': 'Arbeit',
'ideas': 'Ideen',
'todo': 'Aufgaben',
'other': 'Sonstiges'
};
return labels[category] || 'Sonstiges';
}
// Event-Listener für das Speichern einer Notiz
saveNoteButton.addEventListener('click', addNote);
// Event-Listener für die Filteroptionen
filterOptions.forEach(option => {
option.addEventListener('click', function() {
// Aktive Klasse entfernen
filterOptions.forEach(opt => opt.classList.remove('active'));
// Aktive Klasse zur ausgewählten Option hinzufügen
this.classList.add('active');
// Filter aktualisieren
currentFilter = this.getAttribute('data-filter');
renderNotes();
});
});
// Event-Listener für die Suche
searchInput.addEventListener('input', function() {
searchQuery = this.value;
renderNotes();
});
// Funktionen global verfügbar machen
window.deleteNote = deleteNote;
window.editNote = editNote;
window.togglePin = togglePin;
// Beim Laden der Seite Notizen rendern
renderNotes();
});
</script>
</body>
</html> |