// Fetch sample book data from Open Library API document.addEventListener('DOMContentLoaded', function() { fetch('https://openlibrary.org/subjects/fiction.json?limit=10') .then(response => response.json()) .then(data => { const featuredBooksContainer = document.getElementById('featured-books'); data.works.forEach(work => { const bookId = work.key.split('/').pop(); const coverUrl = `https://covers.openlibrary.org/b/id/${work.cover_id}-M.jpg`; const bookCard = document.createElement('div'); bookCard.className = 'book-card bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-md transition-shadow'; bookCard.innerHTML = `
${work.title}

${work.title}

${work.authors?.[0]?.name || 'Unknown Author'}

${work.subject?.[0] || 'Fiction'} Download
`; featuredBooksContainer.appendChild(bookCard); }); feather.replace(); }) .catch(error => { console.error('Error fetching books:', error); }); });