PageSourceSearch

https://bodo.su/wa-apps/shop/js/lazy.load.js?v12.3.0.1239

js bodo.su collected 2026-09-24 12:08:54 UTC 4,562 bytes, 140 lines download raw bytes

1(function($) {
2
3    $.fn.lazyLoad = function(options, ext) {
4
5        if (options == 'stop') {
6            var settings = this.data('lazyLoadSettings');
7            if (settings) {
8                settings.stopped = true;
9            }
10            return;
11        }
12        
13        if (options == 'reload') {
14            var settings = this.data('lazyLoadSettings');
15            if (settings) {
16                settings.stopped = false;
17                settings.loading = false;
18                this.get(0).onscroll = null;
19                this.lazyLoad(settings);
20            }
21            return;
22        }
23
24        if (options == 'sleep') {
25            var settings = this.data('lazyLoadSettings');
26            if (settings) {
27                settings.loading = true;
28            }
29            return;
30        }
31
32        if (options == 'wake') {
33            var settings = this.data('lazyLoadSettings');
34            if (settings) {
35                settings.loading = false;
36            }
37            return;
38        }
39
40        if (options == 'force') {
41            var settings = this.data('lazyLoadSettings');
42            if (settings) {
43                if (!settings.loading) {
44                    settings.load();
45                }
46            }
47            return;
48        }
49
50        if (options === 'get') {
51            var settings = this.data('lazyLoadSettings') || {};
52            return settings[ext];
53        }
54
55        this.data('lazyLoadSettings', $.extend({
56            distance: 50,
57            load: function() {},
58            container: container,
59            state: 'wake',
60            hash: location.hash.replace(/^[^#]*#\/*/, '').split('/')[0] || null,
61            distanceBetweenBottoms: null
62        }, options || {}));
63
64        var settings = this.data('lazyLoadSettings');
65        settings.loading = false;
66        settings.stopped = false;
67
68        var win = $(window);
69        var container = settings.container || $(this);
70
71        init();
72
73        function init()
74        {
75            if (settings.hash !== null) {
76                if (!$.isArray(settings.hash)) {
77                    settings.hash = [settings.hash];
78                }
79            }
80            $.fn.lazyLoad.call(win, settings.state);
81            initHandler();
82        }
83
84        function scrollHandler()
85        {
86            if (settings.stopped) {
87                this.onscroll = null;
88                return;
89            }
90            if (!settings.stopped && !settings.loading && distanceBetweenBottoms(container, win) <= settings.distance) {
91                if (settings.hash !== null) {
92                    var loc_hash = location.hash.replace(/^[^#]*#\/*/, '').split('/')[0];
93                    if (settings.hash.indexOf(loc_hash) === -1) {
94                        this.onscroll = null;
95                        return;
96                    }
97                }
98                settings.load();
99            }
100        }
101
102        function initHandler()
103        {
104            var interval = 350, h;
105            var timerId = setTimeout(h = function() {
106                if (settings.stopped) {
107                    clearTimeout(timerId);
108                    return;
109                }
110                if (settings.hash !== null) {
111                    var loc_hash = location.hash.replace(/^[^#]*#\/*/, '').split('/')[0];
112                    if (settings.hash.indexOf(loc_hash) === -1) {
113                        clearTimeout(timerId);
114                        return;
115                    }
116                }
117                if (!settings.loading) {
118                    var r = distanceBetweenBottoms(container, win);
119                    if (distanceBetweenBottoms(container, win) <= settings.distance) {
120                        settings.load();
121                        timerId = setTimeout(h, interval);
122                    } else {
123                        win.get(0).onscroll = scrollHandler;
124                        clearTimeout(timerId);
125                    }
126                } else {
127                    timerId = setTimeout(h, interval);
128                }
129            }, interval);
130        }
131
132        var distanceBetweenBottoms = typeof settings.distanceBetweenBottoms === 'function' ?
133            settings.distanceBetweenBottoms :
134            function (container, win, offset) {
135                container = typeof container === 'string' ? $(container) : container;
136                offset = offset || 0;
137                return (container.position().top + container.outerHeight() - offset) - (win.scrollTop() + win.height());
138            };
139    };
140})(jQuery);

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.