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.

Your entries will appear here.

'; return; } const sortedData = journalData.sort((a, b) => new Date(b.date) - new Date(a.date)); sortedData.forEach(entry => { const card = document.createElement('div'); card.className = 'p-6 border rounded-lg bg-yellow-50/50'; const highlightsHtml = entry.highlights.split('\n').map(line => `
  • ${line}
  • `).join(''); card.innerHTML = `

    ${entry.location}

    ${new Date(entry.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}

    ${'★'.repeat(entry.rating)}${'☆'.repeat(5 - entry.rating)}

    Highlights:

      ${highlightsHtml}

    Journal Entry:

    ${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