Online AI-Powered Sentence Rephraser

AI-Powered Sentence Rephraser

Discover new ways to express your ideas.

No rephrased options could be generated.

'; return; } options.forEach(option => { const optionEl = document.createElement('div'); optionEl.className = 'flex items-center justify-between p-3 bg-gray-50 rounded-lg border'; optionEl.innerHTML = `

${option}

`; resultsWrapper.appendChild(optionEl); }); document.querySelectorAll('.copy-btn').forEach(btn => { btn.addEventListener('click', (e) => { const textToCopy = e.target.previousElementSibling.textContent; navigator.clipboard.writeText(textToCopy) .then(() => showMessage('Copied to clipboard!', 'success')) .catch(() => showMessage('Failed to copy.', 'error')); }); }); pdfBtnContainer.classList.remove('hidden'); }; // --- PDF Export --- pdfBtn.addEventListener('click', () => { if (!lastResult || lastResult.options.length === 0) { showMessage('No results to download.', 'error'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(18); doc.text('Sentence Rephrasing Report', 105, 20, { align: 'center' }); doc.setFontSize(12); doc.setFont(undefined, 'bold'); doc.text('Original Sentence:', 15, 35); doc.setFont(undefined, 'normal'); let splitText = doc.splitTextToSize(lastResult.original, 180); doc.text(splitText, 15, 42); const tableData = lastResult.options.map(opt => [opt]); doc.autoTable({ startY: 42 + (splitText.length * 5) + 5, head: [[`Rephrased Options (${lastResult.mode})`]], body: tableData, headStyles: { fillColor: [79, 70, 229] } }); doc.save('rephrased-sentences.pdf'); }); // --- Utility --- const showMessage = (message, type = 'success') => { messageBox.textContent = message; messageBox.className = `message-box ${type} show`; setTimeout(() => { messageBox.classList.remove('show'); }, 3000); }; });
Scroll to Top