1(function (window, document) { 2 'use strict'; 3 4 var observer = null; 5 var mutationObserver = null; 6 var options = {}; 7 var initialized = false; 8 9 function elements() { 10 return Array.prototype.slice.call(document.querySelectorAll('[data-aos]')); 11 } 12 13 function dispatch(element, direction) { 14 var eventName = direction === 'in' ? 'aos:in' : 'aos:out'; 15 document.dispatchEvent(new CustomEvent(eventName, { detail: element })); 16 var id = element.getAttribute('data-aos-id'); 17 if (id) { 18 document.dispatchEvent(new CustomEvent(eventName + ':' + id, { detail: element })); 19 } 20 } 21 22 function reveal(element) { 23 if (element.classList.contains('aos-animate')) return; 24 element.classList.add('aos-animate'); 25 dispatch(element, 'in'); 26 } 27 28 function shouldDisable() { 29 if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return true; 30 if (options.disable === 'phone' && window.innerWidth < 768) return true; 31 return options.disable === true; 32 } 33 34 function prepare(element) { 35 if (element.classList.contains('aos-init')) return; 36 element.classList.add('aos-init'); 37 38 if (shouldDisable() || !('IntersectionObserver' in window)) { 39 reveal(element); 40 return; 41 } 42 43 observer.observe(element); 44 } 45 46 function refreshHard() { 47 elements().forEach(prepare); 48 } 49 50 function refresh() { 51 if (!initialized) return; 52 refreshHard(); 53 } 54 55 function start() { 56 if (initialized) return; 57 initialized = true; 58 59 document.body.setAttribute('data-aos-easing', options.easing || 'ease'); 60 document.body.setAttribute('data-aos-duration', String(options.duration || 400)); 61 document.body.setAttribute('data-aos-delay', String(options.delay || 0)); 62 63 var offset = Number(options.offset); 64 if (!Number.isFinite(offset)) offset = 120; 65 66 if (!shouldDisable() && 'IntersectionObserver' in window) { 67 observer = new IntersectionObserver(function (entries) { 68 entries.forEach(function (entry) { 69 if (entry.isIntersecting) { 70 reveal(entry.target); 71 if (options.once !== false || entry.target.getAttribute('data-aos-once') === 'true') { 72 observer.unobserve(entry.target); 73 } 74 } else if (options.once === false && entry.target.getAttribute('data-aos-once') !== 'true') { 75 entry.target.classList.remove('aos-animate'); 76 dispatch(entry.target, 'out'); 77 } 78 }); 79 }, { 80 rootMargin: '0px 0px -' + Math.max(0, offset) + 'px 0px', 81 threshold: 0.01, 82 }); 83 } 84 85 refreshHard(); 86 87 if ('MutationObserver' in window) { 88 mutationObserver = new MutationObserver(refreshHard); 89 mutationObserver.observe(document.documentElement, { childList: true, subtree: true }); 90 } 91 92 window.addEventListener('resize', refresh, { passive: true }); 93 } 94 95 window.AOS = { 96 init: function (settings) { 97 options = settings || {}; 98 if (document.readyState === 'loading') { 99 document.addEventListener('DOMContentLoaded', start, { once: true }); 100 } else { 101 start(); 102 } 103 }, 104 refresh: refresh, 105 refreshHard: refreshHard, 106 }; 107})(window, document);
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.