1 const goal = 25000; 2 3 // Get current donation from span's data attribute 4 function getCurrentDonation() { 5 const donationElement = document.querySelector('[data-current-donation]'); 6 const donationNumbers = document.querySelectorAll('.donation-wrapper>h3>span'); 7 8 const currencyFormat = new Intl.NumberFormat('en-US', { 9 style: 'currency', 10 currency: 'USD', 11 maximumFractionDigits: 0 12 }); 13 14 donationNumbers.forEach((donationEl) => { 15 const value = Number(donationEl.innerHTML); 16 17 if (typeof value === 'number' ) { 18 const toCurrency = currencyFormat.format(value); 19 donationEl.innerHTML = toCurrency; 20 } 21 }); 22 document.querySelector("div.donation-wrapper").classList.add('d-block'); 23 return parseInt(donationElement.getAttribute('data-current-donation')) || 0; 24 } 25 function updateProgressIndicator(currentAmount,goal,percentage) { 26 const progressContainer = document.getElementById("progressContainer"); 27 const progressCircle = document.getElementById("progressCircle"); 28 const progressValue = document.getElementById("currentDonation"); 29 const goalText = document.getElementById("goalText"); 30 31 // Update progress bar 32 progressCircle.style.background = `conic-gradient( 33 ${currentAmount >= goal ? "#00783c" : "#092E6E"} 0deg ${percentage * 3.6}deg, 34 #CDD2DB ${percentage * 3.6}deg 360deg 35 )`; 36 37 // Update donation text 38 progressValue.textContent = `$${currentAmount.toLocaleString()}`; 39 40 // Apply the "goal-reached" class when the goal is exceeded 41 if (currentAmount >= goal) { 42 progressContainer.classList.add("goal-reached"); 43 goalText.textContent = "We Have Reached Our Goal!!"; 44 } else { 45 progressContainer.classList.remove("goal-reached"); 46 } 47 } 48 // Animate the progress bar to the current donation 49 function animateProgress(newDonation) { 50 51 const startValue = 0; 52 const endValue = newDonation; 53 const startTime = performance.now(); 54 const duration = 1000; // Animation duration in milliseconds 55 56 function step(timestamp) { 57 const elapsed = timestamp - startTime; 58 const progress = Math.min(elapsed / duration, 1); 59 60 const currentAmount = Math.round(startValue + progress * (endValue - startValue)); 61 const percentage = Math.min((currentAmount / goal) * 100, 100); 62 63 updateProgressIndicator(currentAmount,goal,percentage); 64 if (progress < 1) { 65 requestAnimationFrame(step); 66 } 67 } 68 69 requestAnimationFrame(step); 70 } 71 72 // Initialize the progress bar on page load 73 function initializeProgress() { 74 const currentDonation = getCurrentDonation(); 75 animateProgress(currentDonation); 76 } 77 // Multiple Accordions on page handler 78 function multiPageAccordion() { 79 // find a spefice class within the list of accordion class that has the word wrapper, then create an array with only that class 80 const accordions = Array.from(document.querySelectorAll('.accordion')).filter(element => 81 Array.from(element.classList).some(className => className.includes('wrapper'))); 82 83 // Check if there are more than one accordion on the page 84 if (accordions.length === 1) { 85 accordions.forEach((accordion, index) => { 86 let uniqueAccordionId = `uhd-accordion-${index}`; 87 88 accordion.id = uniqueAccordionId; 89 90 accordion.querySelectorAll(".accordion-collapse").forEach(collapse => { 91 collapse.setAttribute("data-bs-parent", `#${uniqueAccordionId}`); 92 }); 93 94 let existingInstance = bootstrap.Collapse.getInstance(accordion); 95 if (existingInstance) { 96 existingInstance.dispose(); 97 } 98 99 new bootstrap.Collapse(accordion, { toggle: false }); 100 }); 101 } 102 } 103 // Core - Intro letter reveal 104 function introLetterReveal() { 105 const expandBtn = document.querySelector('.expandBtn'); 106 const container = document.querySelector('.core-intro-letter'); 107 const hiddenContent = document.querySelector('.hidden-content'); 108 109 const expandBtnMore = expandBtn.innerHTML; 110 const expandBtnLess = 'Show Less <i class="fa-solid fa-angle-up"></i>'; 111
112 expandBtn.addEventListener("click", function () { 113 if (container.classList.contains("expanded")) { 114 // Collapse: Reset max-height to trigger animation 115 hiddenContent.style.maxHeight = hiddenContent.scrollHeight + "px"; // Reset to full height 116 setTimeout(() => hiddenContent.style.maxHeight = "400px", 10); // Small delay ensures smooth animation 117 118 expandBtn.innerHTML = expandBtnMore; 119 } else { 120 // Expand: Set to full height, then remove max-height after transition 121 hiddenContent.style.maxHeight = hiddenContent.scrollHeight + "px"; 122 expandBtn.innerHTML = expandBtnLess; 123 setTimeout(() => hiddenContent.style.maxHeight = "none", 500); // Remove restriction after animation 124 } 125 126 container.classList.toggle("expanded"); 127 }); 128 } 129 // Start initialization on page load 130 window.onload = initializeProgress; 131 132 /** Home - Hero Slider **/ 133 $(document).ready(function(){ 134 $('.uhd-homepage-hero-slider').slick({ 135 fade: true, 136 dots: true, 137 infinite: true, 138 speed: 1500, 139 slidesToShow: 1, 140 arrows: false, 141 autoplay: true, 142 lazyLoad: 'ondemand', 143 draggable: false, 144 pauseOnFocus: true, 145 pauseOnHover: true, 146 }); 147 multiPageAccordion(); 148 149 const section = document.querySelector("section.core-intro-letter"); 150 151 if (section) { 152// console.log("section.core-intro-letter is present. Running introLetterReveal"); 153 introLetterReveal() 154 } else { 155// console.log("section.core-intro-letter is NOT present. Function will not run."); 156 } 157 158 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.