diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/app.js | 31 |
1 files changed, 3 insertions, 28 deletions
@@ -188,40 +188,15 @@ function setupModal() { }); } -// Fetch summary from markdown file -async function fetchSummary(bookId) { - // Check if running from file:// protocol (fetch won't work) - if (window.location.protocol === 'file:') { - console.warn('Running from file:// - use "python -m http.server 8000" for summaries'); - return null; - } - - try { - const response = await fetch(`summaries/${bookId}.md`); - if (!response.ok) { - console.warn(`Summary not found for book ${bookId}: ${response.status}`); - return null; - } - const text = await response.text(); - // Skip the title line (# Title) and return the rest - const lines = text.trim().split('\n'); - const summaryLines = lines.slice(1).join('\n').trim(); - return summaryLines || null; - } catch (error) { - console.error('Error fetching summary:', error); - return null; - } -} - // Open modal with book details -async function openModal(bookId) { +function openModal(bookId) { const book = state.books.find(b => b.id === bookId); if (!book) return; const coverUrl = getCoverUrl(book); - // Fetch summary from markdown file - const summary = await fetchSummary(bookId); + // Get summary from book data (embedded by build.js) + const summary = book.summary; // Build summary section let summaryHtml; |
