PageSourceSearch

https://edenbanqueting.it/wp-content/plugins/thegem-elements/inc/heading-animation/assets/js/main.js?ver=7.1.2

js edenbanqueting.it collected 2026-10-02 00:03:37 UTC 3,245 bytes, 81 lines download raw bytes

1(function() {
2    function TheGemHeading() {
3        this.animateClass = 'thegem-heading-animate';
4        this.animatedClass = 'thegem-heading-animated';
5    }
6
7    TheGemHeading.prototype = {
8        initialize: function () {
9            let items =  document.querySelectorAll('.'+this.animateClass);
10
11            items.forEach((item)=>{
12                if (this.isElementVisible(item)) {
13                    this.prepareAnimation(item);
14                    this.startAnimation(item);
15                }
16            });
17
18            if ('ResizeObserver' in window) {
19                const resizeObserver = new ResizeObserver((entries) => {
20                    entries.forEach((entry) => {
21                        this.prepareAnimation(entry.target);
22                    });
23                });
24                items.forEach((item) => {
25                    resizeObserver.observe(item);
26                });
27            }
28
29            if ('IntersectionObserver' in window) {
30                let intersectionObserver = new IntersectionObserver((entries)=>{
31                    entries.forEach((entry)=> {
32                        if (entry.isIntersecting) {
33                            this.startAnimation(entry.target);
34                            intersectionObserver.unobserve(entry.target);
35                        }
36                    });
37                });
38
39                items.forEach((item)=>{
40                    intersectionObserver.observe(item);
41                    this.prepareAnimation(item);
42                });
43            } else {
44                items.forEach((item)=>{
45                    this.prepareAnimation(item);
46                    this.startAnimation(item);
47                });
48            }
49        },
50
51        isElementVisible: function (element) {
52            let rect   = element.getBoundingClientRect(),
53                width  = window.innerWidth || document.documentElement.clientWidth,
54                height = window.innerHeight || document.documentElement.clientHeight,
55                efp    = (x, y) => document.elementFromPoint(x, y);
56
57            if (rect.right < 0 || rect.bottom < 0 || rect.left > width || rect.top > height) return false;
58            return (element.contains(efp(rect.left,  rect.top)) ||  element.contains(efp(rect.right, rect.top)) ||  element.contains(efp(rect.right, rect.bottom)) ||  element.contains(efp(rect.left,  rect.bottom)));
59        },
60
61        startAnimation: function (element) {
62            if (element && !element.classList.contains(this.animatedClass)) {
63                element.classList.add(this.animatedClass);
64                element.classList.remove(this.animateClass);
65                element.dispatchEvent(new Event('theGemHeading.startAnimation', {bubbles: true}));
66            }
67        },
68
69        prepareAnimation: function (element) {
70            if (element/* && !element.isPreparedAnimation*/) {
71                element.dispatchEvent(new Event('theGemHeading.prepareAnimation', {bubbles: true}));
72                /*element.isPreparedAnimation = true;*/
73            }
74        }
75    };
76
77    window.theGemHeading = new TheGemHeading();
78    document.addEventListener('DOMContentLoaded', function() {
79        window.theGemHeading.initialize();
80    });
81})();

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.