Digital Travel Scrapbook Creator

Digital Travel Scrapbook Creator

Create a beautiful log of your travel memories.

Add a New Entry

★ ★ ★ ★ ★

Your Journal

Your entries will appear here.

${entry.journal}

`; entriesContainer.appendChild(card); }); } ratingStars.forEach(star => { star.addEventListener('click', () => { currentRating = parseInt(star.dataset.value); updateRatingStars(); }); }); function updateRatingStars() { ratingStars.forEach(star => { star.classList.toggle('selected', parseInt(star.dataset.value) <= currentRating); }); } form.addEventListener('submit', (e) => { e.preventDefault(); const newEntry = { id: Date.now(), date: document.getElementById('entry-date').value, location: document.getElementById('entry-location').value, highlights: document.getElementById('entry-highlights').value, journal: document.getElementById('entry-journal').value, rating: currentRating }; journalData.push(newEntry); form.reset(); currentRating = 0; updateRatingStars(); renderJournal(); }); document.getElementById('pdf-download-btn').addEventListener('click', () => { const { jsPDF } = jspdf; const pdf = new jsPDF(); const content = document.getElementById('journal-entries'); pdf.setFontSize(22); pdf.text("My Travel Journal", 105, 20, { align: 'center' }); html2canvas(content, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const { width, height } = pdf.internal.pageSize; const imgHeight = canvas.height * width / canvas.width; let heightLeft = imgHeight; let position = 0; pdf.addImage(imgData, 'PNG', 0, 0, width, imgHeight); heightLeft -= height; while (heightLeft > 0) { position = heightLeft - imgHeight; pdf.addPage(); pdf.addImage(imgData, 'PNG', 0, position, width, imgHeight); heightLeft -= height; } pdf.save('travel-journal.pdf'); }); }); document.getElementById('entry-date').valueAsDate = new Date(); renderJournal(); });
Scroll to Top