// Generate dynamic tasks function generateTasks() { taskUrls.forEach((url, index) => { const listItem = document.createElement('li'); listItem.className = 'list-group-item task-item'; listItem.textContent = `Visit Site ${index + 1}`; listItem.dataset.url = url; listItem.addEventListener('click', () => handleTaskClick(listItem, url)); tasksList.appendChild(listItem); }); } // Handle task clicks function handleTaskClick(taskItem, url) { window.open(url, '_blank'); // Open link in a new tab if (!taskItem.classList.contains('complete')) { taskItem.classList.add('complete'); completedTasks++; updateProgress(); if (completedTasks === taskUrls.length) { tasksSection.classList.add('d-none'); shareSection.classList.remove('d-none'); } } } // Update progress bar function updateProgress() { const progress = (completedTasks / taskUrls.length) * 100; progressBar.style.width = `${progress}%`; progressBar.setAttribute('aria-valuenow', progress); } // Sharing functions function shareOnWhatsApp() { const message = encodeURIComponent('Participate in the Zepto ₹500 Giveaway! Complete tasks and share to win. Check it out here: https://yourgiveawaysite.com'); window.open(`https://wa.me/?text=${message}`, '_blank'); } function shareOnTwitter() { const message = encodeURIComponent('Participate in the Zepto ₹500 Giveaway! 🎉 Complete tasks and share to increase your chances of winning! 🏆'); window.open(`https://twitter.com/intent/tweet?text=${message}`, '_blank'); } function shareOnFacebook() { const url = encodeURIComponent('https://yourgiveawaysite.com'); window.open(`https://www.facebook.com/sharer/sharer.php?u=${url}`, '_blank'); }