AppsScriptPulse

Font Playlist Script: [top]

function nextFont() if (!playlist.length) return; currentIndex = (currentIndex + 1) % playlist.length; updateDisplay(); if (isPlaying) stopAutoRotate(); startAutoRotate(); // restart timer to avoid skipping beat else updateDisplay();

// 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); font playlist script

// refresh font list UI (with remove & reorder stub) function renderPlaylistUI() fontListContainer.innerHTML = ''; playlist.forEach((font, idx) => const itemDiv = document.createElement('div'); itemDiv.className = 'font-item'; const nameSpan = document.createElement('span'); nameSpan.className = 'font-name'; nameSpan.innerText = font; nameSpan.style.fontFamily = `'$font', monospace`; // click on font name => jump to that font & pause nameSpan.addEventListener('click', () => if (playlist.length) currentIndex = idx; updateDisplay(); stopAutoRotate(); ); const removeBtn = document.createElement('button'); removeBtn.innerText = '✖️'; removeBtn.className = 'remove-font'; removeBtn.addEventListener('click', (e) => e.stopPropagation(); if (playlist.length <= 1) alert("Cannot remove last font – add another first."); return; playlist.splice(idx, 1); if (currentIndex >= playlist.length) currentIndex = playlist.length - 1; if (currentIndex < 0) currentIndex = 0; renderPlaylistUI(); updateDisplay(); stopAutoRotate(); ); itemDiv.appendChild(nameSpan); itemDiv.appendChild(removeBtn); fontListContainer.appendChild(itemDiv); ); function nextFont() if (

// DOM elements const displayDiv = document.getElementById('displayText'); const currentFontLabel = document.getElementById('currentFontLabel'); const userMessageTextarea = document.getElementById('userMessage'); const prevBtn = document.getElementById('prevBtn'); const nextBtn = document.getElementById('nextBtn'); const playBtn = document.getElementById('playBtn'); const pauseBtn = document.getElementById('pauseBtn'); const addFontBtn = document.getElementById('addFontBtn'); const newFontNameInput = document.getElementById('newFontName'); const fontListContainer = document.getElementById('fontListContainer'); const fontCounterSpan = document.getElementById('fontCounter'); const exportBtn = document.getElementById('exportBtn'); const importBtn = document.getElementById('importBtn'); const importFileInput = document.getElementById('importFile'); const darkModeBtn = document.getElementById('darkModeBtn'); function nextFont() if (!playlist.length) return

function prevFont() if (!playlist.length) return; currentIndex = (currentIndex - 1 + playlist.length) % playlist.length; updateDisplay(); if (isPlaying) stopAutoRotate(); startAutoRotate(); else updateDisplay();