PageSourceSearch

https://www.weduglobal.org/wp-content/themes/wedu/js/main.js?ver=1.7902701687E%2B12

js weduglobal.org collected 2026-09-24 17:37:44 UTC 5,600 bytes, 191 lines download raw bytes

1/* Init object fit polyfill */
2/* To make it work, add 'font-family: 'object-fit: cover;';' to image */
3if (window.objectFitImages) {
4  window.objectFitImages();
5}
6
7(function() {
8  let resizeId; // for resize timer
9  let wWidth = window.innerWidth; // for resize
10  let isObserver = true; //for scroll reveal
11  let observer; //for scroll reveal
12  let root = document.documentElement; //for css variables update
13  let scrollPosition = 0;
14  const $body = document.body;
15  const $html = document.documentElement;
16  let $landingScreenInterval;
17
18  /// /* Setup helper functions */
19
20  // https://www.afasterweb.com/2017/09/26/performance-basics-throttling/
21  function throttle(callback, limit) {
22    let tick = false;
23    return function() {
24      if (!tick) {
25        callback.call();
26        tick = true;
27        setTimeout(function() {
28          tick = false;
29        }, limit);
30      }
31    };
32  }
33
34  // window.addEventListener("scroll", throttle(customFunction, 16));
35
36  function disableScrolling() {
37    if (document.documentElement.scrollHeight > window.innerHeight) {
38      const scrollTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop; // Works for Chrome, Firefox, IE...
39      document.documentElement.classList.add('disable-scrolling');
40      document.documentElement.style.top = -scrollTop + 'px';
41
42      setTimeout(() => {
43        document.documentElement.classList.add('scroll-default');
44      }, 0);
45    }
46  }
47
48  function enableScrolling() {
49    const scrollTop = parseInt(document.documentElement.style.top);
50    document.documentElement.classList.remove('disable-scrolling');
51    document.documentElement.scrollTop = -scrollTop;
52    document.body.scrollTop = -scrollTop;
53    setTimeout(() => {
54      document.documentElement.classList.remove('scroll-default');
55    }, 0);
56  }
57
58  function isMobile() {
59    if (document.querySelector('.is-mobile').style.display === 'block') {
60      return true;
61    } else {
62      return false;
63    }
64  }
65
66  //Scroll revealing animation
67  if (
68    !('IntersectionObserver' in window)
69    || !('IntersectionObserverEntry' in window)
70    || !('isIntersecting' in window.IntersectionObserverEntry.prototype)
71  ) {
72    isObserver = false;
73    document.documentElement.classList.remove('is-observer');
74  }
75
76  if (isObserver) {
77    observer = new IntersectionObserver(
78      entries => {
79        entries.forEach(entry => {
80          if (entry.isIntersecting) {
81            entry.target.classList.add('is-visible');
82            observer.unobserve(entry.target);
83          }
84        });
85      },
86      { rootMargin: '0px 0px -15% 0px' }
87    );
88  }
89
90  if (isObserver) {
91    document.querySelectorAll('.js-visibility').forEach((el, i) => {
92      observer.observe(el);
93    });
94  }
95
96  document.querySelectorAll('.scroll-link').forEach((el, i) => {
97    el.addEventListener('click', (e) => {
98      const $target = e.currentTarget.getAttribute('href');
99      const $targetFormatted = document.querySelector($target.substring(1)).offsetTop;
100      // document.documentElement.scrollTop = $targetFormatted.offsetTop;
101      // document.body.scrollTop = $targetFormatted.offsetTop;
102      window.scrollTo(
103        0,
104        $targetFormatted - document.querySelector('.site-header').getBoundingClientRect().height);
105    });
106  });
107
108  document.querySelectorAll('.btn-scroll-top--js').forEach((el, i) => {
109    el.addEventListener('click', (e) => {
110      e.preventDefault();
111      window.scrollTo(0, 0);
112    });
113  });
114
115
116  // Mac and IOS devices require different nav styling
117  let isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
118  let isIOS = /(iPhone|iPod|iPad)/i.test(navigator.platform);
119
120  if (isIOS || isMacLike) {
121    // $('.section-404').addClass('is-ios');
122    // $('.homepage-hero__item-inner').addClass('is-ios');
123  }
124
125  //
126
127  let isTouch;
128
129  function isTouchDevice() {
130    const prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
131    const mq = (query) => {
132      return window.matchMedia(query).matches;
133    };
134
135    if (
136      'ontouchstart' in window ||
137      // eslint-disable-next-line no-undef
138      (window.DocumentTouch && document instanceof DocumentTouch)
139    ) {
140      return true;
141    }
142
143    // include the 'heartz' as a way to have a non matching MQ to help terminate the join
144    // https://git.io/vznFH
145    const query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join(
146      ''
147    );
148    return mq(query);
149  }
150
151  if (isTouchDevice()) {
152    isTouch = true;
153    document.documentElement.classList.add('is-touch');
154  }
155
156  const getNextSibling = function(elem, selector) {
157
158    // Get the next sibling element
159    let sibling = elem.nextElementSibling;
160
161    // If there's no selector, return the first sibling
162    if (!selector) return sibling;
163
164    // If the sibling matches our selector, use it
165    // If not, jump to the next sibling and continue the loop
166    while (sibling) {
167      if (sibling.matches(selector)) return sibling;
168      sibling = sibling.nextElementSibling;
169    }
170
171  };
172
173  /// /* End of Setup helper functions */
174
175  function scrollToElement() {
176    if (window.location.hash.length > 1) {
177      const $element = document.querySelector(window.location.hash);
178      if ($element) {
179        setTimeout(function() {
180          window.scrollTo(
181            0,
182            $element.offsetTop - 150
183          );
184        }, 100);
185      }
186    }
187  }
188
189  scrollToElement();
190})
191();

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.