PageSourceSearch

https://www.uwphotographyguide.com/wp-content/plugins/advertising-module/assets/adv-tracker.js?ver=1.0.1

js uwphotographyguide.com collected 2026-10-02 04:44:21 UTC 4,430 bytes, 115 lines download raw bytes

1(function () {
2    function setup(el) {
3        if (!el || el.dataset.advInit) return;
4        el.dataset.advInit = '1';
5
6        var tracked = false;
7        function trackOnce() {
8            if (tracked) return;
9            tracked = true;
10            el.setAttribute('data-adv-tracked', '1');
11            var trackUrl = el.dataset.trackUrl;
12            var bannerId = el.dataset.bannerId;
13            if (!trackUrl || !bannerId) return;
14            fetch(trackUrl, {
15                method: 'POST',
16                headers: {'Content-Type': 'application/x-www-form-urlencoded'},
17                body: new URLSearchParams({ action: 'adv_track_view', banner_id: bannerId }).toString()
18            });
19        }
20
21        function isInViewport() {
22            var r = el.getBoundingClientRect();
23            return r.bottom > 0 &&
24                r.right  > 0 &&
25                r.top    < (window.innerHeight || document.documentElement.clientHeight) &&
26                r.left   < (window.innerWidth  || document.documentElement.clientWidth);
27        }
28
29        if ('IntersectionObserver' in window) {
30            try {
31                var io = new IntersectionObserver(function(entries){
32                    entries.forEach(function(entry){
33                        if (entry.isIntersecting && entry.intersectionRatio >= 0.5) {
34                            trackOnce();
35                            if (io) io.disconnect();
36                        }
37                    });
38                }, { threshold: [0.5] });
39                io.observe(el);
40                if (isInViewport()) { trackOnce(); if (io) io.disconnect(); }
41            } catch(e) {
42                if (isInViewport()) trackOnce();
43                var onScroll = function () {
44                    if (isInViewport()) {
45                        trackOnce();
46                        window.removeEventListener('scroll', onScroll);
47                        window.removeEventListener('resize', onScroll);
48                    }
49                };
50                window.addEventListener('scroll', onScroll, { passive: true });
51                window.addEventListener('resize', onScroll);
52            }
53        } else {
54            if (isInViewport()) trackOnce();
55            var onScroll = function () {
56                if (isInViewport()) {
57                    trackOnce();
58                    window.removeEventListener('scroll', onScroll);
59                    window.removeEventListener('resize', onScroll);
60                }
61            };
62            window.addEventListener('scroll', onScroll, { passive: true });
63            window.addEventListener('resize', onScroll);
64            document.addEventListener('DOMContentLoaded', function () {
65                if (isInViewport()) trackOnce();
66            });
67        }
68    }
69
70    function loadBanner(placeholder) {
71        if (!placeholder || placeholder.dataset.advLoaded) return;
72        placeholder.dataset.advLoaded = '1';
73
74        var shortcodeCode = placeholder.dataset.shortcodeCode;
75        var ajaxUrl = placeholder.dataset.ajaxUrl;
76
77        if (!shortcodeCode || !ajaxUrl) return;
78
79        fetch(ajaxUrl, {
80            method: 'POST',
81            headers: {'Content-Type': 'application/x-www-form-urlencoded'},
82            body: new URLSearchParams({ 
83                action: 'adv_load_banner', 
84                shortcode_code: shortcodeCode 
85            }).toString()
86        })
87        .then(function(response) { return response.json(); })
88        .then(function(data) {
89            if (data.success && data.data.html) {
90                placeholder.innerHTML = data.data.html;
91                // Setup tracking for the newly loaded banner
92                var banner = placeholder.querySelector('.advertising-banner');
93                if (banner) {
94                    setup(banner);
95                }
96            }
97        })
98        .catch(function(error) {
99            console.error('Error loading banner:', error);
100        });
101    }
102
103    function init() {
104        // Load all banner placeholders via AJAX
105        document.querySelectorAll('.advertising-banner-placeholder').forEach(loadBanner);
106        // Setup tracking for any existing banners (backward compatibility)
107        document.querySelectorAll('.advertising-banner').forEach(setup);
108    }
109
110    if (document.readyState === 'loading') {
111        document.addEventListener('DOMContentLoaded', init);
112    } else {
113        init();
114    }
115})();

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.