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
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
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MemoText - Sauvegardez vos notes</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        /* Animation pour les boutons */
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        .pulse:hover {
            animation: pulse 1.5s infinite;
        }
        
        /* Transition douce pour le fond */
        .bg-gradient {
            transition: background 0.5s ease;
        }
        
        /* Style personnalisé pour la zone de texte */
        .custom-textarea {
            min-height: 300px;
            resize: none;
            scrollbar-width: thin;
            scrollbar-color: #4F46E5 #E5E7EB;
        }
        
        .custom-textarea::-webkit-scrollbar {
            width: 8px;
        }
        
        .custom-textarea::-webkit-scrollbar-track {
            background: #E5E7EB;
            border-radius: 10px;
        }
        
        .custom-textarea::-webkit-scrollbar-thumb {
            background-color: #4F46E5;
            border-radius: 10px;
        }
    </style>
</head>
<body class="bg-gradient-to-br from-indigo-50 to-purple-50 min-h-screen">
    <div class="container mx-auto px-4 py-8 max-w-4xl">
        <!-- En-tête -->
        <header class="text-center mb-10">
            <h1 class="text-4xl md:text-5xl font-bold text-indigo-800 mb-3">
                <i class="fas fa-book-open mr-3"></i>MemoText
            </h1>
            <p class="text-lg text-gray-600">Votre espace sécurisé pour sauvegarder du texte</p>
        </header>

        <!-- Zone principale -->
        <div class="bg-white rounded-xl shadow-xl overflow-hidden">
            <!-- Barre d'outils -->
            <div class="bg-indigo-600 px-6 py-4 flex justify-between items-center">
                <div class="flex items-center space-x-4">
                    <h2 class="text-xl font-semibold text-white">
                        <i class="fas fa-edit mr-2"></i>Votre note
                    </h2>
                    <input id="noteTitle" type="text" placeholder="Nom de la note" class="bg-indigo-700 text-white px-3 py-1 rounded-md border border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-300 w-40">
                    <select id="noteSelector" class="bg-indigo-700 text-white px-3 py-1 rounded-md border border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-300">
                        <option value="new">Nouvelle note</option>
                    </select>
                </div>
                <div class="flex space-x-3 items-center">
                    <div class="relative">
                        <input id="searchInput" type="text" placeholder="Rechercher..." class="bg-indigo-700 text-white px-3 py-1 rounded-md border border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-300 w-40">
                        <button id="searchBtn" class="absolute right-2 top-1/2 transform -translate-y-1/2 text-indigo-200 hover:text-white">
                            <i class="fas fa-search"></i>
                        </button>
                    </div>
                    <button id="saveBtn" class="bg-white text-indigo-600 px-4 py-2 rounded-lg font-medium hover:bg-indigo-50 transition duration-200 pulse">
                        <i class="fas fa-save mr-2"></i>Sauvegarder
                    </button>
                    <button id="importBtn" class="bg-indigo-700 text-white px-4 py-2 rounded-lg font-medium hover:bg-indigo-800 transition duration-200">
                        <i class="fas fa-file-import mr-2"></i>Importer un fichier
                    </button>
                    <button id="deleteBtn" class="bg-red-600 text-white px-4 py-2 rounded-lg font-medium hover:bg-red-700 transition duration-200">
                        <i class="fas fa-trash mr-2"></i>Supprimer
                    </button>
                    <button id="clearBtn" class="bg-indigo-800 text-white px-4 py-2 rounded-lg font-medium hover:bg-indigo-900 transition duration-200">
                        <i class="fas fa-broom mr-2"></i>Effacer
                    </button>
                </div>
            </div>
            
            <!-- Zone de texte -->
            <div class="p-6">
                <textarea id="noteArea" class="custom-textarea w-full px-4 py-3 border-2 border-gray-200 rounded-lg focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 outline-none transition duration-200 text-gray-700" placeholder="Écrivez ici votre texte important..."></textarea>
            </div>
            
            <!-- Pied de page avec statistiques -->
            <div class="bg-gray-50 px-6 py-4 border-t border-gray-200 flex justify-between items-center">
                <div class="text-sm text-gray-500">
                    <span id="charCount">0</span> caractères | 
                    <span id="wordCount">0</span> mots
                </div>
                <div class="text-sm text-gray-500">
                    Dernière sauvegarde: <span id="lastSaved">jamais</span>
                </div>
            </div>
        </div>
        
        <!-- Section des notes sauvegardées -->
        <div class="mt-8 bg-white rounded-xl shadow-xl p-6">
            <div class="flex justify-between items-center mb-4">
                <h3 class="text-xl font-semibold text-indigo-800 flex items-center">
                    <i class="fas fa-bookmark mr-2"></i>Vos notes sauvegardées
                </h3>
                <div class="flex space-x-2">
                    <button id="importExcelBtn" class="bg-green-600 text-white px-3 py-1 rounded-lg text-sm hover:bg-green-700 transition">
                        <i class="fas fa-file-excel mr-1"></i>Importer Excel
                    </button>
                    <button id="deleteNoteBtn" class="bg-red-600 text-white px-3 py-1 rounded-lg text-sm hover:bg-red-700 transition">
                        <i class="fas fa-trash mr-1"></i>Supprimer
                    </button>
                </div>
            </div>
            <div id="notesGrid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
                <!-- Les notes seront ajoutées ici dynamiquement -->
            </div>
        </div>

        <!-- Section d'information -->
        <div class="mt-8 bg-indigo-100 rounded-xl p-6">
            <h3 class="text-xl font-semibold text-indigo-800 mb-3 flex items-center">
                <i class="fas fa-info-circle mr-2"></i>Comment ça marche?
            </h3>
            <p class="text-gray-700 mb-4">
                MemoText sauvegarde automatiquement votre texte dans le stockage local de votre navigateur. Même si vous fermez la page, vos notes seront toujours là quand vous reviendrez!
            </p>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                <div class="bg-white p-4 rounded-lg shadow">
                    <h4 class="font-medium text-indigo-700 mb-2 flex items-center">
                        <i class="fas fa-shield-alt mr-2"></i>Sécurité
                    </h4>
                    <p class="text-sm text-gray-600">
                        Vos données restent uniquement sur votre appareil. Nous ne les collectons pas.
                    </p>
                </div>
                <div class="bg-white p-4 rounded-lg shadow">
                    <h4 class="font-medium text-indigo-700 mb-2 flex items-center">
                        <i class="fas fa-mobile-alt mr-2"></i>Accessibilité
                    </h4>
                    <p class="text-sm text-gray-600">
                        Utilisable sur tous vos appareils. Conçu pour être responsive.
                    </p>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const noteArea = document.getElementById('noteArea');
            const saveBtn = document.getElementById('saveBtn');
            const clearBtn = document.getElementById('clearBtn');
            const charCount = document.getElementById('charCount');
            const wordCount = document.getElementById('wordCount');
            const lastSaved = document.getElementById('lastSaved');
            
            // Gestion des notes multiples
            let notes = JSON.parse(localStorage.getItem('memoTextNotes')) || {};
            let currentNoteId = null;
            
            // Mettre à jour le sélecteur de notes et la grille
            function updateNoteSelector() {
                const selector = document.getElementById('noteSelector');
                const notesGrid = document.getElementById('notesGrid');
                
                selector.innerHTML = '<option value="new">Nouvelle note</option>';
                notesGrid.innerHTML = '';
                
                for (const id in notes) {
                    const note = notes[id];
                    
                    // Mise à jour du sélecteur
                    const option = document.createElement('option');
                    option.value = id;
                    option.textContent = note.title || `Note ${id.substring(0, 4)}`;
                    selector.appendChild(option);
                    
                    // Ajout à la grille
                    const noteCard = document.createElement('div');
                    noteCard.className = 'bg-gray-50 p-4 rounded-lg border border-gray-200 hover:border-indigo-300 transition cursor-pointer';
                    noteCard.innerHTML = `
                        <h4 class="font-medium text-indigo-700 truncate">${note.title || 'Sans titre'}</h4>
                        <p class="text-sm text-gray-500 mt-1 truncate">${note.content.substring(0, 50)}${note.content.length > 50 ? '...' : ''}</p>
                        <div class="flex justify-between items-center mt-3 text-xs text-gray-400">
                            <span>${new Date(note.timestamp).toLocaleDateString()}</span>
                            <span>${note.content.length} caractères</span>
                        </div>
                    `;
                    noteCard.addEventListener('click', () => {
                        document.getElementById('noteSelector').value = id;
                        loadNote(id);
                        document.getElementById('noteTitle').value = note.title || '';
                    });
                    notesGrid.appendChild(noteCard);
                }
            }
            
            // Charger une note
            function loadNote(id) {
                if (id === 'new') {
                    noteArea.value = '';
                    document.getElementById('noteTitle').value = '';
                    currentNoteId = null;
                    lastSaved.textContent = 'jamais';
                } else if (notes[id]) {
                    noteArea.value = notes[id].content;
                    document.getElementById('noteTitle').value = notes[id].title || '';
                    currentNoteId = id;
                    lastSaved.textContent = new Date(notes[id].timestamp).toLocaleString();
                }
                updateCounts();
            }
            
            updateNoteSelector();
            
            // Mettre à jour les compteurs
            function updateCounts() {
                const text = noteArea.value;
                charCount.textContent = text.length;
                wordCount.textContent = text.trim() === '' ? 0 : text.trim().split(/\s+/).length;
            }
            
            // Sauvegarder la note
            function saveNote() {
                if (!currentNoteId) {
                    currentNoteId = Date.now().toString();
                }
                
                const noteTitle = document.getElementById('noteTitle').value.trim();
                notes[currentNoteId] = {
                    content: noteArea.value,
                    timestamp: Date.now(),
                    title: noteTitle || noteArea.value.substring(0, 30) || 'Sans titre'
                };
                
                localStorage.setItem('memoTextNotes', JSON.stringify(notes));
                lastSaved.textContent = new Date().toLocaleString();
                updateNoteSelector();
                
                // Animation de confirmation
                saveBtn.innerHTML = '<i class="fas fa-check mr-2"></i>Sauvegardé!';
                saveBtn.classList.remove('bg-white', 'text-indigo-600');
                saveBtn.classList.add('bg-green-500', 'text-white');
                
                setTimeout(() => {
                    saveBtn.innerHTML = '<i class="fas fa-save mr-2"></i>Sauvegarder';
                    saveBtn.classList.remove('bg-green-500', 'text-white');
                    saveBtn.classList.add('bg-white', 'text-indigo-600');
                }, 2000);
            }
            
            // Effacer la note
            function clearNote() {
                if (currentNoteId && confirm('Voulez-vous vraiment supprimer cette note?')) {
                    delete notes[currentNoteId];
                    localStorage.setItem('memoTextNotes', JSON.stringify(notes));
                    loadNote('new');
                    updateNoteSelector();
                } else if (!currentNoteId) {
                    noteArea.value = '';
                    updateCounts();
                }
            }
            
            // Fonction d'importation
            function importNote() {
                const input = document.createElement('input');
                input.type = 'file';
                
                input.onchange = e => {
                    const file = e.target.files[0];
                    const reader = new FileReader();
                    
                    reader.onload = event => {
                        try {
                            noteArea.value = event.target.result;
                            updateCounts();
                        } catch (error) {
                            alert("Impossible de lire le contenu du fichier. Il peut s'agir d'un format binaire.");
                        }
                    };
                    
                    try {
                        reader.readAsText(file);
                    } catch (error) {
                        alert("Erreur lors de la lecture du fichier. Format non supporté.");
                    }
                };
                
                input.click();
            }

            // Fonction pour supprimer la note
            function deleteNote() {
                if (currentNoteId && confirm('Voulez-vous vraiment supprimer définitivement cette note?')) {
                    delete notes[currentNoteId];
                    localStorage.setItem('memoTextNotes', JSON.stringify(notes));
                    loadNote('new');
                    updateNoteSelector();
                    
                    // Animation de confirmation
                    deleteBtn.innerHTML = '<i class="fas fa-check mr-2"></i>Supprimé!';
                    deleteBtn.classList.remove('bg-red-600');
                    deleteBtn.classList.add('bg-green-500');
                    
                    setTimeout(() => {
                        deleteBtn.innerHTML = '<i class="fas fa-trash mr-2"></i>Supprimer';
                        deleteBtn.classList.remove('bg-green-500');
                        deleteBtn.classList.add('bg-red-600');
                    }, 2000);
                }
            }

            // Importer depuis Excel
            function importFromExcel() {
                const input = document.createElement('input');
                input.type = 'file';
                input.accept = '.xlsx,.xls,.csv';
                
                input.onchange = e => {
                    const file = e.target.files[0];
                    const reader = new FileReader();
                    
                    reader.onload = event => {
                        // Ici vous pourriez ajouter la logique pour parser le fichier Excel
                        // Pour l'exemple, nous affichons juste une alerte
                        alert('Fonctionnalité d\'import Excel à implémenter');
                    };
                    
                    reader.readAsArrayBuffer(file);
                };
                
                input.click();
            }

            // Supprimer une note spécifique
            function deleteSpecificNote() {
                if (!currentNoteId) {
                    alert('Veuillez sélectionner une note à supprimer');
                    return;
                }

                if (confirm(`Voulez-vous vraiment supprimer la note "${notes[currentNoteId].title || 'Sans titre'}"?`)) {
                    delete notes[currentNoteId];
                    localStorage.setItem('memoTextNotes', JSON.stringify(notes));
                    loadNote('new');
                    updateNoteSelector();
                    
                    // Animation de confirmation
                    deleteNoteBtn.innerHTML = '<i class="fas fa-check mr-1"></i>Supprimé!';
                    deleteNoteBtn.classList.remove('bg-red-600');
                    deleteNoteBtn.classList.add('bg-green-500');
                    
                    setTimeout(() => {
                        deleteNoteBtn.innerHTML = '<i class="fas fa-trash mr-1"></i>Supprimer';
                        deleteNoteBtn.classList.remove('bg-green-500');
                        deleteNoteBtn.classList.add('bg-red-600');
                    }, 2000);
                }
            }

            // Fonction de recherche
            function searchInNote() {
                const searchTerm = document.getElementById('searchInput').value.trim();
                if (!searchTerm) return;
                
                const text = noteArea.value;
                const regex = new RegExp(searchTerm, 'gi');
                const highlightedText = text.replace(regex, match => `<span class="bg-yellow-200">${match}</span>`);
                
                // Créer un div temporaire pour afficher le texte avec surlignage
                const tempDiv = document.createElement('div');
                tempDiv.innerHTML = highlightedText;
                tempDiv.style.whiteSpace = 'pre-wrap';
                
                // Remplacer le textarea par le div temporaire
                noteArea.style.display = 'none';
                noteArea.parentNode.insertBefore(tempDiv, noteArea);
                
                // Bouton pour revenir à l'édition
                const backBtn = document.createElement('button');
                backBtn.className = 'mt-2 bg-indigo-600 text-white px-3 py-1 rounded text-sm';
                backBtn.innerHTML = '<i class="fas fa-times mr-1"></i>Retour à l\'édition';
                backBtn.addEventListener('click', () => {
                    tempDiv.remove();
                    backBtn.remove();
                    noteArea.style.display = 'block';
                });
                tempDiv.parentNode.insertBefore(backBtn, tempDiv.nextSibling);
            }
            
            // Événements
            noteArea.addEventListener('input', updateCounts);
            document.getElementById('searchBtn').addEventListener('click', searchInNote);
            document.getElementById('searchInput').addEventListener('keypress', (e) => {
                if (e.key === 'Enter') searchInNote();
            });
            document.getElementById('importBtn').addEventListener('click', importNote);
            saveBtn.addEventListener('click', saveNote);
            clearBtn.addEventListener('click', clearNote);
            document.getElementById('noteSelector').addEventListener('change', function() {
                loadNote(this.value);
            });
            document.getElementById('deleteBtn').addEventListener('click', deleteNote);
            document.getElementById('importExcelBtn').addEventListener('click', importFromExcel);
            document.getElementById('deleteNoteBtn').addEventListener('click', deleteSpecificNote);
            
            // Sauvegarde automatique toutes les 30 secondes
            setInterval(() => {
                if (noteArea.value !== localStorage.getItem('memoText')) {
                    saveNote();
                }
            }, 30000);
            
            // Changement de couleur de fond aléatoire
            const colors = [
                'from-indigo-50 to-purple-50',
                'from-blue-50 to-indigo-50',
                'from-purple-50 to-pink-50',
                'from-cyan-50 to-blue-50',
                'from-emerald-50 to-teal-50'
            ];
            
            document.body.classList.add('bg-gradient');
            let currentColor = 0;
            
            setInterval(() => {
                document.body.classList.remove(...colors);
                currentColor = (currentColor + 1) % colors.length;
                document.body.classList.add(colors[currentColor]);
            }, 15000);
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://deepsite.hf.co/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=pablo15364136/notes-web" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>