PageSourceSearch

https://tetracyclineb.com/lozad.js

js tetracyclineb.com collected 2026-10-08 08:55:38 UTC 8,784 bytes, 247 lines download raw bytes

vendor: 3,484 bytes, lines 1-93
1/*! lozad.js - v1.16.0 - 2020-09-10
2* https://github.com/ApoorvSaxena/lozad.js
3* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */
4
5
6(function (global, factory) {
7    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8        typeof define === 'function' && define.amd ? define(factory) :
9            (global.lozad = factory());
10}(this, (function () { 'use strict';
11
12    /**
13     * Detect IE browser
14     * @const {boolean}
15     * @private
16     */
17    var isIE = typeof document !== 'undefined' && document.documentMode;
18
19    /**
20     *
21     * @param {string} type
22     *
23     */
24    var support = function support(type) {
25        return window && window[type];
26    };
27
28    var validAttribute = ['data-iesrc', 'data-alt', 'data-src', 'data-srcset', 'data-background-image', 'data-toggle-class'];
29
30    var defaultConfig = {
31        rootMargin: '0px',
32        threshold: 0,
33        enableAutoReload: false,
34        load: function load(element) {
35            if (element.nodeName.toLowerCase() === 'picture') {
36                var img = element.querySelector('img');
37                var append = false;
38
39                if (img === null) {
40                    img = document.createElement('img');
41                    append = true;
42                }
43
44                if (isIE && element.getAttribute('data-iesrc')) {
45                    img.src = element.getAttribute('data-iesrc');
46                }
47
48                if (element.getAttribute('data-alt')) {
49                    img.alt = element.getAttribute('data-alt');
50                }
51
52                if (append) {
53                    element.append(img);
54                }
55            }
56
57            if (element.nodeName.toLowerCase() === 'video' && !element.getAttribute('data-src')) {
58                if (element.children) {
59                    var childs = element.children;
60                    var childSrc = void 0;
61                    for (var i = 0; i <= childs.length - 1; i++) {
62                        childSrc = childs[i].getAttribute('data-src');
63                        if (childSrc) {
64                            childs[i].src = childSrc;
65                        }
66                    }
67
68                    element.load();
69                }
70            }
71
72            if (element.getAttribute('data-poster')) {
73                element.poster = element.getAttribute('data-poster');
74            }
75
76            if (element.getAttribute('data-src')) {
77                element.src = element.getAttribute('data-src');
78            }
79
80            if (element.getAttribute('data-srcset')) {
81                element.setAttribute('srcset', element.getAttribute('data-srcset'));
82            }
83
84            var backgroundImageDelimiter = ',';
85            if (element.getAttribute('data-background-delimiter')) {
86                backgroundImageDelimiter = element.getAttribute('data-background-delimiter');
87            }
88
89            if (element.getAttribute('data-background-image')) {
90                element.style.backgroundImage = 'url(\'' + element.getAttribute('data-background-image').split(backgroundImageDelimiter).join('\'),url(\'') + '\')';
91            } else if (element.getAttribute('data-background-image-set')) {
92                var imageSetLinks = element.getAttribute('data-background-image-set').split(backgroundImageDelimiter);
93                var firstUrlLink = imageSetLinks[0].substr(0, imageSetLinks[0].indexOf(' ')) || imageSetLinks[0]; // Substring before ... 1x
94                firstUrlLink = firstUrlLink.indexOf('url(') === -1 ? 'url(' + firstUrlLink + ')' : firstUrlLink;
95                if (imageSetLinks.length === 1) {
96                    element.style.backgroundImage = firstUrlLink;
97                } else {
98                    element.setAttribute('style', (element.getAttribute('style') || '') + ('background-image: ' + firstUrlLink + '; background-image: -webkit-image-set(' + imageSetLinks + '); background-image: image-set(' + imageSetLinks + ')'));
99                }
100            }
101
102            if (element.getAttribute('data-toggle-class')) {
103                element.classList.toggle(element.getAttribute('data-toggle-class'));
104            }
105        },
106        loaded: function loaded() {}
107    };
108
109    function markAsLoaded(element) {
110        element.setAttribute('data-loaded', true);
111    }
112
113    function preLoad(element) {
114        if (element.getAttribute('data-placeholder-background')) {
115            element.style.background = element.getAttribute('data-placeholder-background');
116        }
117    }
118
119    var isLoaded = function isLoaded(element) {
120        return element.getAttribute('data-loaded') === 'true';
121    };
122
123    var onIntersection = function onIntersection(load, loaded) {
124        return function (entries, observer) {
125            entries.forEach(function (entry) {
126                if (entry.intersectionRatio > 0 || entry.isIntersecting) {
127                    observer.unobserve(entry.target);
128
129                    if (!isLoaded(entry.target)) {
130                        load(entry.target);
131                        markAsLoaded(entry.target);
132                        loaded(entry.target);
133                    }
134                }
135            });
136        };
137    };
138
139    var onMutation = function onMutation(load) {
140        return function (entries) {
141            entries.forEach(function (entry) {
142                if (isLoaded(entry.target) && entry.type === 'attributes' && validAttribute.indexOf(entry.attributeName) > -1) {
143                    load(entry.target);
144                }
145            });
146        };
147    };
148
149    var getElements = function getElements(selector) {
150        var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
151
152        if (selector instanceof Element) {
153            return [selector];
154        }
155
156        if (selector instanceof NodeList) {
157            return selector;
158        }
159
160        return root.querySelectorAll(selector);
161    };
162
163    function lozad () {
164        var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.lozad';
165        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
166
167        var _Object$assign = Object.assign({}, defaultConfig, options),
168            root = _Object$assign.root,
169            rootMargin = _Object$assign.rootMargin,
170            threshold = _Object$assign.threshold,
171            enableAutoReload = _Object$assign.enableAutoReload,
172            load = _Object$assign.load,
173            loaded = _Object$assign.loaded;
174
175        var observer = void 0;
176        var mutationObserver = void 0;
177        if (support('IntersectionObserver')) {
178            observer = new IntersectionObserver(onIntersection(load, loaded), {
179                root: root,
180                rootMargin: rootMargin,
181                threshold: threshold
182            });
183        }
184
185        if (support('MutationObserver') && enableAutoReload) {
186            mutationObserver = new MutationObserver(onMutation(load, loaded));
187        }
188
189        var elements = getElements(selector, root);
190        for (var i = 0; i < elements.length; i++) {
191            preLoad(elements[i]);
192        }
193
194        return {
195            observe: function observe() {
196                var elements = getElements(selector, root);
197
198                for (var _i = 0; _i < elements.length; _i++) {
199                    if (isLoaded(elements[_i])) {
200                        continue;
201                    }
202
203                    if (observer) {
204                        if (mutationObserver && enableAutoReload) {
205                            mutationObserver.observe(elements[_i], { subtree: true, attributes: true, attributeFilter: validAttribute });
206                        }
207
208                        observer.observe(elements[_i]);
209                        continue;
210                    }
211
212                    load(elements[_i]);
213                    markAsLoaded(elements[_i]);
214                    loaded(elements[_i]);
215                }
216            },
217            triggerLoad: function triggerLoad(element) {
218                if (isLoaded(element)) {
219                    return;
220                }
221
222                load(element);
223                markAsLoaded(element);
224                loaded(element);
225            },
226
227            observer: observer,
228            mutationObserver: mutationObserver
229        };
230    }
231
232    return lozad;
233
234})));
235
236(function(){
237    var bp = document.createElement('script');
238    var curProtocol = window.location.protocol.split(':')[0];
239    if (curProtocol === 'https') {
240        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
241    }
242    else {
243        bp.src = 'https://push.zhanzhang.baidu.com/push.js';
244    }
245    var s = document.getElementsByTagName("script")[0];
246    s.parentNode.insertBefore(bp, s);
247})();

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.