Online Poetry Rhyme Finder

Poetry Rhyme Finder

No rhymes found.

'; return; } rhymes.forEach(rhyme => { const rhymeEl = document.createElement('span'); rhymeEl.className = 'rhyme-word'; rhymeEl.textContent = rhyme; rhymesListContainer.appendChild(rhymeEl); }); }; const downloadPdf = () => { if (!lastSearchedWord || lastRhymes.length === 0) { showMessage('No rhymes to download. Please perform a search first.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setProperties({ title: `Rhymes for ${lastSearchedWord}` }); doc.setFontSize(20); doc.text(`Rhymes for "${lastSearchedWord}"`, 105, 20, { align: 'center' }); // Split rhymes into columns for the PDF const colCount = 4; const rowCount = Math.ceil(lastRhymes.length / colCount); const tableBody = []; for (let i = 0; i < rowCount; i++) { const row = []; for (let j = 0; j < colCount; j++) { row.push(lastRhymes[i + j * rowCount] || ''); } tableBody.push(row); } doc.autoTable({ startY: 30, body: tableBody, theme: 'plain', styles: { fontSize: 10 } }); doc.save(`rhymes-for-${lastSearchedWord}.pdf`); }; // --- EVENT LISTENERS --- findRhymesBtn.addEventListener('click', findRhymes); wordInput.addEventListener('keyup', (e) => { if (e.key === 'Enter') { findRhymes(); } }); pdfDownloadBtn.addEventListener('click', downloadPdf); // --- INITIALIZATION --- wordInput.value = 'poetry'; // Pre-populate with a sample word });
Scroll to Top