PageSourceSearch

https://pickleballunion.com/wp-content/themes/smart-mag-child/mrks…/block-highlighter/js/front.js?ver=0.5

js pickleballunion.com collected 2026-10-02 11:49:16 UTC 3,427 bytes, 111 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function() {
2
3    register_mutation_observer();
4    register_intersect_observers();
5
6    function register_mutation_observer()
7    {
8        const observer = new MutationObserver(function(mutationList, observer) {
9            for (const mutation of mutationList) {
10                if (mutation.type === "childList") {
11                    for (const addedNode of mutation.addedNodes) {
12                        if (addedNode.classList !== undefined) {
13                            if (addedNode.classList.contains('highlight-js')) {
14                                register_intersect_observers();
15                            }
16                        }
17                    }
18                }
19            }
20        });
21
22        observer.observe(document.body, {
23            attributes: false,
24            childList: true,
25            subtree: true
26        });
27    }
28
29    function register_intersect_observers() {
30        const blocks = document.querySelectorAll('.highlight-js');
31
32        blocks.forEach(function(item) {
33
34            // Not for first screen
35            const item_rect = item.getBoundingClientRect();
36            if (item_rect.y <= window.innerHeight) {
37                return;
38            }
39
40            let options = {
41                rootMargin: '-50% 0% -50% 0%',//"0px",
42                threshold: 0,
43            };
44            let observer = new IntersectionObserver(function(entry) {
45                entry.forEach(function(entry_item) {
46                    if (entry_item.isIntersecting === true) {
47                        highlight(entry_item.target);
48                    }
49                    else {
50                        unhighlight();
51                    }
52                });
53            }, options);
54
55            observer.observe(item);
56        });
57    }
58
59    function highlight(object)
60    {
61        if (typeof object.dataset != undefined && object.dataset.highlight == 'shake') {
62            object.classList.add('animation-shake');
63            setTimeout(function() {
64                object.classList.remove('animation-shake');
65            },800);
66        }
67        else {
68            object.classList.add('highlighted');
69            addOverlay();
70            var script = document.createElement("script");
71            script.src = "https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoad";
72            script.async = true;
73            script.defer = true;
74            document.body.appendChild(script);
75            document.addEventListener('click', unhighlight, {once: true});
76        }
77    }
78
79    function unhighlight()
80    {
81        const highlighted = document.querySelectorAll('.highlighted');
82        highlighted.forEach(function(entry) {
83            entry.classList.remove('highlighted');
84        });
85
86        removeOverlay();
87    }
88
89    function addOverlay()
90    {
91        let overlay = document.querySelector('.highlight-overlay');
92
93        if (overlay === null) {
94            overlay = document.createElement('div');
95            overlay.classList.add('highlight-overlay');
96            document.body.appendChild(overlay);
97
98            setTimeout(function() {
99                overlay.classList.add('active');
100            }, 100);
101        }
102    }
103
104    function removeOverlay()
105    {
106        const overlay = document.querySelector('.highlight-overlay');
107        if (overlay !== null) {
108            overlay.remove();
109        }
110    }
111});

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.