![]() |
function nextFont() if (!playlist.length) return; currentIndex = (currentIndex + 1) % playlist.length; updateDisplay(); if (isPlaying) stopAutoRotate(); startAutoRotate(); // restart timer to avoid skipping beat else updateDisplay();
// 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
// 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); function nextFont() if (
// Add font function addFont() let newFont = newFontNameInput.value.trim(); if (newFont === "") return alert("Enter a font name"); // simple check: avoid duplicate (case-insensitive) if (playlist.some(f => f.toLowerCase() === newFont.toLowerCase())) alert("Font already in playlist"); return; playlist.push(newFont); renderPlaylistUI(); if (playlist.length === 1) currentIndex = 0; updateDisplay(); newFontNameInput.value = ""; if (isPlaying) stopAutoRotate(); startAutoRotate(); function nextFont() if (!playlist.length) return
// dark mode toggle function toggleDarkMode() document.body.classList.toggle('dark');