Staycation Ideas Generator

Staycation Ideas Generator

Discover fun ways to vacation at home based on your mood and budget.

Your Curated Staycation Plan

Select filters and click "Find Ideas!" to get started.

Add New Staycation Idea

Existing Ideas Database

Title Vibe Company Budget Action

No ideas found matching those exact criteria. Try broadening your search!

'; pdfBtn.style.display = 'none'; // Hide PDF button if no results return; } pdfBtn.style.display = 'inline-block'; // Show PDF button if results exist filteredIdeas.forEach(idea => { const vibeClass = 'sig-vibe-' + idea.vibe.toLowerCase(); const card = document.createElement('div'); card.className = 'sig-idea-card'; card.innerHTML = `
${escapeHtml(idea.title)}
${escapeHtml(idea.desc)}
${escapeHtml(idea.company)} ${escapeHtml(idea.budget)}
`; resultsContainer.appendChild(card); }); } // Render the configuration table function renderConfigTable() { configTbody.innerHTML = ''; ideasData.forEach(idea => { const row = document.createElement('tr'); row.innerHTML = ` ${escapeHtml(idea.title)} ${escapeHtml(idea.vibe)} ${escapeHtml(idea.company)} ${escapeHtml(idea.budget)} `; configTbody.appendChild(row); }); } // --- Event Listeners --- // Generate Button Click generateBtn.addEventListener('click', function() { const vibeFilter = document.getElementById('sig-filter-vibe').value; const companyFilter = document.getElementById('sig-filter-company').value; const budgetFilter = document.getElementById('sig-filter-budget').value; const filtered = ideasData.filter(idea => { return (vibeFilter === 'all' || idea.vibe === vibeFilter) && (companyFilter === 'all' || idea.company === companyFilter) && (budgetFilter === 'all' || idea.budget === budgetFilter); }); // Shuffle results for variety before rendering const shuffled = filtered.sort(() => 0.5 - Math.random()); renderResults(shuffled); }); // Add Idea Button Click addIdeaBtn.addEventListener('click', function() { const title Input = document.getElementById('sig-add-title'); const descInput = document.getElementById('sig-add-desc'); const vibeInput = document.getElementById('sig-add-vibe'); const companyInput = document.getElementById('sig-add-company'); const budgetInput = document.getElementById('sig-add-budget'); if (!titleInput.value.trim() || !descInput.value.trim()) { alert("Please fill in both Title and Description."); return; } const newIdea = { id: Date.now(), // Use timestamp for unique ID title: titleInput.value.trim(), desc: descInput.value.trim(), vibe: vibeInput.value, company: companyInput.value, budget: budgetInput.value }; ideasData.push(newIdea); // Reset form titleInput.value = ''; descInput.value = ''; vibeInput.selectedIndex = 0; companyInput.selectedIndex = 0; budgetInput.selectedIndex = 0; renderConfigTable(); alert("New idea added successfully!"); }); // Delete Idea (Global function for inline onclick) window.sigDeleteIdea = function(id) { if(confirm("Are you sure you want to delete this idea?")) { ideasData = ideasData.filter(idea => idea.id !== id); renderConfigTable(); // Clear current results if any, as data changed resultsContainer.innerHTML = '

Data changed. Please re-generate ideas.

'; pdfBtn.style.display = 'none'; } } // PDF Download pdfBtn.addEventListener('click', function() { const element = document.getElementById('sig-print-area'); const pdfTitle = document.getElementById('sig-pdf-title'); // Show title for PDF pdfTitle.classList.remove('sig-hidden'); document.body.classList.add('sig-generating-pdf'); const opt = { margin: [0.5, 0.5], filename: 'Staycation_Ideas.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, scrollY: 0 }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }, pagebreak: { mode: ['avoid-all', 'css', 'legacy'] } }; html2pdf().set(opt).from(element).save().then(() => { // Reset after download pdfTitle.classList.add('sig-hidden'); document.body.classList.remove('sig-generating-pdf'); }); }); // --- Initialization --- renderConfigTable(); pdfBtn.style.display = 'none'; // Hide PDF btn initially until results are generated });
Scroll to Top