PageSourceSearch

https://www.adelphi.edu/wp-content/themes/primary/countup-component.js?h=228db2f5

js adelphi.edu collected 2026-10-01 08:46:03 UTC 1,589 bytes, 50 lines download raw bytes

1function isVisibleInViewport(element) {
2    const rect = element.getBoundingClientRect();
3  
4    const { top, bottom, left, right } = rect;
5  
6    return top >= 0
7      && bottom <= window.innerHeight
8      && left >= 0
9      && right <= window.innerWidth;
10  }
11  // forEach
12  // map - transforms each element in the array
13  // reduce - combine elements into a single result : [ 1 , 2 , 3] = 6
14  // filter - condition to remove elements from the array
15  // Array.from - make collection into array, ex querySelectorAll returns HTMLCollection which is NOT an array so use Array.from
16  
17  
18  const elementsToCountUp = Array
19    .from(document.querySelectorAll('.demo'))
20    .map(element => {
21      const startingNumber = parseInt(element.textContent);//use parseFloat for decimals
22      const finalNumber = parseInt(element.dataset.finalNumber);
23      const numberObject = {
24        hasCountedUp: false,
25        element: element,
26        counter: new CountUp(element.id, startingNumber, finalNumber)
27      }
28      return numberObject;
29    });
30  
31  function startCount(number) {
32    if (!number.hasCountedUp && isVisibleInViewport(number.element)) {
33      number.counter.start();
34      number.hasCountedUp = true;
35      // number.element.classList.add('animate__animated', 'animate__fadeInRight');
36  
37    }
38  }
39  
40  // Check initially when the program starts.
41  window.addEventListener('load', () => {
42    elementsToCountUp.forEach(startCount);
43  });
44 
45  
46  
47  // Check when the user begins to scroll.
48  window.addEventListener('scroll', () => {
49    elementsToCountUp.forEach(startCount);
50  });

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.