52 Matching Annotations
  1. Aug 2025
    1. Chargement du livre EPUB... Configuration des interactions... ⚠️ Erreur de chargement Impossible de charger le livre EPUB. Le fichier est peut-être corrompu ou dans un format non supporté. ← Retour au workflow let book = null; let rendition = null; let displayed = null; let currentFontSize = 18; function updateLoadingDetails(message) { document.getElementById('loading-details').textContent = message; console.log('📚 EPUB:', message); } async function loadEpubFromWorkflow() { try { updateLoadingDetails('Récupération des données du workflow...'); // Récupérer les données du workflow depuis localStorage const workflowData = localStorage.getItem('reading-social-workflow'); if (!workflowData) { throw new Error('Aucune donnée de workflow trouvée dans localStorage'); } const parsedData = JSON.parse(workflowData); console.log('📚 Workflow data found:', parsedData); if (!parsedData.book) { throw new Error('Aucun livre trouvé dans les données du workflow'); } const bookData = parsedData.book; if (bookData.type !== 'uploaded-epub') { throw new Error(`Type de livre incorrect: ${bookData.type}. Type attendu: uploaded-epub`); } if (!bookData.fileArrayBuffer) { throw new Error('Aucun ArrayBuffer trouvé dans les données du livre'); } updateLoadingDetails('Reconstruction de l\'ArrayBuffer du fichier EPUB...'); // Reconstruire l'ArrayBuffer depuis l'array stocké const uint8Array = new Uint8Array(bookData.fileArrayBuffer); const arrayBuffer = uint8Array.buffer; console.log('📚 ArrayBuffer reconstructed:', arrayBuffer.byteLength, 'bytes'); // Mettre à jour les infos du livre document.getElementById('book-title').textContent = bookData.title || 'Livre EPUB'; document.getElementById('book-author').textContent = bookData.author || 'Auteur inconnu'; updateLoadingDetails('Initialisation d\'ePub.js moderne...'); // Créer le livre EPUB à partir de l'ArrayBuffer - API moderne book = ePub(arrayBuffer); updateLoadingDetails('Chargement des métadonnées...'); // Attendre que le livre soit prêt await book.ready; // Mettre à jour les informations si disponibles dans les métadonnées if (book.packaging && book.packaging.metadata) { const metadata = book.packaging.metadata; if (metadata.title) { document.getElementById('book-title').textContent = metadata.title; } if (metadata.creator) { document.getElementById('book-author').textContent = metadata.creator; } } updateLoadingDetails('Configuration du lecteur...'); // Créer la zone d'affichage rendition = book.renderTo("epub-container", { width: "100%", height: "100%", ignoreClass: "annotator-hl" // Pour Hypothesis }); updateLoadingDetails('Affichage du contenu...'); // Afficher le livre displayed = await rendition.display(); updateLoadingDetails('Configuration des interactions...'); // Écouter les événements de navigation rendition.on('locationChanged', (location) => { console.log('📚 Location changed:', location); updateNavigationButtons(); updateProgressInfo(location); }); // Masquer l'écran de chargement setTimeout(() => { document.getElementById('loading-screen').style.display = 'none'; updateNavigationButtons(); console.log('📚 EPUB reader ready!'); }, 1000); } catch (error) { console.error('❌ Error loading EPUB:', error); showError('Erreur lors du chargement: ' + error.message); } } function showError(message) { document.getElementById('error-message').textContent = message; document.getElementById('loading-screen').style.display = 'none'; document.getElementById('error-screen').style.display = 'flex'; } function updateProgressInfo(location) { const progressElement = document.getElementById('progress-info'); if (location && location.start && location.start.percentage !== undefined) { const percentage = Math.round(location.start.percentage * 100); progressElement.textContent = `${percentage}%`; } else { progressElement.textContent = 'Position inconnue'; } } function updateNavigationButtons() { const prevBtn = document.getElementById('btn-prev'); const nextBtn = document.getElementById('btn-next'); if (rendition && rendition.location) { prevBtn.disabled = rendition.location.atStart; nextBtn.disabled = rendition.location.atEnd; } else { prevBtn.disabled = false; nextBtn.disabled = false; } } function previousPage() { if (rendition) { rendition.prev(); } } function nextPage() { if (rendition) { rendition.next(); } } function toggleHypothesis() { if (window.hypothesis) { try { window.hypothesis.show(); console.log('💬 Hypothesis sidebar toggled'); } catch (e) { console.log('Hypothesis toggle error:', e); } } else { console.log('⏳ Hypothesis not loaded yet'); } } function goToTOC() { if (book && book.navigation) { // Afficher une liste simple de la table des matières const toc = book.navigation.toc; if (toc && toc.length > 0) { const tocText = toc.map((item, index) => `${index + 1}. ${item.label}`).join('\n'); const choice = prompt('Table des matières:\n\n' + tocText + '\n\nEntrez le numéro du chapitre (1-' + toc.length + '):'); if (choice && !isNaN(choice)) { const chapterIndex = parseInt(choice) - 1; if (chapterIndex >= 0 && chapterIndex < toc.length) { rendition.display(toc[chapterIndex].href); } } } else { alert('Aucune table des matières disponible'); } } } function changeFontSize(delta) { currentFontSize = Math.max(12, Math.min(32, currentFontSize + delta * 2)); if (rendition) { rendition.themes.fontSize(currentFontSize + 'px'); console.log('📚 Font size:', currentFontSize + 'px'); } } function goBack() { if (confirm('Voulez-vous vraiment retourner au workflow ?')) { window.location.href = 'group-creation-workflow-debug.html'; } } // Gestion des touches du clavier document.addEventListener('keydown', (e) => { if (e.key === 'ArrowLeft') { previousPage(); } else if (e.key === 'ArrowRight') { nextPage(); } }); // Démarrer le chargement au chargement de la page document.addEventListener('DOMContentLoaded', () => { console.log('📚 EPUB Reader initializing...'); // Vérifier que les dépendances sont chargées if (typeof JSZip === 'undefined') { console.error('❌ JSZip not loaded'); showError('JSZip library not loaded. Please refresh the page.'); return; } if (typeof ePub === 'undefined') { console.error('❌ ePub.js not loaded'); showError('ePub.js library not loaded. Please refresh the page.'); return; } console.log('✅ Dependencies loaded: JSZip:', typeof JSZip, 'ePub:', typeof ePub); loadEpubFromWorkflow(); }); CaptureDrag to outliner or UploadClose

      ll

    1. us+ offre un soutien financier additionnel pour les participantsayant des besoins spécifiques (physiques, mentaux ou de santé)—par exemple pourhébergement adapté, matériel v

      kkk

    1. Ce paragraphe est parfait pour tester les annotations de groupe. Sélectionnez ce texte pour voir apparaître la boîte d'annotation native Hypothesis.

      ,,,