WBTuck/laughs-drafts-comedy-showcase
0
1// Smooth scrolling for anchor links2document.querySelectorAll('a[href^="#"]').forEach(anchor => {3 anchor.addEventListener('click', function (e) {4 e.preventDefault();5 document.querySelector(this.getAttribute('href')).scrollIntoView({6 behavior: 'smooth'7 });8 });9});10 11// Countdown to next show12function updateCountdown() {13 const now = new Date();14 const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);15 const nextShow = new Date(now.getFullYear(), now.getMonth(), lastDay.getDate(), 20, 0, 0);16 17 if (now.getDate() > lastDay.getDate() || (now.getDate() === lastDay.getDate() && now.getHours() >= 22)) {18 nextShow.setMonth(nextShow.getMonth() + 1);19 }20 21 const diff = nextShow - now;22 23 const days = Math.floor(diff / (1000 * 60 * 60 * 24));24 const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));25 const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));26 27 const countdownElement = document.getElementById('countdown');28 if (countdownElement) {29 countdownElement.innerHTML = `${days}d ${hours}h ${minutes}m`;30 }31}32 33updateCountdown();34setInterval(updateCountdown, 60000);