PageSourceSearch

https://www.dxracer.eu/static/js/lazyload.min.js?v=202609231327

js dxracer.eu collected 2026-09-30 03:25:12 UTC 5,724 bytes, 169 lines download raw bytes

1var vertical = '500px', observerGeneral = observerFocus = '';
2
3var configGeneral = {
4    rootMargin: vertical + ' 0px',
5    threshold: 0.01
6};
7
8var configFocus = {
9    threshold: 0.01
10};
11
12function onIntersectionGeneral(entries) {
13    entries.forEach(entry => {
14        if (entry.intersectionRatio > 0) {
15            observerGeneral.unobserve(entry.target);
16            preloadImage(entry.target);
17        }
18    });
19}
20
21function onIntersectionFocus(entries) {
22    entries.forEach(entry => {
23        if (entry.intersectionRatio > 0.01) {
24            if (entry.target.classList.contains('observe')) {
25                entry.target.classList.add('observing');
26
27                if (entry.target.nodeName == 'VIDEO') {
28                    if (!entry.target.matches('.video-once.ended')) {
29                        entry.target.play().then(_ => { }). catch(error => { });
30                    }
31                }
32            } else {
33                observerFocus.unobserve(entry.target);
34                if (entry.target.complete) {
35                    entry.target.classList.add('focused');
36                } else {
37                    entry.target.addEventListener('load', function() { this.classList.add('focused'); });
38                }
39            }
40        } else {
41            entry.target.classList.remove('observing');
42
43            if (entry.target.nodeName == 'VIDEO') {
44                entry.target.pause();
45                if (entry.target.classList.contains('video-from-start') && !entry.target.classList.contains('video-once')) {
46                    entry.target.currentTime = 0;
47                }
48            }
49        }
50    });
51}
52
53function preloadImage(i) {
54    loadImg = function(img) {
55        var obj = new Image();
56        obj.onload = function() {
57            img.setAttribute('src', obj.src);
58            img.classList.add('lazy-loaded');
59        }
60        obj.src = img.getAttribute('data-src');
61    }
62
63    if ( i.classList.contains('lazy-container') ) {
64        const images = i.querySelectorAll('img[data-src]');
65        Array.from(images).forEach(image => {
66            loadImg(image);
67        });
68    } else if ( i.classList.contains('lazyVideo') ) {
69        lazyVideoSwitch(i);
70    } else {
71        if ( !i.classList.contains('lazy-bg') ) {
72            if ( i.hasAttribute('data-srcset') ) { i.setAttribute('srcset',i.getAttribute('data-srcset')); }
73            if ( i.hasAttribute('data-src') ) {
74                loadImg(i);
75            }
76        }
77    }
78
79    if ( i.nodeName != 'IMG' || i.hasAttribute('data-srcset') ) {
80        i.classList.add('lazy-loaded');
81    }
82}
83
84var lazyImage = {};
85lazyImage = function(element) {
86    if (element != null) {
87        document.querySelectorAll(element).forEach(function(v, i) {
88            v.getAttribute('data-sizes', Math.ceil(v.parentElement.offsetWidth)+'px');
89        });
90    } else {
91        document.querySelectorAll('.lazyImage').forEach(function(v, i) {
92            v.getAttribute('data-sizes', Math.ceil(v.parentElement.offsetWidth)+'px');
93        });
94    }
95}
96
97function lazyVideoSwitch(i) {
98
99    if ( window.innerWidth >= 992 ) {
100        i.classList.remove('loaded-small', 'playing', 'ended');
101        i.classList.add('loaded-large');
102    } else {
103        i.classList.remove('loaded-large', 'playing', 'ended');
104        i.classList.add('loaded-small');
105    }
106
107    if ( i.parentElement.classList.contains('focus-video-obj') ) { i.parentElement.classList.remove('playing', 'ended'); } else { i.classList.remove('playing', 'ended'); }
108
109    var _this = i;
110    if (i.classList.contains('observing')) {
111        _this.play().then(_ => { }). catch(error => { });
112    }
113}
114
115function initLazyload() {
116    if (observerGeneral != '' || observerFocus != '') {
117        observerGeneral.disconnect();
118        observerFocus.disconnect();
119    }
120
121    var imgGeneral = document.querySelectorAll('.lazy'),
122        imgFocus = document.querySelectorAll('.lazy.lazy-focus'),
123        observeConsistent = document.querySelectorAll('.observe');
124
125    if (!('IntersectionObserver' in window)) {
126        Array.from(imgGeneral).forEach(obj => preloadImage(obj));
127        Array.from(imgFocus).forEach(obj => preloadImage(obj));
128    } else {
129        observerGeneral = new IntersectionObserver(onIntersectionGeneral, configGeneral);
130        observerFocus = new IntersectionObserver(onIntersectionFocus, configFocus);
131
132        imgGeneral.forEach(obj => {
133            if (!obj.classList.contains('lazy-loaded')) { observerGeneral.observe(obj); }
134        });
135
136        imgFocus.forEach(obj => {
137            if (!obj.classList.contains('lazy-loaded')) { observerFocus.observe(obj); }
138        });
139
140        observeConsistent.forEach(obj => {
141            observerFocus.observe(obj);
142        });
143    }
144
145    document.querySelectorAll('video.observe:not(.focus-play)').forEach(function(v, i){
146        var _this = v;
147        v.oncanplay = _this.classList.add('canplay');
148        v.onplay = function() { _this.classList.add('playing'); _this.classList.remove('paused', 'ended'); }
149        v.onpause = function() { _this.classList.add('paused'); _this.classList.remove('playing', 'ended'); }
150        v.onended = function() { _this.classList.add('ended'); _this.classList.remove('playing', 'paused'); };
151    });
152}
153
154initLazyload();
155lazyImage();
156window.onresize = function() {
157    lazyImage();
158
159    if ( window.innerWidth >= 992 ) {
160        document.querySelectorAll('.lazyVideo').forEach(function(v, i) {
161            if ( !v.classList.contains('loaded-large') ) { lazyVideoSwitch(v); }
162        });
163    } else {
164        document.querySelectorAll('.lazyVideo').forEach(function(v, i) {
165            if ( !v.classList.contains('loaded-small') ) { lazyVideoSwitch(v); }
166        });
167    }
168}
169window.lazyload = [];

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.