(function () { 'use strict'; function updateOnlineStatus() { const badge = document.getElementById('offline-badge'); if (!badge) return; badge.hidden = navigator.onLine; } window.addEventListener('online', updateOnlineStatus); window.addEventListener('offline', updateOnlineStatus); document.addEventListener('DOMContentLoaded', updateOnlineStatus); async function loadListing() { const container = document.getElementById('literature-list'); if (!container) return; try { const res = await fetch('/literature/index.json'); if (!res.ok) { container.innerHTML = '
No literature available yet. Add a .txt file to public/text/ and push to GitHub.
No books converted yet.
'; return; } const html = items.map(book => { const dateStr = book.datePublished ? `${book.datePublished}` : ''; const descStr = book.description ? `${book.description}
` : ''; return `Could not load literature catalogue. You may be offline.
'; } } document.addEventListener('DOMContentLoaded', loadListing); })();