notes-web / index.html
pablo15364136's picture
fais en sorte qu'on puisse importer n'importe quel fichier (bouton) - Follow Up Deployment
1e9111d verified
Raw History Blame Contribute Delete
22.2 kB
<!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>