PageSourceSearch

https://aerialrecovery.org/js/custom.js

js aerialrecovery.org collected 2026-10-03 23:37:32 UTC 10,329 bytes, 351 lines download raw bytes

1
2$(".validate").validate({
3  submitHandler: function(form) {
4    form.submit();
5  }
6});    
7
8$("#new_form_payment").validate({
9  submitHandler: function(form) {
10    form.submit();
11  }
12});  
13
14$("#newsletter").validate({
15  submitHandler: function(form) {
16    form.submit();
17  }
18});   
19$("#newsletter-form-utility").validate({
20  submitHandler: function(form) {
21    form.submit();
22  }
23});  
24
25
26$(function () {   
27    'use strict';
28
29    $('[data-toggle="offcanvas"]').on('click', function () {     
30        $('.offcanvas-collapse').toggleClass('open');   
31    }); 
32});   
33
34// REMOVE SCREEN COVER NAV ON LARGE SCREEN 
35$(window).resize(function() {     
36    if ($(window).width() > 1200) {       
37        $("#navbarNav").removeClass("open");       
38        $("#hamburger-6").removeClass("is-active");            
39    } 
40}).resize();   
41
42$(document).ready(function() {   
43    $(".navbar-toggler").click(function() {     
44        $('#hamburger-6').toggleClass("is-active");   
45    });    
46
47    // CountUp function      
48    function countUp(target, duration, elementId) {
49      
50        const element = document.getElementById(elementId);   
51        const start = 0;         
52        const increment = target / (duration / 1500); // Calculate increment per millisecond         
53        let current = 0;         
54
55        // Update the count at intervals         
56        const interval = setInterval(() => {             
57            current += increment;             
58            element.textContent = Math.round(current).toLocaleString(); // Update the displayed count             
59            
60            // If reached or exceeded the target, stop the interval             
61            if (current >= target) {                 
62                clearInterval(interval);                 
63                element.textContent = Math.round(target).toLocaleString(); // Ensure the final count is exact             
64            }         
65        }, 1); // Update every millisecond  
66    }         
67
68 
69 function startCountingAnimalsStats() {
70  const ids = [
71    'animals-rescues-to-date-animals-ukraine-russia-war',
72    'animals-rescues-to-date-puppies-and-kittens',
73    'animals-rescues-to-date-horses',
74    'animals-rescues-to-date-zebras',
75    'animals-rescues-to-date-dogs-hurricane-helene'
76  ];
77
78  if (ids.every(id => document.getElementById(id))) {
79    countUp(92, 600000, 'animals-rescues-to-date-animals-ukraine-russia-war'); 
80    countUp(88, 600000, 'animals-rescues-to-date-puppies-and-kittens');
81    countUp(17, 600000, 'animals-rescues-to-date-horses');  
82    countUp(4, 600000, 'animals-rescues-to-date-zebras');  
83    countUp(4, 600000, 'animals-rescues-to-date-dogs-hurricane-helene');  
84  }
85}
86
87  
88    function startCounting() {
89  const ids = [
90    'heroes-stats-platoons',
91    'heroes-stats-heroes',
92    'heroes-stats-rescues'
93  ];
94
95  if (ids.every(id => document.getElementById(id))) {
96    countUp(11, 600000, 'heroes-stats-platoons');                           
97    countUp(214, 600000, 'heroes-stats-heroes');                            
98    countUp(8076, 600000, 'heroes-stats-rescues');     
99  }
100}
101  
102     function startCountingHumanTrafficking() {
103  const ids = [
104    'human-trafficking'
105  ];
106
107   if (ids.every(id => document.getElementById(id))) {
108    countUp(49600000, 600000, 'human-trafficking');                           
109  }
110}
111  
112  
113     function startCountingTransactionalHumanTrafficking() {
114  const ids = [
115    'transactional-human-trafficking'
116  ];
117
118   if (ids.every(id => document.getElementById(id))) {
119    countUp(27156000, 600000, 'transactional-human-trafficking');                           
120  }
121}
122  
123  
124  
125  function startCountingRescuedPeople() {
126  const ids = [
127    'rescued-people'
128  ];
129
130   if (ids.every(id => document.getElementById(id))) {
131    countUp(8000, 600000, 'rescued-people');                           
132  }
133}
134  
135    function startCountingHurricaneIdalia() {
136  const ids = [
137    'storm-impact-assessments',
138    'health-&-wellness-checks',
139    'emergency-access',
140    'aid-deliveries',
141    'aid-distribution-recipients'
142  ];
143
144   if (ids.every(id => document.getElementById(id))) {
145    countUp(7, 600000, 'storm-impact-assessments');
146    countUp(1890, 600000, 'aid-distribution-recipients');
147    countUp(42, 600000, 'health-&-wellness-checks');
148    countUp(56, 600000, 'aid-deliveries');
149    countUp(21, 600000, 'emergency-access'); 
150  }
151}
152  
153  function startCountingHawaiiFire() {
154  const ids = [
155    'complete-drone-assessment-of-lahaina',
156    'aid-deliveries-supported',
157    'victims-medically-treated-during-immediate-response',
158    'health-welfare-checks',
159    'aid-deliveries-supported'
160  ];
161
162   if (ids.every(id => document.getElementById(id))) {
163    countUp(1, 600000, 'complete-drone-assessment-of-lahaina');
164    countUp(2, 600000, 'aid-deliveries-supported');
165    countUp(7, 600000, 'victims-medically-treated-during-immediate-response');
166    countUp(16, 600000, 'health-welfare-checks');
167    countUp(3, 600000, 'anti-trafficking-assessments-conducted'); 
168  }
169}
170
171
172   function startCountingUkraineRescue() {
173  const ids = [
174    'internally-displaced-persons',
175    'animals',
176    'rescued-orphans'
177  ];
178
179   if (ids.every(id => document.getElementById(id))) {
180    countUp(6331, 600000, 'internally-displaced-persons');         
181    countUp(92, 600000, 'animals');
182            
183    countUp(998, 600000, 'rescued-orphans'); 
184  }
185}
186  
187  function startCountingHumanitarianSpecialOperators() {
188  const ids = [
189    'humanitarian-special-operators'
190  ];
191
192   if (ids.every(id => document.getElementById(id))) {
193    countUp(8000, 600000, 'humanitarian-special-operators');                           
194  }
195}
196  
197   // Observe when the stats section is visible     
198    let observer = new IntersectionObserver(entries => {         
199        if (entries[0].isIntersecting) {             
200            startCounting();             
201          startCountingAnimalsStats();
202          startCountingHumanTrafficking();
203          startCountingRescuedPeople();
204          startCountingHurricaneIdalia();
205          startCountingHawaiiFire();
206         startCountingUkraineRescue();
207          startCountingHumanitarianSpecialOperators();
208          startCountingTransactionalHumanTrafficking();
209                
210          
211            observer.disconnect(); // Run only once         
212        }     
213    }, { threshold: 0.2 });      
214
215    let statsHeadline = document.querySelector(".stats h2");     
216    if (statsHeadline) {         
217        observer.observe(statsHeadline);     
218    }
219  
220  }); 
221
222function percentageNumbers() {
223  let progressBars = document.querySelectorAll(".progress-bar");
224    progressBars.forEach(bar => {
225      let percentage = bar.getAttribute("data-percentage");
226      bar.style.setProperty('--target-width', percentage + '%');
227      bar.style.width = percentage + "%";
228    });
229  }
230
231let observer2 = new IntersectionObserver(entries => {         
232    if (entries[0].isIntersecting) {             
233		percentageNumbers();
234        observer2.disconnect(); // Run only once         
235    }     
236}, { threshold: 0.2 });
237
238let statsSubheadline = document.querySelector(".progress");
239if (statsSubheadline) {         
240    observer2.observe(statsSubheadline);     
241}
242
243
244   // Main slider - stays static until user clicks thumbnail
245$('.slider-for').slick({
246  slidesToShow: 1,
247  slidesToScroll: 1,
248  arrows: false,
249  fade: true
250});
251
252// Thumbnail slider - autoplay enabled
253$('.slider-nav').slick({
254  slidesToShow: 4,
255  slidesToScroll: 1,
256  dots: false,
257  autoplay: true,
258  autoplaySpeed: 2000,
259  centerMode: false,
260  focusOnSelect: true,
261  responsive: [
262    {
263      breakpoint: 767,
264      settings: {
265        slidesToShow: 3
266      }
267    }
268  ]
269});
270
271// Manually sync on thumbnail click
272$('.slider-nav').on('click', '.slick-slide', function (e) {
273  e.preventDefault();
274  const index = $(this).data('slick-index');
275  $('.slider-for').slick('slickGoTo', index);
276});
277
278
279    $('.slider').slick({     
280        prevArrow: '.slick-prev'        
281    }); 
282
283$(".slick").slick({
284            dots: false,
285     		vertical: false,
286            infinite: true,
287           	slidesToShow: 7,
288            slidesToScroll: 1,
289    centerMode: true,
290  focusOnSelect: true,
291  prevArrow: $('.slick-prev-assets'),
292  nextArrow: $('.slick-next-assets'),
293            autoplay: true,
294            autoplaySpeed: 2000,
295  responsive: [
296        {
297          breakpoint: 1499,
298          settings: {
299            slidesToShow: 3,
300            slidesToScroll: 3,
301          }
302        },
303        {
304          breakpoint: 1023,
305          settings: {
306            slidesToShow: 1,
307            slidesToScroll: 1
308          }
309        }]
310            
311          });
312
313
314
315document.querySelectorAll('a[href^="#"]').forEach(anchor => {
316    anchor.addEventListener("click", function (e) {
317        e.preventDefault();
318        const targetId = this.getAttribute("href");
319        const targetElement = document.querySelector(targetId);
320
321        if (targetElement) {
322            const targetPosition = targetElement.getBoundingClientRect().top + window.scrollY - 50; // 20px after target
323            window.scrollTo({
324                top: targetPosition,
325                behavior: "smooth"
326            });
327        }
328    });
329});
330
331
332
333//sponsorship page - adding the $ if there a number and commas separation to the amount  
334  document.addEventListener("DOMContentLoaded", function () {
335    const amountElements = document.querySelectorAll(".sponsorship-amount");
336
337    amountElements.forEach(el => {
338      const rawText = el.textContent.trim().replace(/^\$/, ''); // remove existing $
339
340      // Check if it starts with a digit
341      if (/^\d/.test(rawText)) {
342        // Extract numeric part (removing commas just in case)
343        const numberOnly = rawText.replace(/,/g, '');
344        const formattedNumber = parseInt(numberOnly, 10).toLocaleString(); // adds commas
345        el.textContent = "$" + formattedNumber;
346      } else {
347        // Just show the text with no $
348        el.textContent = rawText;
349      }
350    });
351  });

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.