// dark mode toggle function toggleDarkMode() document.body.classList.toggle('dark');
// Helper: update preview font + text function updateDisplay() if (!playlist.length) displayDiv.style.fontFamily = "sans-serif"; currentFontLabel.innerText = "Font: none"; fontCounterSpan.innerText = `Font 0 of 0`; return; const currentFont = playlist[currentIndex]; displayDiv.style.fontFamily = `'$currentFont', system-ui, sans-serif`; currentFontLabel.innerText = `Font: $currentFont`; fontCounterSpan.innerText = `Font $currentIndex+1 of $playlist.length`; font playlist script
// Auto-rotation function startAutoRotate() if (intervalId) clearInterval(intervalId); if (playlist.length === 0) return; isPlaying = true; intervalId = setInterval(() => if (playlist.length > 0) currentIndex = (currentIndex + 1) % playlist.length; updateDisplay(); , 3000); // dark mode toggle function toggleDarkMode() document
function importPlaylist(file) const reader = new FileReader(); reader.onload = (e) => try const json = JSON.parse(e.target.result); if (json.fonts && Array.isArray(json.fonts) && json.fonts.length) playlist = json.fonts; currentIndex = 0; if (json.savedText !== undefined) userMessageTextarea.value = json.savedText; renderPlaylistUI(); updateTextContent(); updateDisplay(); stopAutoRotate(); else alert("Invalid playlist format. Need fonts: [...] "); catch(err) alert("Error parsing file"); ; reader.readAsText(file); currentFontLabel.innerText = "Font: none"
// export/import function exportPlaylist() const dataStr = JSON.stringify( fonts: playlist, savedText: userMessageTextarea.value , null, 2); const blob = new Blob([dataStr], type: "application/json"); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = "fontPlaylist.json"; a.click(); URL.revokeObjectURL(url);