Version Description
- Enhancement: Update lazyload script to the latest version
- Enhancement: Apply lazyload on picture elements found on the page
- Enhancement: Apply lazyload on div elements with a background image found on the page. See FAQ for more info.
Download this release
Release Info
Developer | wp_media |
Plugin | Lazy Load by WP Rocket |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.1
- assets/js/lazyload-10.19.js +0 -448
- assets/js/lazyload-10.19.min.js +0 -2
- assets/js/lazyload-10.19.min.js.map +0 -1
- assets/js/lazyload-11.0.2.js +458 -0
- assets/js/lazyload-11.0.2.min.js +2 -0
- assets/js/lazyload-11.0.2.min.js.map +1 -0
- assets/js/lazyload-8.17.js +0 -480
- assets/js/lazyload-8.17.min.js +0 -2
- assets/js/lazyload-8.17.min.js.map +0 -1
- composer.lock +5 -5
- readme.txt +12 -3
- rocket-lazy-load.php +2 -2
- src/Subscriber/LazyloadSubscriber.php +3 -3
- vendor/composer/installed.json +6 -6
- vendor/wp-media/rocket-lazyload-common/src/Assets.php +7 -11
- vendor/wp-media/rocket-lazyload-common/src/Image.php +99 -0
assets/js/lazyload-10.19.js
DELETED
@@ -1,448 +0,0 @@
|
|
1 |
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
2 |
-
|
3 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
4 |
-
|
5 |
-
(function (global, factory) {
|
6 |
-
(typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
|
7 |
-
})(this, function () {
|
8 |
-
'use strict';
|
9 |
-
|
10 |
-
var defaultSettings = {
|
11 |
-
elements_selector: "img",
|
12 |
-
container: document,
|
13 |
-
threshold: 300,
|
14 |
-
thresholds: null,
|
15 |
-
data_src: "src",
|
16 |
-
data_srcset: "srcset",
|
17 |
-
data_sizes: "sizes",
|
18 |
-
data_bg: "bg",
|
19 |
-
class_loading: "loading",
|
20 |
-
class_loaded: "loaded",
|
21 |
-
class_error: "error",
|
22 |
-
load_delay: 0,
|
23 |
-
callback_load: null,
|
24 |
-
callback_error: null,
|
25 |
-
callback_set: null,
|
26 |
-
callback_enter: null,
|
27 |
-
callback_finish: null,
|
28 |
-
to_webp: false
|
29 |
-
};
|
30 |
-
|
31 |
-
var getInstanceSettings = function getInstanceSettings(customSettings) {
|
32 |
-
return _extends({}, defaultSettings, customSettings);
|
33 |
-
};
|
34 |
-
|
35 |
-
var dataPrefix = "data-";
|
36 |
-
var processedDataName = "was-processed";
|
37 |
-
var timeoutDataName = "ll-timeout";
|
38 |
-
var trueString = "true";
|
39 |
-
|
40 |
-
var getData = function getData(element, attribute) {
|
41 |
-
return element.getAttribute(dataPrefix + attribute);
|
42 |
-
};
|
43 |
-
|
44 |
-
var setData = function setData(element, attribute, value) {
|
45 |
-
var attrName = dataPrefix + attribute;
|
46 |
-
if (value === null) {
|
47 |
-
element.removeAttribute(attrName);
|
48 |
-
return;
|
49 |
-
}
|
50 |
-
element.setAttribute(attrName, value);
|
51 |
-
};
|
52 |
-
|
53 |
-
var setWasProcessedData = function setWasProcessedData(element) {
|
54 |
-
return setData(element, processedDataName, trueString);
|
55 |
-
};
|
56 |
-
|
57 |
-
var getWasProcessedData = function getWasProcessedData(element) {
|
58 |
-
return getData(element, processedDataName) === trueString;
|
59 |
-
};
|
60 |
-
|
61 |
-
var setTimeoutData = function setTimeoutData(element, value) {
|
62 |
-
return setData(element, timeoutDataName, value);
|
63 |
-
};
|
64 |
-
|
65 |
-
var getTimeoutData = function getTimeoutData(element) {
|
66 |
-
return getData(element, timeoutDataName);
|
67 |
-
};
|
68 |
-
|
69 |
-
var purgeProcessedElements = function purgeProcessedElements(elements) {
|
70 |
-
return elements.filter(function (element) {
|
71 |
-
return !getWasProcessedData(element);
|
72 |
-
});
|
73 |
-
};
|
74 |
-
|
75 |
-
var purgeOneElement = function purgeOneElement(elements, elementToPurge) {
|
76 |
-
return elements.filter(function (element) {
|
77 |
-
return element !== elementToPurge;
|
78 |
-
});
|
79 |
-
};
|
80 |
-
|
81 |
-
/* Creates instance and notifies it through the window element */
|
82 |
-
var createInstance = function createInstance(classObj, options) {
|
83 |
-
var event;
|
84 |
-
var eventString = "LazyLoad::Initialized";
|
85 |
-
var instance = new classObj(options);
|
86 |
-
try {
|
87 |
-
// Works in modern browsers
|
88 |
-
event = new CustomEvent(eventString, { detail: { instance: instance } });
|
89 |
-
} catch (err) {
|
90 |
-
// Works in Internet Explorer (all versions)
|
91 |
-
event = document.createEvent("CustomEvent");
|
92 |
-
event.initCustomEvent(eventString, false, false, { instance: instance });
|
93 |
-
}
|
94 |
-
window.dispatchEvent(event);
|
95 |
-
};
|
96 |
-
|
97 |
-
/* Auto initialization of one or more instances of lazyload, depending on the
|
98 |
-
options passed in (plain object or an array) */
|
99 |
-
function autoInitialize(classObj, options) {
|
100 |
-
if (!options) {
|
101 |
-
return;
|
102 |
-
}
|
103 |
-
if (!options.length) {
|
104 |
-
// Plain object
|
105 |
-
createInstance(classObj, options);
|
106 |
-
} else {
|
107 |
-
// Array of objects
|
108 |
-
for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
|
109 |
-
createInstance(classObj, optionsItem);
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
var replaceExtToWebp = function replaceExtToWebp(value, condition) {
|
115 |
-
return condition ? value.replace(/\.(jpe?g|png)/gi, ".webp") : value;
|
116 |
-
};
|
117 |
-
|
118 |
-
var detectWebp = function detectWebp() {
|
119 |
-
var webpString = "image/webp";
|
120 |
-
var canvas = document.createElement("canvas");
|
121 |
-
|
122 |
-
if (canvas.getContext && canvas.getContext("2d")) {
|
123 |
-
return canvas.toDataURL(webpString).indexOf('data:' + webpString) === 0;
|
124 |
-
}
|
125 |
-
|
126 |
-
return false;
|
127 |
-
};
|
128 |
-
|
129 |
-
var runningOnBrowser = typeof window !== "undefined";
|
130 |
-
|
131 |
-
var isBot = runningOnBrowser && !("onscroll" in window) || /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);
|
132 |
-
|
133 |
-
var supportsIntersectionObserver = runningOnBrowser && "IntersectionObserver" in window;
|
134 |
-
|
135 |
-
var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
|
136 |
-
|
137 |
-
var supportsWebp = runningOnBrowser && detectWebp();
|
138 |
-
|
139 |
-
var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName, toWebpFlag) {
|
140 |
-
for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
|
141 |
-
if (childTag.tagName === "SOURCE") {
|
142 |
-
var attrValue = getData(childTag, dataAttrName);
|
143 |
-
setAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);
|
144 |
-
}
|
145 |
-
}
|
146 |
-
};
|
147 |
-
|
148 |
-
var setAttributeIfValue = function setAttributeIfValue(element, attrName, value, toWebpFlag) {
|
149 |
-
if (!value) {
|
150 |
-
return;
|
151 |
-
}
|
152 |
-
element.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));
|
153 |
-
};
|
154 |
-
|
155 |
-
var setSourcesImg = function setSourcesImg(element, settings) {
|
156 |
-
var toWebpFlag = supportsWebp && settings.to_webp;
|
157 |
-
var srcsetDataName = settings.data_srcset;
|
158 |
-
var parent = element.parentNode;
|
159 |
-
|
160 |
-
if (parent && parent.tagName === "PICTURE") {
|
161 |
-
setSourcesInChildren(parent, "srcset", srcsetDataName, toWebpFlag);
|
162 |
-
}
|
163 |
-
var sizesDataValue = getData(element, settings.data_sizes);
|
164 |
-
setAttributeIfValue(element, "sizes", sizesDataValue);
|
165 |
-
var srcsetDataValue = getData(element, srcsetDataName);
|
166 |
-
setAttributeIfValue(element, "srcset", srcsetDataValue, toWebpFlag);
|
167 |
-
var srcDataValue = getData(element, settings.data_src);
|
168 |
-
setAttributeIfValue(element, "src", srcDataValue, toWebpFlag);
|
169 |
-
};
|
170 |
-
|
171 |
-
var setSourcesIframe = function setSourcesIframe(element, settings) {
|
172 |
-
var srcDataValue = getData(element, settings.data_src);
|
173 |
-
|
174 |
-
setAttributeIfValue(element, "src", srcDataValue);
|
175 |
-
};
|
176 |
-
|
177 |
-
var setSourcesVideo = function setSourcesVideo(element, settings) {
|
178 |
-
var srcDataName = settings.data_src;
|
179 |
-
var srcDataValue = getData(element, srcDataName);
|
180 |
-
|
181 |
-
setSourcesInChildren(element, "src", srcDataName);
|
182 |
-
setAttributeIfValue(element, "src", srcDataValue);
|
183 |
-
element.load();
|
184 |
-
};
|
185 |
-
|
186 |
-
var setSourcesBgImage = function setSourcesBgImage(element, settings) {
|
187 |
-
var toWebpFlag = supportsWebp && settings.to_webp;
|
188 |
-
var srcDataValue = getData(element, settings.data_src);
|
189 |
-
var bgDataValue = getData(element, settings.data_bg);
|
190 |
-
|
191 |
-
if (srcDataValue) {
|
192 |
-
var setValue = replaceExtToWebp(srcDataValue, toWebpFlag);
|
193 |
-
element.style.backgroundImage = 'url("' + setValue + '")';
|
194 |
-
}
|
195 |
-
|
196 |
-
if (bgDataValue) {
|
197 |
-
var _setValue = replaceExtToWebp(bgDataValue, toWebpFlag);
|
198 |
-
element.style.backgroundImage = _setValue;
|
199 |
-
}
|
200 |
-
};
|
201 |
-
|
202 |
-
var setSourcesFunctions = {
|
203 |
-
IMG: setSourcesImg,
|
204 |
-
IFRAME: setSourcesIframe,
|
205 |
-
VIDEO: setSourcesVideo
|
206 |
-
};
|
207 |
-
|
208 |
-
var setSources = function setSources(element, instance) {
|
209 |
-
var settings = instance._settings;
|
210 |
-
var tagName = element.tagName;
|
211 |
-
var setSourcesFunction = setSourcesFunctions[tagName];
|
212 |
-
if (setSourcesFunction) {
|
213 |
-
setSourcesFunction(element, settings);
|
214 |
-
instance._updateLoadingCount(1);
|
215 |
-
instance._elements = purgeOneElement(instance._elements, element);
|
216 |
-
return;
|
217 |
-
}
|
218 |
-
setSourcesBgImage(element, settings);
|
219 |
-
};
|
220 |
-
|
221 |
-
var addClass = function addClass(element, className) {
|
222 |
-
if (supportsClassList) {
|
223 |
-
element.classList.add(className);
|
224 |
-
return;
|
225 |
-
}
|
226 |
-
element.className += (element.className ? " " : "") + className;
|
227 |
-
};
|
228 |
-
|
229 |
-
var removeClass = function removeClass(element, className) {
|
230 |
-
if (supportsClassList) {
|
231 |
-
element.classList.remove(className);
|
232 |
-
return;
|
233 |
-
}
|
234 |
-
element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
|
235 |
-
};
|
236 |
-
|
237 |
-
var callbackIfSet = function callbackIfSet(callback, argument) {
|
238 |
-
if (callback) {
|
239 |
-
callback(argument);
|
240 |
-
}
|
241 |
-
};
|
242 |
-
|
243 |
-
var genericLoadEventName = "load";
|
244 |
-
var mediaLoadEventName = "loadeddata";
|
245 |
-
var errorEventName = "error";
|
246 |
-
|
247 |
-
var addEventListener = function addEventListener(element, eventName, handler) {
|
248 |
-
element.addEventListener(eventName, handler);
|
249 |
-
};
|
250 |
-
|
251 |
-
var removeEventListener = function removeEventListener(element, eventName, handler) {
|
252 |
-
element.removeEventListener(eventName, handler);
|
253 |
-
};
|
254 |
-
|
255 |
-
var addEventListeners = function addEventListeners(element, loadHandler, errorHandler) {
|
256 |
-
addEventListener(element, genericLoadEventName, loadHandler);
|
257 |
-
addEventListener(element, mediaLoadEventName, loadHandler);
|
258 |
-
addEventListener(element, errorEventName, errorHandler);
|
259 |
-
};
|
260 |
-
|
261 |
-
var removeEventListeners = function removeEventListeners(element, loadHandler, errorHandler) {
|
262 |
-
removeEventListener(element, genericLoadEventName, loadHandler);
|
263 |
-
removeEventListener(element, mediaLoadEventName, loadHandler);
|
264 |
-
removeEventListener(element, errorEventName, errorHandler);
|
265 |
-
};
|
266 |
-
|
267 |
-
var eventHandler = function eventHandler(event, success, instance) {
|
268 |
-
var settings = instance._settings;
|
269 |
-
var className = success ? settings.class_loaded : settings.class_error;
|
270 |
-
var callback = success ? settings.callback_load : settings.callback_error;
|
271 |
-
var element = event.target;
|
272 |
-
|
273 |
-
removeClass(element, settings.class_loading);
|
274 |
-
addClass(element, className);
|
275 |
-
callbackIfSet(callback, element);
|
276 |
-
|
277 |
-
instance._updateLoadingCount(-1);
|
278 |
-
};
|
279 |
-
|
280 |
-
var addOneShotEventListeners = function addOneShotEventListeners(element, instance) {
|
281 |
-
var loadHandler = function loadHandler(event) {
|
282 |
-
eventHandler(event, true, instance);
|
283 |
-
removeEventListeners(element, loadHandler, errorHandler);
|
284 |
-
};
|
285 |
-
var errorHandler = function errorHandler(event) {
|
286 |
-
eventHandler(event, false, instance);
|
287 |
-
removeEventListeners(element, loadHandler, errorHandler);
|
288 |
-
};
|
289 |
-
addEventListeners(element, loadHandler, errorHandler);
|
290 |
-
};
|
291 |
-
|
292 |
-
var managedTags = ["IMG", "IFRAME", "VIDEO"];
|
293 |
-
|
294 |
-
var loadAndUnobserve = function loadAndUnobserve(element, observer, instance) {
|
295 |
-
revealElement(element, instance);
|
296 |
-
observer.unobserve(element);
|
297 |
-
};
|
298 |
-
|
299 |
-
var cancelDelayLoad = function cancelDelayLoad(element) {
|
300 |
-
var timeoutId = getTimeoutData(element);
|
301 |
-
if (!timeoutId) {
|
302 |
-
return; // do nothing if timeout doesn't exist
|
303 |
-
}
|
304 |
-
clearTimeout(timeoutId);
|
305 |
-
setTimeoutData(element, null);
|
306 |
-
};
|
307 |
-
|
308 |
-
var delayLoad = function delayLoad(element, observer, instance) {
|
309 |
-
var loadDelay = instance._settings.load_delay;
|
310 |
-
var timeoutId = getTimeoutData(element);
|
311 |
-
if (timeoutId) {
|
312 |
-
return; // do nothing if timeout already set
|
313 |
-
}
|
314 |
-
timeoutId = setTimeout(function () {
|
315 |
-
loadAndUnobserve(element, observer, instance);
|
316 |
-
cancelDelayLoad(element);
|
317 |
-
}, loadDelay);
|
318 |
-
setTimeoutData(element, timeoutId);
|
319 |
-
};
|
320 |
-
|
321 |
-
function revealElement(element, instance, force) {
|
322 |
-
var settings = instance._settings;
|
323 |
-
if (!force && getWasProcessedData(element)) {
|
324 |
-
return; // element has already been processed and force wasn't true
|
325 |
-
}
|
326 |
-
callbackIfSet(settings.callback_enter, element);
|
327 |
-
if (managedTags.indexOf(element.tagName) > -1) {
|
328 |
-
addOneShotEventListeners(element, instance);
|
329 |
-
addClass(element, settings.class_loading);
|
330 |
-
}
|
331 |
-
setSources(element, instance);
|
332 |
-
setWasProcessedData(element);
|
333 |
-
callbackIfSet(settings.callback_set, element);
|
334 |
-
}
|
335 |
-
|
336 |
-
/* entry.isIntersecting needs fallback because is null on some versions of MS Edge, and
|
337 |
-
entry.intersectionRatio is not enough alone because it could be 0 on some intersecting elements */
|
338 |
-
var isIntersecting = function isIntersecting(entry) {
|
339 |
-
return entry.isIntersecting || entry.intersectionRatio > 0;
|
340 |
-
};
|
341 |
-
|
342 |
-
var getObserverSettings = function getObserverSettings(settings) {
|
343 |
-
return {
|
344 |
-
root: settings.container === document ? null : settings.container,
|
345 |
-
rootMargin: settings.thresholds || settings.threshold + "px"
|
346 |
-
};
|
347 |
-
};
|
348 |
-
|
349 |
-
var LazyLoad = function LazyLoad(customSettings, elements) {
|
350 |
-
this._settings = getInstanceSettings(customSettings);
|
351 |
-
this._setObserver();
|
352 |
-
this._loadingCount = 0;
|
353 |
-
this.update(elements);
|
354 |
-
};
|
355 |
-
|
356 |
-
LazyLoad.prototype = {
|
357 |
-
_manageIntersection: function _manageIntersection(entry) {
|
358 |
-
var observer = this._observer;
|
359 |
-
var loadDelay = this._settings.load_delay;
|
360 |
-
var element = entry.target;
|
361 |
-
|
362 |
-
// WITHOUT LOAD DELAY
|
363 |
-
if (!loadDelay) {
|
364 |
-
if (isIntersecting(entry)) {
|
365 |
-
loadAndUnobserve(element, observer, this);
|
366 |
-
}
|
367 |
-
return;
|
368 |
-
}
|
369 |
-
|
370 |
-
// WITH LOAD DELAY
|
371 |
-
if (isIntersecting(entry)) {
|
372 |
-
delayLoad(element, observer, this);
|
373 |
-
} else {
|
374 |
-
cancelDelayLoad(element);
|
375 |
-
}
|
376 |
-
},
|
377 |
-
|
378 |
-
_onIntersection: function _onIntersection(entries) {
|
379 |
-
entries.forEach(this._manageIntersection.bind(this));
|
380 |
-
},
|
381 |
-
|
382 |
-
_setObserver: function _setObserver() {
|
383 |
-
if (!supportsIntersectionObserver) {
|
384 |
-
return;
|
385 |
-
}
|
386 |
-
this._observer = new IntersectionObserver(this._onIntersection.bind(this), getObserverSettings(this._settings));
|
387 |
-
},
|
388 |
-
|
389 |
-
_updateLoadingCount: function _updateLoadingCount(plusMinus) {
|
390 |
-
this._loadingCount += plusMinus;
|
391 |
-
if (this._elements.length === 0 && this._loadingCount === 0) {
|
392 |
-
callbackIfSet(this._settings.callback_finish);
|
393 |
-
}
|
394 |
-
},
|
395 |
-
|
396 |
-
update: function update(elements) {
|
397 |
-
var _this = this;
|
398 |
-
|
399 |
-
var settings = this._settings;
|
400 |
-
var nodeSet = elements || settings.container.querySelectorAll(settings.elements_selector);
|
401 |
-
|
402 |
-
this._elements = purgeProcessedElements(Array.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility
|
403 |
-
);
|
404 |
-
|
405 |
-
if (isBot || !this._observer) {
|
406 |
-
this.loadAll();
|
407 |
-
return;
|
408 |
-
}
|
409 |
-
|
410 |
-
this._elements.forEach(function (element) {
|
411 |
-
_this._observer.observe(element);
|
412 |
-
});
|
413 |
-
},
|
414 |
-
|
415 |
-
destroy: function destroy() {
|
416 |
-
var _this2 = this;
|
417 |
-
|
418 |
-
if (this._observer) {
|
419 |
-
this._elements.forEach(function (element) {
|
420 |
-
_this2._observer.unobserve(element);
|
421 |
-
});
|
422 |
-
this._observer = null;
|
423 |
-
}
|
424 |
-
this._elements = null;
|
425 |
-
this._settings = null;
|
426 |
-
},
|
427 |
-
|
428 |
-
load: function load(element, force) {
|
429 |
-
revealElement(element, this, force);
|
430 |
-
},
|
431 |
-
|
432 |
-
loadAll: function loadAll() {
|
433 |
-
var _this3 = this;
|
434 |
-
|
435 |
-
var elements = this._elements;
|
436 |
-
elements.forEach(function (element) {
|
437 |
-
_this3.load(element);
|
438 |
-
});
|
439 |
-
}
|
440 |
-
};
|
441 |
-
|
442 |
-
/* Automatic instances creation if required (useful for async script loading) */
|
443 |
-
if (runningOnBrowser) {
|
444 |
-
autoInitialize(LazyLoad, window.lazyLoadOptions);
|
445 |
-
}
|
446 |
-
|
447 |
-
return LazyLoad;
|
448 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/lazyload-10.19.min.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";function t(t,e,n){var o=e._settings;!n&&i(t)||(C(o.callback_enter,t),R.indexOf(t.tagName)>-1&&(N(t,e),I(t,o.class_loading)),E(t,e),a(t),C(o.callback_set,t))}var e={elements_selector:"img",container:document,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,callback_load:null,callback_error:null,callback_set:null,callback_enter:null,callback_finish:null,to_webp:!1},n=function(t){return _extends({},e,t)},o=function(t,e){return t.getAttribute("data-"+e)},r=function(t,e,n){var o="data-"+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},a=function(t){return r(t,"was-processed","true")},i=function(t){return"true"===o(t,"was-processed")},s=function(t,e){return r(t,"ll-timeout",e)},c=function(t){return o(t,"ll-timeout")},l=function(t){return t.filter(function(t){return!i(t)})},u=function(t,e){return t.filter(function(t){return t!==e})},d=function(t,e){var n,o=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)},f=function(t,e){return e?t.replace(/\.(jpe?g|png)/gi,".webp"):t},_="undefined"!=typeof window,v=_&&!("onscroll"in window)||/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),g=_&&"IntersectionObserver"in window,h=_&&"classList"in document.createElement("p"),b=_&&function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))&&0===t.toDataURL("image/webp").indexOf("data:image/webp")}(),m=function(t,e,n,r){for(var a,i=0;a=t.children[i];i+=1)if("SOURCE"===a.tagName){var s=o(a,n);p(a,e,s,r)}},p=function(t,e,n,o){n&&t.setAttribute(e,f(n,o))},y=function(t,e){var n=b&&e.to_webp,r=o(t,e.data_src),a=o(t,e.data_bg);if(r){var i=f(r,n);t.style.backgroundImage='url("'+i+'")'}if(a){var s=f(a,n);t.style.backgroundImage=s}},w={IMG:function(t,e){var n=b&&e.to_webp,r=e.data_srcset,a=t.parentNode;a&&"PICTURE"===a.tagName&&m(a,"srcset",r,n);var i=o(t,e.data_sizes);p(t,"sizes",i);var s=o(t,r);p(t,"srcset",s,n);var c=o(t,e.data_src);p(t,"src",c,n)},IFRAME:function(t,e){var n=o(t,e.data_src);p(t,"src",n)},VIDEO:function(t,e){var n=e.data_src,r=o(t,n);m(t,"src",n),p(t,"src",r),t.load()}},E=function(t,e){var n=e._settings,o=t.tagName,r=w[o];if(r)return r(t,n),e._updateLoadingCount(1),void(e._elements=u(e._elements,t));y(t,n)},I=function(t,e){h?t.classList.add(e):t.className+=(t.className?" ":"")+e},L=function(t,e){h?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},C=function(t,e){t&&t(e)},O=function(t,e,n){t.addEventListener(e,n)},k=function(t,e,n){t.removeEventListener(e,n)},x=function(t,e,n){O(t,"load",e),O(t,"loadeddata",e),O(t,"error",n)},A=function(t,e,n){k(t,"load",e),k(t,"loadeddata",e),k(t,"error",n)},z=function(t,e,n){var o=n._settings,r=e?o.class_loaded:o.class_error,a=e?o.callback_load:o.callback_error,i=t.target;L(i,o.class_loading),I(i,r),C(a,i),n._updateLoadingCount(-1)},N=function(t,e){var n=function n(r){z(r,!0,e),A(t,n,o)},o=function o(r){z(r,!1,e),A(t,n,o)};x(t,n,o)},R=["IMG","IFRAME","VIDEO"],S=function(e,n,o){t(e,o),n.unobserve(e)},M=function(t){var e=c(t);e&&(clearTimeout(e),s(t,null))},j=function(t,e,n){var o=n._settings.load_delay,r=c(t);r||(r=setTimeout(function(){S(t,e,n),M(t)},o),s(t,r))},D=function(t){return t.isIntersecting||t.intersectionRatio>0},T=function(t){return{root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}},U=function(t,e){this._settings=n(t),this._setObserver(),this._loadingCount=0,this.update(e)};return U.prototype={_manageIntersection:function(t){var e=this._observer,n=this._settings.load_delay,o=t.target;n?D(t)?j(o,e,this):M(o):D(t)&&S(o,e,this)},_onIntersection:function(t){t.forEach(this._manageIntersection.bind(this))},_setObserver:function(){g&&(this._observer=new IntersectionObserver(this._onIntersection.bind(this),T(this._settings)))},_updateLoadingCount:function(t){this._loadingCount+=t,0===this._elements.length&&0===this._loadingCount&&C(this._settings.callback_finish)},update:function(t){var e=this,n=this._settings,o=t||n.container.querySelectorAll(n.elements_selector);this._elements=l(Array.prototype.slice.call(o)),!v&&this._observer?this._elements.forEach(function(t){e._observer.observe(t)}):this.loadAll()},destroy:function(){var t=this;this._observer&&(this._elements.forEach(function(e){t._observer.unobserve(e)}),this._observer=null),this._elements=null,this._settings=null},load:function(e,n){t(e,this,n)},loadAll:function(){var t=this;this._elements.forEach(function(e){t.load(e)})}},_&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)d(t,n);else d(t,e)}(U,window.lazyLoadOptions),U});
|
2 |
-
//# sourceMappingURL=lazyload-10.19.min.js.map
|
|
|
|
assets/js/lazyload-10.19.min.js.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["lazyload.js"],"names":["global","factory","exports","_typeof","module","define","amd","LazyLoad","this","revealElement","element","instance","force","callbackIfSet","settings","callback_enter","managedTags","tagName","setSources","setWasProcessedData","callback_set","defaultSettings","elements_selector","container","document","threshold","thresholds","data_src","data_srcset","data_sizes","data_bg","class_loading","class_loaded","class_error","load_delay","callback_load","callback_error","to_webp","customSettings","_extends","timeoutDataName","attribute","trueString","setData","getAttribute","dataPrefix","attrName","value","removeAttribute","getData","setTimeoutData","getWasProcessedData","getTimeoutData","elements","elementToPurge","createInstance","filter","classObj","options","event","detail","createEvent","initCustomEvent","window","replaceExtToWebp","condition","length","runningOnBrowser","detectWebp","createElement","navigator","userAgent","canvas","toDataURL","supportsClassList","supportsWebp","optionsItem","indexOf","setSourcesInChildren","parentTag","dataAttrName","toWebpFlag","childTag","i","children","attrValue","setAttributeIfValue","setAttribute","srcDataValue","bgDataValue","backgroundImage","setValue","style","IMG","IFRAME","srcsetDataName","parent","parentNode","sizesDataValue","srcsetDataValue","VIDEO","srcDataName","load","_settings","setSourcesFunction","setSourcesFunctions","_updateLoadingCount","purgeOneElement","_elements","setSourcesBgImage","className","classList","add","remove","replace","RegExp","callback","argument","genericLoadEventName","removeEventListener","eventName","addEventListeners","addEventListener","loadHandler","errorHandler","removeEventListeners","success","removeClass","addClass","addOneShotEventListeners","eventHandler","observer","loadAndUnobserve","cancelDelayLoad","timeoutId","clearTimeout","delayLoad","loadDelay","setTimeout","getObserverSettings","entry","isIntersecting","intersectionRatio","rootMargin","root","getInstanceSettings","_setObserver","_loadingCount","update","_manageIntersection","_observer","target","entries","forEach","bind","supportsIntersectionObserver","IntersectionObserver","_onIntersection","plusMinus","nodeSet","querySelectorAll","purgeProcessedElements","Array","prototype","slice","call","isBot","destroy","_this","observe","loadAll","_this2","unobserve","_this3","autoInitialize","lazyLoadOptions"],"mappings":"kYAAC,SAAUA,EAAQC,GACC,YAAnB,oBAAOC,QAAP,YAAAC,QAAOD,WA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AK5BkG,EAAqBlG,KAAA+F,cAInBG,oBAAA,SAAAoD,GACDtJ,KAzCmB2I,eAAAW,EAsCW,IAA1BtJ,KAAKoG,UAAU1C,QAAuC,IAAvB1D,KAAK2I,eAKzCC,EAAQ5I,KAAA+F,UAASlD,kBAEhB+F,OAAMW,SACL1G,GAAAA,IAAAA,EAAAA,KAFKvC,EAAWN,KAAK+F,UAKjBK,EAAYvD,GAFhBvC,EAASS,UAAUyI,iBAAiBlJ,EAASQ,mBAO7Cd,KAAAoG,UAAAqD,EACAC,MAAAC,UAAAC,MAAAC,KAAAN,KAGDO,GAAK1D,KAAU6C,UAKhBc,KAAAA,UAASd,QAAA,SAAA/I,GAAW8J,EAAAlB,UAAAmB,QAAA/J,KAJlBF,KAAAkK,WAOCH,QAAA,WAAA,IAAAI,EAAAnK,KADDA,KAAA8I,YAGA9I,KAAAoG,UAAA6C,QAAA,SAAA/I,GACAiK,EAAArB,UAAAsB,UAAAlK,KAEDF,KAAK+F,UAAY,MADjB/F,KAAKoG,UAAY,KAIlBN,KAAAA,UAAM,MAANA,KAAM,SAAS5F,EAASE,GAIxB8J,EAAShK,EAAAF,KAAWI,IACnB8J,QAAIrH,WAAW,IAAAwH,EAAArK,KACNiJ,KAAQ7C,UACXN,QAAK5F,SAAAA,GACVmK,EAFDvE,KAAA5F,OAQDoK,GAlXC,SAAArH,EAAAC,GACAC,GAAAA,EAGAA,GAAAA,EAAQnC,OAiBR,IAAK,IAAWoD,EAAPO,EAAI,EAAiBP,EAAclB,EAAQyB,GAAKA,GAAK,EAXhE5B,EAAAE,EAAAmB,QAJErB,EAAAE,EAAAC,GA6WDoH,CAAAvK,EAAAwD,OAAAgH,iBA7bDxK","file":"lazyload.min.js","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.LazyLoad = factory());\n}(this, (function () { 'use strict';\n\nconst defaultSettings = {\n\telements_selector: \"img\",\n\tcontainer: document,\n\tthreshold: 300,\n\tthresholds: null,\n\tdata_src: \"src\",\n\tdata_srcset: \"srcset\",\n\tdata_sizes: \"sizes\",\n\tdata_bg: \"bg\",\n\tclass_loading: \"loading\",\n\tclass_loaded: \"loaded\",\n\tclass_error: \"error\",\n\tload_delay: 0,\n\tcallback_load: null,\n\tcallback_error: null,\n\tcallback_set: null,\n\tcallback_enter: null,\n\tcallback_finish: null,\n\tto_webp: false\n};\n\nvar getInstanceSettings = customSettings => {\n\treturn Object.assign({}, defaultSettings, customSettings);\n};\n\nconst dataPrefix = \"data-\";\nconst processedDataName = \"was-processed\";\nconst timeoutDataName = \"ll-timeout\";\nconst trueString = \"true\";\n\nconst getData = (element, attribute) => {\n\treturn element.getAttribute(dataPrefix + attribute);\n};\n\nconst setData = (element, attribute, value) => {\n\tvar attrName = dataPrefix + attribute;\n\tif (value === null) {\n\t\telement.removeAttribute(attrName);\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, value);\n};\n\nconst setWasProcessedData = element =>\n\tsetData(element, processedDataName, trueString);\n\nconst getWasProcessedData = element =>\n\tgetData(element, processedDataName) === trueString;\n\nconst setTimeoutData = (element, value) =>\n\tsetData(element, timeoutDataName, value);\n\nconst getTimeoutData = element => getData(element, timeoutDataName);\n\nconst purgeProcessedElements = elements => {\n\treturn elements.filter(element => !getWasProcessedData(element));\n};\n\nconst purgeOneElement = (elements, elementToPurge) => {\n\treturn elements.filter(element => element !== elementToPurge);\n};\n\n/* Creates instance and notifies it through the window element */\nconst createInstance = function(classObj, options) {\n\tvar event;\n\tlet eventString = \"LazyLoad::Initialized\";\n\tlet instance = new classObj(options);\n\ttry {\n\t\t// Works in modern browsers\n\t\tevent = new CustomEvent(eventString, { detail: { instance } });\n\t} catch (err) {\n\t\t// Works in Internet Explorer (all versions)\n\t\tevent = document.createEvent(\"CustomEvent\");\n\t\tevent.initCustomEvent(eventString, false, false, { instance });\n\t}\n\twindow.dispatchEvent(event);\n};\n\n/* Auto initialization of one or more instances of lazyload, depending on the \n options passed in (plain object or an array) */\nfunction autoInitialize(classObj, options) {\n\tif (!options) {\n\t\treturn;\n\t}\n\tif (!options.length) {\n\t\t// Plain object\n\t\tcreateInstance(classObj, options);\n\t} else {\n\t\t// Array of objects\n\t\tfor (let i = 0, optionsItem; (optionsItem = options[i]); i += 1) {\n\t\t\tcreateInstance(classObj, optionsItem);\n\t\t}\n\t}\n}\n\nconst replaceExtToWebp = (value, condition) =>\n\tcondition ? value.replace(/\\.(jpe?g|png)/gi, \".webp\") : value;\n\nconst detectWebp = () => {\n\tvar webpString = \"image/webp\";\n\tvar canvas = document.createElement(\"canvas\");\n\n\tif (canvas.getContext && canvas.getContext(\"2d\")) {\n\t\treturn canvas.toDataURL(webpString).indexOf(`data:${webpString}`) === 0;\n\t}\n\n\treturn false;\n};\n\nconst runningOnBrowser = typeof window !== \"undefined\";\n\nconst isBot =\n\t(runningOnBrowser && !(\"onscroll\" in window)) ||\n\t/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);\n\nconst supportsIntersectionObserver =\n\trunningOnBrowser && \"IntersectionObserver\" in window;\n\nconst supportsClassList =\n\trunningOnBrowser && \"classList\" in document.createElement(\"p\");\n\nconst supportsWebp = runningOnBrowser && detectWebp();\n\nconst setSourcesInChildren = function(\n\tparentTag,\n\tattrName,\n\tdataAttrName,\n\ttoWebpFlag\n) {\n\tfor (let i = 0, childTag; (childTag = parentTag.children[i]); i += 1) {\n\t\tif (childTag.tagName === \"SOURCE\") {\n\t\t\tlet attrValue = getData(childTag, dataAttrName);\n\t\t\tsetAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);\n\t\t}\n\t}\n};\n\nconst setAttributeIfValue = function(\n\telement,\n\tattrName,\n\tvalue,\n\ttoWebpFlag\n) {\n\tif (!value) {\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));\n};\n\nconst setSourcesImg = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcsetDataName = settings.data_srcset;\n\tconst parent = element.parentNode;\n\n\tif (parent && parent.tagName === \"PICTURE\") {\n\t\tsetSourcesInChildren(parent, \"srcset\", srcsetDataName, toWebpFlag);\n\t}\n\tconst sizesDataValue = getData(element, settings.data_sizes);\n\tsetAttributeIfValue(element, \"sizes\", sizesDataValue);\n\tconst srcsetDataValue = getData(element, srcsetDataName);\n\tsetAttributeIfValue(element, \"srcset\", srcsetDataValue, toWebpFlag);\n\tconst srcDataValue = getData(element, settings.data_src);\n\tsetAttributeIfValue(element, \"src\", srcDataValue, toWebpFlag);\n};\n\nconst setSourcesIframe = (element, settings) => {\n\tconst srcDataValue = getData(element, settings.data_src);\n\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n};\n\nconst setSourcesVideo = (element, settings) => {\n\tconst srcDataName = settings.data_src;\n\tconst srcDataValue = getData(element, srcDataName);\n\n\tsetSourcesInChildren(element, \"src\", srcDataName);\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n\telement.load();\n};\n\nconst setSourcesBgImage = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcDataValue = getData(element, settings.data_src);\n\tconst bgDataValue = getData(element, settings.data_bg);\n\n\tif (srcDataValue) {\n\t\tlet setValue = replaceExtToWebp(srcDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = `url(\"${setValue}\")`;\n\t}\n\n\tif (bgDataValue) {\n\t\tlet setValue = replaceExtToWebp(bgDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = setValue;\n\t}\n};\n\nconst setSourcesFunctions = {\n\tIMG: setSourcesImg,\n\tIFRAME: setSourcesIframe,\n\tVIDEO: setSourcesVideo\n};\n\nconst setSources = (element, instance) => {\n\tconst settings = instance._settings;\n\tconst tagName = element.tagName;\n\tconst setSourcesFunction = setSourcesFunctions[tagName];\n\tif (setSourcesFunction) {\n\t\tsetSourcesFunction(element, settings);\n\t\tinstance._updateLoadingCount(1);\n\t\tinstance._elements = purgeOneElement(instance._elements, element);\n\t\treturn;\n\t}\n\tsetSourcesBgImage(element, settings);\n};\n\nconst addClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.add(className);\n\t\treturn;\n\t}\n\telement.className += (element.className ? \" \" : \"\") + className;\n};\n\nconst removeClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.remove(className);\n\t\treturn;\n\t}\n\telement.className = element.className.\n\t\treplace(new RegExp(\"(^|\\\\s+)\" + className + \"(\\\\s+|$)\"), \" \").\n\t\treplace(/^\\s+/, \"\").\n\t\treplace(/\\s+$/, \"\");\n};\n\nconst callbackIfSet = (callback, argument) => {\n\tif (callback) {\n\t\tcallback(argument);\n\t}\n};\n\nconst genericLoadEventName = \"load\";\nconst mediaLoadEventName = \"loadeddata\";\nconst errorEventName = \"error\";\n\nconst addEventListener = (element, eventName, handler) => {\n\telement.addEventListener(eventName, handler);\n};\n\nconst removeEventListener = (element, eventName, handler) => {\n\telement.removeEventListener(eventName, handler);\n};\n\nconst addEventListeners = (element, loadHandler, errorHandler) => {\n\taddEventListener(element, genericLoadEventName, loadHandler);\n\taddEventListener(element, mediaLoadEventName, loadHandler);\n\taddEventListener(element, errorEventName, errorHandler);\n};\n\nconst removeEventListeners = (element, loadHandler, errorHandler) => {\n\tremoveEventListener(element, genericLoadEventName, loadHandler);\n\tremoveEventListener(element, mediaLoadEventName, loadHandler);\n\tremoveEventListener(element, errorEventName, errorHandler);\n};\n\nconst eventHandler = function(event, success, instance) {\n\tvar settings = instance._settings;\n\tconst className = success ? settings.class_loaded : settings.class_error;\n\tconst callback = success ? settings.callback_load : settings.callback_error;\n\tconst element = event.target;\n\n\tremoveClass(element, settings.class_loading);\n\taddClass(element, className);\n\tcallbackIfSet(callback, element);\n\n\tinstance._updateLoadingCount(-1);\n};\n\nconst addOneShotEventListeners = (element, instance) => {\n\tconst loadHandler = event => {\n\t\teventHandler(event, true, instance);\n\t\tremoveEventListeners(element, loadHandler, errorHandler);\n\t};\n\tconst errorHandler = event => {\n\t\teventHandler(event, false, instance);\n\t\tremoveEventListeners(element, loadHandler, errorHandler);\n\t};\n\taddEventListeners(element, loadHandler, errorHandler);\n};\n\nconst managedTags = [\"IMG\", \"IFRAME\", \"VIDEO\"];\n\nconst loadAndUnobserve = (element, observer, instance) => {\n\trevealElement(element, instance);\n\tobserver.unobserve(element);\n};\n\nconst cancelDelayLoad = element => {\n\tvar timeoutId = getTimeoutData(element);\n\tif (!timeoutId) {\n\t\treturn; // do nothing if timeout doesn't exist\n\t}\n\tclearTimeout(timeoutId);\n\tsetTimeoutData(element, null);\n};\n\nconst delayLoad = (element, observer, instance) => {\n\tvar loadDelay = instance._settings.load_delay;\n\tvar timeoutId = getTimeoutData(element);\n\tif (timeoutId) {\n\t\treturn; // do nothing if timeout already set\n\t}\n\ttimeoutId = setTimeout(function() {\n\t\tloadAndUnobserve(element, observer, instance);\n\t\tcancelDelayLoad(element);\n\t}, loadDelay);\n\tsetTimeoutData(element, timeoutId);\n};\n\nfunction revealElement(element, instance, force) {\n\tvar settings = instance._settings;\n\tif (!force && getWasProcessedData(element)) {\n\t\treturn; // element has already been processed and force wasn't true\n\t}\n\tcallbackIfSet(settings.callback_enter, element);\n\tif (managedTags.indexOf(element.tagName) > -1) {\n\t\taddOneShotEventListeners(element, instance);\n\t\taddClass(element, settings.class_loading);\n\t}\n\tsetSources(element, instance);\n\tsetWasProcessedData(element);\n\tcallbackIfSet(settings.callback_set, element);\n}\n\n/* entry.isIntersecting needs fallback because is null on some versions of MS Edge, and\n entry.intersectionRatio is not enough alone because it could be 0 on some intersecting elements */\nconst isIntersecting = entry =>\n\tentry.isIntersecting || entry.intersectionRatio > 0;\n\nconst getObserverSettings = settings => ({\n\troot: settings.container === document ? null : settings.container,\n\trootMargin: settings.thresholds || settings.threshold + \"px\"\n});\n\nconst LazyLoad = function(customSettings, elements) {\n\tthis._settings = getInstanceSettings(customSettings);\n\tthis._setObserver();\n\tthis._loadingCount = 0;\n\tthis.update(elements);\n};\n\nLazyLoad.prototype = {\n\t_manageIntersection: function(entry) {\n\t\tvar observer = this._observer;\n\t\tvar loadDelay = this._settings.load_delay;\n\t\tvar element = entry.target;\n\n\t\t// WITHOUT LOAD DELAY\n\t\tif (!loadDelay) {\n\t\t\tif (isIntersecting(entry)) {\n\t\t\t\tloadAndUnobserve(element, observer, this);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// WITH LOAD DELAY\n\t\tif (isIntersecting(entry)) {\n\t\t\tdelayLoad(element, observer, this);\n\t\t} else {\n\t\t\tcancelDelayLoad(element);\n\t\t}\n\t},\n\n\t_onIntersection: function(entries) {\n\t\tentries.forEach(this._manageIntersection.bind(this));\n\t},\n\n\t_setObserver: function() {\n\t\tif (!supportsIntersectionObserver) {\n\t\t\treturn;\n\t\t}\n\t\tthis._observer = new IntersectionObserver(\n\t\t\tthis._onIntersection.bind(this),\n\t\t\tgetObserverSettings(this._settings)\n\t\t);\n\t},\n\n\t_updateLoadingCount: function(plusMinus) {\n\t\tthis._loadingCount += plusMinus;\n\t\tif (this._elements.length === 0 && this._loadingCount === 0) {\n\t\t\tcallbackIfSet(this._settings.callback_finish);\n\t\t}\n\t},\n\n\tupdate: function(elements) {\n\t\tconst settings = this._settings;\n\t\tconst nodeSet =\n\t\t\telements ||\n\t\t\tsettings.container.querySelectorAll(settings.elements_selector);\n\n\t\tthis._elements = purgeProcessedElements(\n\t\t\tArray.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility\n\t\t);\n\n\t\tif (isBot || !this._observer) {\n\t\t\tthis.loadAll();\n\t\t\treturn;\n\t\t}\n\n\t\tthis._elements.forEach(element => {\n\t\t\tthis._observer.observe(element);\n\t\t});\n\t},\n\n\tdestroy: function() {\n\t\tif (this._observer) {\n\t\t\tthis._elements.forEach(element => {\n\t\t\t\tthis._observer.unobserve(element);\n\t\t\t});\n\t\t\tthis._observer = null;\n\t\t}\n\t\tthis._elements = null;\n\t\tthis._settings = null;\n\t},\n\n\tload: function(element, force) {\n\t\trevealElement(element, this, force);\n\t},\n\n\tloadAll: function() {\n\t\tvar elements = this._elements;\n\t\telements.forEach(element => {\n\t\t\tthis.load(element);\n\t\t});\n\t}\n};\n\n/* Automatic instances creation if required (useful for async script loading) */\nif (runningOnBrowser) {\n\tautoInitialize(LazyLoad, window.lazyLoadOptions);\n}\n\nreturn LazyLoad;\n\n})));\n"]}
|
|
assets/js/lazyload-11.0.2.js
ADDED
@@ -0,0 +1,458 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
2 |
+
|
3 |
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4 |
+
|
5 |
+
(function (global, factory) {
|
6 |
+
(typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
|
7 |
+
})(this, function () {
|
8 |
+
'use strict';
|
9 |
+
|
10 |
+
var runningOnBrowser = typeof window !== "undefined";
|
11 |
+
var isBot = runningOnBrowser && !("onscroll" in window) || typeof navigator !== "undefined" && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);
|
12 |
+
var supportsIntersectionObserver = runningOnBrowser && "IntersectionObserver" in window;
|
13 |
+
var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
|
14 |
+
var defaultSettings = {
|
15 |
+
elements_selector: "img",
|
16 |
+
container: isBot || runningOnBrowser ? document : null,
|
17 |
+
threshold: 300,
|
18 |
+
thresholds: null,
|
19 |
+
data_src: "src",
|
20 |
+
data_srcset: "srcset",
|
21 |
+
data_sizes: "sizes",
|
22 |
+
data_bg: "bg",
|
23 |
+
class_loading: "loading",
|
24 |
+
class_loaded: "loaded",
|
25 |
+
class_error: "error",
|
26 |
+
load_delay: 0,
|
27 |
+
auto_unobserve: true,
|
28 |
+
callback_enter: null,
|
29 |
+
callback_exit: null,
|
30 |
+
callback_reveal: null,
|
31 |
+
callback_loaded: null,
|
32 |
+
callback_error: null,
|
33 |
+
callback_finish: null
|
34 |
+
};
|
35 |
+
|
36 |
+
var getInstanceSettings = function getInstanceSettings(customSettings) {
|
37 |
+
return _extends({}, defaultSettings, customSettings);
|
38 |
+
};
|
39 |
+
|
40 |
+
var dataPrefix = "data-";
|
41 |
+
var processedDataName = "was-processed";
|
42 |
+
var timeoutDataName = "ll-timeout";
|
43 |
+
var trueString = "true";
|
44 |
+
|
45 |
+
var getData = function getData(element, attribute) {
|
46 |
+
return element.getAttribute(dataPrefix + attribute);
|
47 |
+
};
|
48 |
+
|
49 |
+
var setData = function setData(element, attribute, value) {
|
50 |
+
var attrName = dataPrefix + attribute;
|
51 |
+
|
52 |
+
if (value === null) {
|
53 |
+
element.removeAttribute(attrName);
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
element.setAttribute(attrName, value);
|
58 |
+
};
|
59 |
+
|
60 |
+
var setWasProcessedData = function setWasProcessedData(element) {
|
61 |
+
return setData(element, processedDataName, trueString);
|
62 |
+
};
|
63 |
+
|
64 |
+
var getWasProcessedData = function getWasProcessedData(element) {
|
65 |
+
return getData(element, processedDataName) === trueString;
|
66 |
+
};
|
67 |
+
|
68 |
+
var setTimeoutData = function setTimeoutData(element, value) {
|
69 |
+
return setData(element, timeoutDataName, value);
|
70 |
+
};
|
71 |
+
|
72 |
+
var getTimeoutData = function getTimeoutData(element) {
|
73 |
+
return getData(element, timeoutDataName);
|
74 |
+
};
|
75 |
+
|
76 |
+
var purgeProcessedElements = function purgeProcessedElements(elements) {
|
77 |
+
return elements.filter(function (element) {
|
78 |
+
return !getWasProcessedData(element);
|
79 |
+
});
|
80 |
+
};
|
81 |
+
|
82 |
+
var purgeOneElement = function purgeOneElement(elements, elementToPurge) {
|
83 |
+
return elements.filter(function (element) {
|
84 |
+
return element !== elementToPurge;
|
85 |
+
});
|
86 |
+
};
|
87 |
+
/* Creates instance and notifies it through the window element */
|
88 |
+
|
89 |
+
|
90 |
+
var createInstance = function createInstance(classObj, options) {
|
91 |
+
var event;
|
92 |
+
var eventString = "LazyLoad::Initialized";
|
93 |
+
var instance = new classObj(options);
|
94 |
+
|
95 |
+
try {
|
96 |
+
// Works in modern browsers
|
97 |
+
event = new CustomEvent(eventString, {
|
98 |
+
detail: {
|
99 |
+
instance: instance
|
100 |
+
}
|
101 |
+
});
|
102 |
+
} catch (err) {
|
103 |
+
// Works in Internet Explorer (all versions)
|
104 |
+
event = document.createEvent("CustomEvent");
|
105 |
+
event.initCustomEvent(eventString, false, false, {
|
106 |
+
instance: instance
|
107 |
+
});
|
108 |
+
}
|
109 |
+
|
110 |
+
window.dispatchEvent(event);
|
111 |
+
};
|
112 |
+
/* Auto initialization of one or more instances of lazyload, depending on the
|
113 |
+
options passed in (plain object or an array) */
|
114 |
+
|
115 |
+
|
116 |
+
function autoInitialize(classObj, options) {
|
117 |
+
if (!options) {
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
if (!options.length) {
|
122 |
+
// Plain object
|
123 |
+
createInstance(classObj, options);
|
124 |
+
} else {
|
125 |
+
// Array of objects
|
126 |
+
for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
|
127 |
+
createInstance(classObj, optionsItem);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
var callbackIfSet = function callbackIfSet(callback, argument) {
|
133 |
+
if (callback) {
|
134 |
+
callback(argument);
|
135 |
+
}
|
136 |
+
};
|
137 |
+
|
138 |
+
var updateLoadingCount = function updateLoadingCount(instance, plusMinus) {
|
139 |
+
instance._loadingCount += plusMinus;
|
140 |
+
|
141 |
+
if (instance._elements.length === 0 && instance._loadingCount === 0) {
|
142 |
+
callbackIfSet(instance._settings.callback_finish);
|
143 |
+
}
|
144 |
+
};
|
145 |
+
|
146 |
+
var getSourceTags = function getSourceTags(parentTag) {
|
147 |
+
var sourceTags = [];
|
148 |
+
|
149 |
+
for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
|
150 |
+
if (childTag.tagName === "SOURCE") {
|
151 |
+
sourceTags.push(childTag);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
return sourceTags;
|
156 |
+
};
|
157 |
+
|
158 |
+
var setAttributeIfValue = function setAttributeIfValue(element, attrName, value) {
|
159 |
+
if (!value) {
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
|
163 |
+
element.setAttribute(attrName, value);
|
164 |
+
};
|
165 |
+
|
166 |
+
var setImageAttributes = function setImageAttributes(element, settings) {
|
167 |
+
setAttributeIfValue(element, "sizes", getData(element, settings.data_sizes));
|
168 |
+
setAttributeIfValue(element, "srcset", getData(element, settings.data_srcset));
|
169 |
+
setAttributeIfValue(element, "src", getData(element, settings.data_src));
|
170 |
+
};
|
171 |
+
|
172 |
+
var setSourcesImg = function setSourcesImg(element, settings) {
|
173 |
+
var parent = element.parentNode;
|
174 |
+
|
175 |
+
if (parent && parent.tagName === "PICTURE") {
|
176 |
+
var sourceTags = getSourceTags(parent);
|
177 |
+
sourceTags.forEach(function (sourceTag) {
|
178 |
+
setImageAttributes(sourceTag, settings);
|
179 |
+
});
|
180 |
+
}
|
181 |
+
|
182 |
+
setImageAttributes(element, settings);
|
183 |
+
};
|
184 |
+
|
185 |
+
var setSourcesIframe = function setSourcesIframe(element, settings) {
|
186 |
+
setAttributeIfValue(element, "src", getData(element, settings.data_src));
|
187 |
+
};
|
188 |
+
|
189 |
+
var setSourcesVideo = function setSourcesVideo(element, settings) {
|
190 |
+
var sourceTags = getSourceTags(element);
|
191 |
+
sourceTags.forEach(function (sourceTag) {
|
192 |
+
setAttributeIfValue(sourceTag, "src", getData(sourceTag, settings.data_src));
|
193 |
+
});
|
194 |
+
setAttributeIfValue(element, "src", getData(element, settings.data_src));
|
195 |
+
element.load();
|
196 |
+
};
|
197 |
+
|
198 |
+
var setSourcesBgImage = function setSourcesBgImage(element, settings) {
|
199 |
+
var srcDataValue = getData(element, settings.data_src);
|
200 |
+
var bgDataValue = getData(element, settings.data_bg);
|
201 |
+
|
202 |
+
if (srcDataValue) {
|
203 |
+
element.style.backgroundImage = "url(\"".concat(srcDataValue, "\")");
|
204 |
+
}
|
205 |
+
|
206 |
+
if (bgDataValue) {
|
207 |
+
element.style.backgroundImage = bgDataValue;
|
208 |
+
}
|
209 |
+
};
|
210 |
+
|
211 |
+
var setSourcesFunctions = {
|
212 |
+
IMG: setSourcesImg,
|
213 |
+
IFRAME: setSourcesIframe,
|
214 |
+
VIDEO: setSourcesVideo
|
215 |
+
};
|
216 |
+
|
217 |
+
var setSources = function setSources(element, instance) {
|
218 |
+
var settings = instance._settings;
|
219 |
+
var tagName = element.tagName;
|
220 |
+
var setSourcesFunction = setSourcesFunctions[tagName];
|
221 |
+
|
222 |
+
if (setSourcesFunction) {
|
223 |
+
setSourcesFunction(element, settings);
|
224 |
+
updateLoadingCount(instance, 1);
|
225 |
+
instance._elements = purgeOneElement(instance._elements, element);
|
226 |
+
return;
|
227 |
+
}
|
228 |
+
|
229 |
+
setSourcesBgImage(element, settings);
|
230 |
+
};
|
231 |
+
|
232 |
+
var addClass = function addClass(element, className) {
|
233 |
+
if (supportsClassList) {
|
234 |
+
element.classList.add(className);
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
|
238 |
+
element.className += (element.className ? " " : "") + className;
|
239 |
+
};
|
240 |
+
|
241 |
+
var removeClass = function removeClass(element, className) {
|
242 |
+
if (supportsClassList) {
|
243 |
+
element.classList.remove(className);
|
244 |
+
return;
|
245 |
+
}
|
246 |
+
|
247 |
+
element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
|
248 |
+
};
|
249 |
+
|
250 |
+
var genericLoadEventName = "load";
|
251 |
+
var mediaLoadEventName = "loadeddata";
|
252 |
+
var errorEventName = "error";
|
253 |
+
|
254 |
+
var addEventListener = function addEventListener(element, eventName, handler) {
|
255 |
+
element.addEventListener(eventName, handler);
|
256 |
+
};
|
257 |
+
|
258 |
+
var removeEventListener = function removeEventListener(element, eventName, handler) {
|
259 |
+
element.removeEventListener(eventName, handler);
|
260 |
+
};
|
261 |
+
|
262 |
+
var addEventListeners = function addEventListeners(element, loadHandler, errorHandler) {
|
263 |
+
addEventListener(element, genericLoadEventName, loadHandler);
|
264 |
+
addEventListener(element, mediaLoadEventName, loadHandler);
|
265 |
+
addEventListener(element, errorEventName, errorHandler);
|
266 |
+
};
|
267 |
+
|
268 |
+
var removeEventListeners = function removeEventListeners(element, loadHandler, errorHandler) {
|
269 |
+
removeEventListener(element, genericLoadEventName, loadHandler);
|
270 |
+
removeEventListener(element, mediaLoadEventName, loadHandler);
|
271 |
+
removeEventListener(element, errorEventName, errorHandler);
|
272 |
+
};
|
273 |
+
|
274 |
+
var eventHandler = function eventHandler(event, success, instance) {
|
275 |
+
var settings = instance._settings;
|
276 |
+
var className = success ? settings.class_loaded : settings.class_error;
|
277 |
+
var callback = success ? settings.callback_loaded : settings.callback_error;
|
278 |
+
var element = event.target;
|
279 |
+
removeClass(element, settings.class_loading);
|
280 |
+
addClass(element, className);
|
281 |
+
callbackIfSet(callback, element);
|
282 |
+
updateLoadingCount(instance, -1);
|
283 |
+
};
|
284 |
+
|
285 |
+
var addOneShotEventListeners = function addOneShotEventListeners(element, instance) {
|
286 |
+
var loadHandler = function loadHandler(event) {
|
287 |
+
eventHandler(event, true, instance);
|
288 |
+
removeEventListeners(element, loadHandler, errorHandler);
|
289 |
+
};
|
290 |
+
|
291 |
+
var errorHandler = function errorHandler(event) {
|
292 |
+
eventHandler(event, false, instance);
|
293 |
+
removeEventListeners(element, loadHandler, errorHandler);
|
294 |
+
};
|
295 |
+
|
296 |
+
addEventListeners(element, loadHandler, errorHandler);
|
297 |
+
};
|
298 |
+
|
299 |
+
var managedTags = ["IMG", "IFRAME", "VIDEO"];
|
300 |
+
|
301 |
+
var onEnter = function onEnter(element, instance) {
|
302 |
+
var settings = instance._settings;
|
303 |
+
callbackIfSet(settings.callback_enter, element);
|
304 |
+
|
305 |
+
if (!settings.load_delay) {
|
306 |
+
revealAndUnobserve(element, instance);
|
307 |
+
return;
|
308 |
+
}
|
309 |
+
|
310 |
+
delayLoad(element, instance);
|
311 |
+
};
|
312 |
+
|
313 |
+
var revealAndUnobserve = function revealAndUnobserve(element, instance) {
|
314 |
+
var observer = instance._observer;
|
315 |
+
revealElement(element, instance);
|
316 |
+
|
317 |
+
if (observer && instance._settings.auto_unobserve) {
|
318 |
+
observer.unobserve(element);
|
319 |
+
}
|
320 |
+
};
|
321 |
+
|
322 |
+
var onExit = function onExit(element, instance) {
|
323 |
+
var settings = instance._settings;
|
324 |
+
callbackIfSet(settings.callback_exit, element);
|
325 |
+
|
326 |
+
if (!settings.load_delay) {
|
327 |
+
return;
|
328 |
+
}
|
329 |
+
|
330 |
+
cancelDelayLoad(element);
|
331 |
+
};
|
332 |
+
|
333 |
+
var cancelDelayLoad = function cancelDelayLoad(element) {
|
334 |
+
var timeoutId = getTimeoutData(element);
|
335 |
+
|
336 |
+
if (!timeoutId) {
|
337 |
+
return; // do nothing if timeout doesn't exist
|
338 |
+
}
|
339 |
+
|
340 |
+
clearTimeout(timeoutId);
|
341 |
+
setTimeoutData(element, null);
|
342 |
+
};
|
343 |
+
|
344 |
+
var delayLoad = function delayLoad(element, instance) {
|
345 |
+
var loadDelay = instance._settings.load_delay;
|
346 |
+
var timeoutId = getTimeoutData(element);
|
347 |
+
|
348 |
+
if (timeoutId) {
|
349 |
+
return; // do nothing if timeout already set
|
350 |
+
}
|
351 |
+
|
352 |
+
timeoutId = setTimeout(function () {
|
353 |
+
revealAndUnobserve(element, instance);
|
354 |
+
cancelDelayLoad(element);
|
355 |
+
}, loadDelay);
|
356 |
+
setTimeoutData(element, timeoutId);
|
357 |
+
};
|
358 |
+
|
359 |
+
var revealElement = function revealElement(element, instance, force) {
|
360 |
+
var settings = instance._settings;
|
361 |
+
|
362 |
+
if (!force && getWasProcessedData(element)) {
|
363 |
+
return; // element has already been processed and force wasn't true
|
364 |
+
}
|
365 |
+
|
366 |
+
if (managedTags.indexOf(element.tagName) > -1) {
|
367 |
+
addOneShotEventListeners(element, instance);
|
368 |
+
addClass(element, settings.class_loading);
|
369 |
+
}
|
370 |
+
|
371 |
+
setSources(element, instance);
|
372 |
+
setWasProcessedData(element);
|
373 |
+
callbackIfSet(settings.callback_reveal, element);
|
374 |
+
};
|
375 |
+
|
376 |
+
var isIntersecting = function isIntersecting(entry) {
|
377 |
+
return entry.intersectionRatio > 0;
|
378 |
+
};
|
379 |
+
|
380 |
+
var getObserverSettings = function getObserverSettings(settings) {
|
381 |
+
return {
|
382 |
+
root: settings.container === document ? null : settings.container,
|
383 |
+
rootMargin: settings.thresholds || settings.threshold + "px"
|
384 |
+
};
|
385 |
+
};
|
386 |
+
|
387 |
+
var setObserver = function setObserver(instance) {
|
388 |
+
if (!supportsIntersectionObserver) {
|
389 |
+
return false;
|
390 |
+
}
|
391 |
+
|
392 |
+
instance._observer = new IntersectionObserver(function (entries) {
|
393 |
+
entries.forEach(function (entry) {
|
394 |
+
return isIntersecting(entry) ? onEnter(entry.target, instance) : onExit(entry.target, instance);
|
395 |
+
});
|
396 |
+
}, getObserverSettings(instance._settings));
|
397 |
+
return true;
|
398 |
+
};
|
399 |
+
|
400 |
+
var LazyLoad = function LazyLoad(customSettings, elements) {
|
401 |
+
this._settings = getInstanceSettings(customSettings);
|
402 |
+
this._loadingCount = 0;
|
403 |
+
setObserver(this);
|
404 |
+
this.update(elements);
|
405 |
+
};
|
406 |
+
|
407 |
+
LazyLoad.prototype = {
|
408 |
+
update: function update(elements) {
|
409 |
+
var _this = this;
|
410 |
+
|
411 |
+
var settings = this._settings;
|
412 |
+
var nodeSet = elements || settings.container.querySelectorAll(settings.elements_selector);
|
413 |
+
this._elements = purgeProcessedElements(Array.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility
|
414 |
+
);
|
415 |
+
|
416 |
+
if (isBot || !this._observer) {
|
417 |
+
this.loadAll();
|
418 |
+
return;
|
419 |
+
}
|
420 |
+
|
421 |
+
this._elements.forEach(function (element) {
|
422 |
+
_this._observer.observe(element);
|
423 |
+
});
|
424 |
+
},
|
425 |
+
destroy: function destroy() {
|
426 |
+
var _this2 = this;
|
427 |
+
|
428 |
+
if (this._observer) {
|
429 |
+
this._elements.forEach(function (element) {
|
430 |
+
_this2._observer.unobserve(element);
|
431 |
+
});
|
432 |
+
|
433 |
+
this._observer = null;
|
434 |
+
}
|
435 |
+
|
436 |
+
this._elements = null;
|
437 |
+
this._settings = null;
|
438 |
+
},
|
439 |
+
load: function load(element, force) {
|
440 |
+
revealElement(element, this, force);
|
441 |
+
},
|
442 |
+
loadAll: function loadAll() {
|
443 |
+
var _this3 = this;
|
444 |
+
|
445 |
+
var elements = this._elements;
|
446 |
+
elements.forEach(function (element) {
|
447 |
+
revealAndUnobserve(element, _this3);
|
448 |
+
});
|
449 |
+
}
|
450 |
+
};
|
451 |
+
/* Automatic instances creation if required (useful for async script loading) */
|
452 |
+
|
453 |
+
if (runningOnBrowser) {
|
454 |
+
autoInitialize(LazyLoad, window.lazyLoadOptions);
|
455 |
+
}
|
456 |
+
|
457 |
+
return LazyLoad;
|
458 |
+
});
|
assets/js/lazyload-11.0.2.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";var t="undefined"!=typeof window,e=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),n=t&&"IntersectionObserver"in window,o=t&&"classList"in document.createElement("p"),r={elements_selector:"img",container:e||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,auto_unobserve:!0,callback_enter:null,callback_exit:null,callback_reveal:null,callback_loaded:null,callback_error:null,callback_finish:null},a=function(t,e){return t.getAttribute("data-"+e)},s=function(t,e,n){var o="data-"+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},i=function(t){return"true"===a(t,"was-processed")},c=function(t,e){return s(t,"ll-timeout",e)},l=function(t){return a(t,"ll-timeout")},u=function(t,e){var n,o=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)};var d=function(t,e){t&&t(e)},f=function(t,e){t._loadingCount+=e,0===t._elements.length&&0===t._loadingCount&&d(t._settings.callback_finish)},_=function(t){for(var e,n=[],o=0;e=t.children[o];o+=1)"SOURCE"===e.tagName&&n.push(e);return n},v=function(t,e,n){n&&t.setAttribute(e,n)},b=function(t,e){v(t,"sizes",a(t,e.data_sizes)),v(t,"srcset",a(t,e.data_srcset)),v(t,"src",a(t,e.data_src))},g={IMG:function(t,e){var n=t.parentNode;n&&"PICTURE"===n.tagName&&_(n).forEach(function(t){b(t,e)});b(t,e)},IFRAME:function(t,e){v(t,"src",a(t,e.data_src))},VIDEO:function(t,e){_(t).forEach(function(t){v(t,"src",a(t,e.data_src))}),v(t,"src",a(t,e.data_src)),t.load()}},m=function(t,e){var n,o,r=e._settings,s=t.tagName,i=g[s];if(i)return i(t,r),f(e,1),void(e._elements=(n=e._elements,o=t,n.filter(function(t){return t!==o})));!function(t,e){var n=a(t,e.data_src),o=a(t,e.data_bg);n&&(t.style.backgroundImage='url("'.concat(n,'")')),o&&(t.style.backgroundImage=o)}(t,r)},h=function(t,e){o?t.classList.add(e):t.className+=(t.className?" ":"")+e},p=function(t,e,n){t.addEventListener(e,n)},y=function(t,e,n){t.removeEventListener(e,n)},E=function(t,e,n){y(t,"load",e),y(t,"loadeddata",e),y(t,"error",n)},w=function(t,e,n){var r=n._settings,a=e?r.class_loaded:r.class_error,s=e?r.callback_loaded:r.callback_error,i=t.target;!function(t,e){o?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")}(i,r.class_loading),h(i,a),d(s,i),f(n,-1)},k=function(t,e){var n=function n(r){w(r,!0,e),E(t,n,o)},o=function o(r){w(r,!1,e),E(t,n,o)};!function(t,e,n){p(t,"load",e),p(t,"loadeddata",e),p(t,"error",n)}(t,n,o)},I=["IMG","IFRAME","VIDEO"],L=function(t,e){var n=e._observer;z(t,e),n&&e._settings.auto_unobserve&&n.unobserve(t)},x=function(t){var e=l(t);e&&(clearTimeout(e),c(t,null))},A=function(t,e){var n=e._settings.load_delay,o=l(t);o||(o=setTimeout(function(){L(t,e),x(t)},n),c(t,o))},z=function(t,e,n){var o=e._settings;!n&&i(t)||(I.indexOf(t.tagName)>-1&&(k(t,e),h(t,o.class_loading)),m(t,e),function(t){s(t,"was-processed","true")}(t),d(o.callback_reveal,t))},O=function(t){return!!n&&(t._observer=new IntersectionObserver(function(e){e.forEach(function(e){return function(t){return t.intersectionRatio>0}(e)?function(t,e){var n=e._settings;d(n.callback_enter,t),n.load_delay?A(t,e):L(t,e)}(e.target,t):function(t,e){var n=e._settings;d(n.callback_exit,t),n.load_delay&&x(t)}(e.target,t)})},{root:(e=t._settings).container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),!0);var e},N=function(t,e){this._settings=function(t){return _extends({},r,t)}(t),this._loadingCount=0,O(this),this.update(e)};return N.prototype={update:function(t){var n=this,o=this._settings,r=t||o.container.querySelectorAll(o.elements_selector);this._elements=function(t){return t.filter(function(t){return!i(t)})}(Array.prototype.slice.call(r)),!e&&this._observer?this._elements.forEach(function(t){n._observer.observe(t)}):this.loadAll()},destroy:function(){var t=this;this._observer&&(this._elements.forEach(function(e){t._observer.unobserve(e)}),this._observer=null),this._elements=null,this._settings=null},load:function(t,e){z(t,this,e)},loadAll:function(){var t=this;this._elements.forEach(function(e){L(e,t)})}},t&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)u(t,n);else u(t,e)}(N,window.lazyLoadOptions),N});
|
2 |
+
//# sourceMappingURL=lazyload-11.0.2.min.js.map
|
assets/js/lazyload-11.0.2.min.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["lazyload.js"],"names":["global","factory","exports","_typeof","module","define","amd","LazyLoad","this","runningOnBrowser","window","isBot","test","defaultSettings","elements_selector","threshold","thresholds","document","createElement","data_srcset","data_sizes","data_bg","class_loading","class_loaded","class_error","load_delay","auto_unobserve","callback_enter","callback_exit","callback_reveal","callback_loaded","callback_error","callback_finish","getInstanceSettings","getData","element","attribute","value","getAttribute","setData","attrName","setAttribute","processedDataName","removeAttribute","getWasProcessedData","setTimeoutData","getTimeoutData","timeoutDataName","createInstance","elementToPurge","options","event","instance","classObj","createEvent","initCustomEvent","dispatchEvent","callbackIfSet","autoInitialize","callback","argument","updateLoadingCount","plusMinus","_elements","length","_loadingCount","_settings","getSourceTags","parentTag","childTag","sourceTags","i","children","setAttributeIfValue","tagName","settings","data_src","backgroundImage","IMG","parent","parentNode","forEach","sourceTag","setImageAttributes","IFRAME","VIDEO","load","setSources","elements","setSourcesFunctions","setSourcesFunction","setSourcesVideo","filter","srcDataValue","bgDataValue","setSourcesBgImage","addClass","className","addEventListener","eventName","handler","removeEventListener","genericLoadEventName","errorHandler","removeClass","loadHandler","addEventListeners","errorEventName","success","removeEventListeners","target","supportsClassList","remove","replace","RegExp","eventHandler","addOneShotEventListeners","revealAndUnobserve","observer","unobserve","cancelDelayLoad","timeoutId","clearTimeout","loadDelay","revealElement","force","managedTags","indexOf","setTimeout","setObserver","supportsIntersectionObserver","entries","entry","intersectionRatio","isIntersecting","delayLoad","onEnter","setWasProcessedData","root","container","rootMargin","customSettings","trueString","getObserverSettings","prototype","update","_this","nodeSet","querySelectorAll","purgeProcessedElements","_observer","call","loadAll","destroy","_this2","_this3","optionsItem","lazyLoadOptions"],"mappings":"+cAAC,SAAUA,EAAQC,GACC,YAAnB,oBAAOC,QAAP,YAAAC,QAAOD,WAA0C,oBAAXE,OAAyBA,OAAOF,QAAUD,IAC9D,mBAAXI,QAAyBA,OAAOC,IAAMD,OAAOJ,GACnDD,EAAOO,SAAWN,IAHnB,CAAAO,KAAA,WAAkBP,aAIlB,IAACQ,EAAmB,oBAAAC,OAIfC,EAFNF,KAAsB,aAAGC,SAGvBD,oBADIE,WAKN,gCAAkCC,KACjCH,UAAAA,WAKKI,EACLC,GAAiB,yBADMJ,OAGvBK,EACAC,GAJuB,cAAAC,SAAAC,cAAA,KAMvBC,EAAa,CACbC,kBAAY,MACZC,UAAOV,GARgBF,EAAAQ,SAAA,KASvBK,UAAAA,IACAC,WAAAA,KACAC,SAAAA,MACAC,YAAU,SACVC,WAAAA,QACAC,QAAAA,KACAC,cAAAA,UACAC,aAAAA,SACAC,YAAAA,QACAC,WAAAA,EACAC,gBAAAA,EAnBuBL,eAAxB,KAeCC,cAAe,KAOhBC,gBAAII,KACHH,gBAAO,KACPC,eAFD,KAHCC,gBAAiB,MAYZE,EAAU,SAACC,EAASC,GAMzB,OAAIC,EAAKC,aALMA,QAKKF,IAGnBG,EAAA,SAAAJ,EAAAC,EAAAC,GAJD,IAAIG,EAJWF,QAIaF,EAKpBK,OAARN,EAGkCA,EAAAM,aAC1BN,EAASO,GAHjBP,EAPDQ,gBAAAH,IAYMI,EAAsB,SAAAT,GAAO,MAZnB,SAehBD,EAAMW,EAnBN,kBAmBAA,EAAA,SAAAV,EAAAE,GAAA,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AAU,IAAA0D,EAAA1I,KAtBtByH,EAAWzH,KAAG0D,UACfiF,EACH3D,GACAb,EAAAgE,UAAAS,iBAAAzE,EAAA7D,mBACDsC,KAAAA,UArS8B,SAAAoC,GAA/B,OAAM6D,EAAAA,OAAAA,SAAAA,GAAyB,OAAAzG,EAAzByG,KAqSIC,CACRnB,MAAAA,UAAQlD,MAAQsE,KAAAJ,KADIxI,GAMlBoI,KAAAA,UAKHvI,KAAAuD,UAAKG,QAAYjC,SAAAA,GACjBiH,EAAAI,UAAKrF,QAAL9B,KALA3B,KAAAgJ,WA+BAC,QAAS,WAAW,IAAAC,EAAAlJ,KArBrBD,KAASyI,YACRC,KAAAA,UAAQhE,QAAA,SAAA9C,GAAmBuH,EAAAJ,UAAA/B,UAAApF,KAC1B3B,KAAA8I,UAAc,MAKd9I,KAAAuD,UAAKA,KAAkCvD,KAAvC0D,UAAA,MAKCoB,KAAA,SAAKkE,EAAL3B,GACAD,EAAAzF,EAAA3B,KAAAqH,IAGD2B,QAAA,WAAevE,IAAAA,EAAAA,KACTqE,KAAAA,UADNrE,QAAA,SAAA9C,GAGAkF,EAnBmBlF,EAAAwH,OAwBjBlJ,GA/TmC,SAArC4C,EAAAH,GACA,GAACA,EAGDC,GAAAA,EAAMI,OAEP7C,IAAAA,IAAO8C,EAAAA,EAAAA,EAAPoG,EAAA1G,EAAAqB,GAAAA,GAAA,EAZDvB,EAAAK,EAAAuG,QAUmD5G,EAAjDK,EAAAH,GA4TEQ,CAFDnD,EAAAG,OAAAmJ,iBAIAtJ","file":"lazyload.min.js","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.LazyLoad = factory());\n}(this, (function () { 'use strict';\n\nconst runningOnBrowser = typeof window !== \"undefined\";\n\nconst isBot =\n\t(runningOnBrowser && !(\"onscroll\" in window)) ||\n\t(typeof navigator !== \"undefined\" &&\n\t\t/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent));\n\nconst supportsIntersectionObserver =\n\trunningOnBrowser && \"IntersectionObserver\" in window;\n\nconst supportsClassList =\n\trunningOnBrowser && \"classList\" in document.createElement(\"p\");\n\nconst defaultSettings = {\n\telements_selector: \"img\",\n\tcontainer: isBot || runningOnBrowser ? document : null,\n\tthreshold: 300,\n\tthresholds: null,\n\tdata_src: \"src\",\n\tdata_srcset: \"srcset\",\n\tdata_sizes: \"sizes\",\n\tdata_bg: \"bg\",\n\tclass_loading: \"loading\",\n\tclass_loaded: \"loaded\",\n\tclass_error: \"error\",\n\tload_delay: 0,\n\tauto_unobserve: true,\n\tcallback_enter: null,\n\tcallback_exit: null,\n\tcallback_reveal: null,\n\tcallback_loaded: null,\n\tcallback_error: null,\n\tcallback_finish: null\n};\n\nvar getInstanceSettings = customSettings => {\n\treturn Object.assign({}, defaultSettings, customSettings);\n};\n\nconst dataPrefix = \"data-\";\nconst processedDataName = \"was-processed\";\nconst timeoutDataName = \"ll-timeout\";\nconst trueString = \"true\";\n\nconst getData = (element, attribute) => {\n\treturn element.getAttribute(dataPrefix + attribute);\n};\n\nconst setData = (element, attribute, value) => {\n\tvar attrName = dataPrefix + attribute;\n\tif (value === null) {\n\t\telement.removeAttribute(attrName);\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, value);\n};\n\nconst setWasProcessedData = element =>\n\tsetData(element, processedDataName, trueString);\n\nconst getWasProcessedData = element =>\n\tgetData(element, processedDataName) === trueString;\n\nconst setTimeoutData = (element, value) =>\n\tsetData(element, timeoutDataName, value);\n\nconst getTimeoutData = element => getData(element, timeoutDataName);\n\nconst purgeProcessedElements = elements => {\n\treturn elements.filter(element => !getWasProcessedData(element));\n};\n\nconst purgeOneElement = (elements, elementToPurge) => {\n\treturn elements.filter(element => element !== elementToPurge);\n};\n\n/* Creates instance and notifies it through the window element */\nconst createInstance = function(classObj, options) {\n\tvar event;\n\tlet eventString = \"LazyLoad::Initialized\";\n\tlet instance = new classObj(options);\n\ttry {\n\t\t// Works in modern browsers\n\t\tevent = new CustomEvent(eventString, { detail: { instance } });\n\t} catch (err) {\n\t\t// Works in Internet Explorer (all versions)\n\t\tevent = document.createEvent(\"CustomEvent\");\n\t\tevent.initCustomEvent(eventString, false, false, { instance });\n\t}\n\twindow.dispatchEvent(event);\n};\n\n/* Auto initialization of one or more instances of lazyload, depending on the \n options passed in (plain object or an array) */\nfunction autoInitialize(classObj, options) {\n\tif (!options) {\n\t\treturn;\n\t}\n\tif (!options.length) {\n\t\t// Plain object\n\t\tcreateInstance(classObj, options);\n\t} else {\n\t\t// Array of objects\n\t\tfor (let i = 0, optionsItem; (optionsItem = options[i]); i += 1) {\n\t\t\tcreateInstance(classObj, optionsItem);\n\t\t}\n\t}\n}\n\nconst callbackIfSet = (callback, argument) => {\n\tif (callback) {\n\t\tcallback(argument);\n\t}\n};\n\nconst updateLoadingCount = (instance, plusMinus) => {\n\tinstance._loadingCount += plusMinus;\n\tif (instance._elements.length === 0 && instance._loadingCount === 0) {\n\t\tcallbackIfSet(instance._settings.callback_finish);\n\t}\n};\n\nconst getSourceTags = parentTag => {\n\tlet sourceTags = [];\n\tfor (let i = 0, childTag; (childTag = parentTag.children[i]); i += 1) {\n\t\tif (childTag.tagName === \"SOURCE\") {\n\t\t\tsourceTags.push(childTag);\n\t\t}\n\t}\n\treturn sourceTags;\n};\n\nconst setAttributeIfValue = (element, attrName, value) => {\n\tif (!value) {\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, value);\n};\n\nconst setImageAttributes = (element, settings) => {\n\tsetAttributeIfValue(\n\t\telement,\n\t\t\"sizes\",\n\t\tgetData(element, settings.data_sizes)\n\t);\n\tsetAttributeIfValue(\n\t\telement,\n\t\t\"srcset\",\n\t\tgetData(element, settings.data_srcset)\n\t);\n\tsetAttributeIfValue(element, \"src\", getData(element, settings.data_src));\n};\n\nconst setSourcesImg = (element, settings) => {\n\tconst parent = element.parentNode;\n\n\tif (parent && parent.tagName === \"PICTURE\") {\n\t\tlet sourceTags = getSourceTags(parent);\n\t\tsourceTags.forEach(sourceTag => {\n\t\t\tsetImageAttributes(sourceTag, settings);\n\t\t});\n\t}\n\n\tsetImageAttributes(element, settings);\n};\n\nconst setSourcesIframe = (element, settings) => {\n\tsetAttributeIfValue(element, \"src\", getData(element, settings.data_src));\n};\n\nconst setSourcesVideo = (element, settings) => {\n\tlet sourceTags = getSourceTags(element);\n\tsourceTags.forEach(sourceTag => {\n\t\tsetAttributeIfValue(\n\t\t\tsourceTag,\n\t\t\t\"src\",\n\t\t\tgetData(sourceTag, settings.data_src)\n\t\t);\n\t});\n\tsetAttributeIfValue(element, \"src\", getData(element, settings.data_src));\n\telement.load();\n};\n\nconst setSourcesBgImage = (element, settings) => {\n\tconst srcDataValue = getData(element, settings.data_src);\n\tconst bgDataValue = getData(element, settings.data_bg);\n\n\tif (srcDataValue) {\n\t\telement.style.backgroundImage = `url(\"${srcDataValue}\")`;\n\t}\n\n\tif (bgDataValue) {\n\t\telement.style.backgroundImage = bgDataValue;\n\t}\n};\n\nconst setSourcesFunctions = {\n\tIMG: setSourcesImg,\n\tIFRAME: setSourcesIframe,\n\tVIDEO: setSourcesVideo\n};\n\nconst setSources = (element, instance) => {\n\tconst settings = instance._settings;\n\tconst tagName = element.tagName;\n\tconst setSourcesFunction = setSourcesFunctions[tagName];\n\tif (setSourcesFunction) {\n\t\tsetSourcesFunction(element, settings);\n\t\tupdateLoadingCount(instance, 1);\n\t\tinstance._elements = purgeOneElement(instance._elements, element);\n\t\treturn;\n\t}\n\tsetSourcesBgImage(element, settings);\n};\n\nconst addClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.add(className);\n\t\treturn;\n\t}\n\telement.className += (element.className ? \" \" : \"\") + className;\n};\n\nconst removeClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.remove(className);\n\t\treturn;\n\t}\n\telement.className = element.className.\n\t\treplace(new RegExp(\"(^|\\\\s+)\" + className + \"(\\\\s+|$)\"), \" \").\n\t\treplace(/^\\s+/, \"\").\n\t\treplace(/\\s+$/, \"\");\n};\n\nconst genericLoadEventName = \"load\";\nconst mediaLoadEventName = \"loadeddata\";\nconst errorEventName = \"error\";\n\nconst addEventListener = (element, eventName, handler) => {\n\telement.addEventListener(eventName, handler);\n};\n\nconst removeEventListener = (element, eventName, handler) => {\n\telement.removeEventListener(eventName, handler);\n};\n\nconst addEventListeners = (element, loadHandler, errorHandler) => {\n\taddEventListener(element, genericLoadEventName, loadHandler);\n\taddEventListener(element, mediaLoadEventName, loadHandler);\n\taddEventListener(element, errorEventName, errorHandler);\n};\n\nconst removeEventListeners = (element, loadHandler, errorHandler) => {\n\tremoveEventListener(element, genericLoadEventName, loadHandler);\n\tremoveEventListener(element, mediaLoadEventName, loadHandler);\n\tremoveEventListener(element, errorEventName, errorHandler);\n};\n\nconst eventHandler = function(event, success, instance) {\n\tvar settings = instance._settings;\n\tconst className = success ? settings.class_loaded : settings.class_error;\n\tconst callback = success\n\t\t? settings.callback_loaded\n\t\t: settings.callback_error;\n\tconst element = event.target;\n\n\tremoveClass(element, settings.class_loading);\n\taddClass(element, className);\n\tcallbackIfSet(callback, element);\n\n\tupdateLoadingCount(instance, -1);\n};\n\nconst addOneShotEventListeners = (element, instance) => {\n\tconst loadHandler = event => {\n\t\teventHandler(event, true, instance);\n\t\tremoveEventListeners(element, loadHandler, errorHandler);\n\t};\n\tconst errorHandler = event => {\n\t\teventHandler(event, false, instance);\n\t\tremoveEventListeners(element, loadHandler, errorHandler);\n\t};\n\taddEventListeners(element, loadHandler, errorHandler);\n};\n\nconst managedTags = [\"IMG\", \"IFRAME\", \"VIDEO\"];\n\nconst onEnter = (element, instance) => {\n\tconst settings = instance._settings;\n\tcallbackIfSet(settings.callback_enter, element);\n\tif (!settings.load_delay) {\n\t\trevealAndUnobserve(element, instance);\n\t\treturn;\n\t}\n\tdelayLoad(element, instance);\n};\n\nconst revealAndUnobserve = (element, instance) => {\n\tvar observer = instance._observer;\n\trevealElement(element, instance);\n\tif (observer && instance._settings.auto_unobserve) {\n\t\tobserver.unobserve(element);\n\t}\n};\n\nconst onExit = (element, instance) => {\n\tconst settings = instance._settings;\n\tcallbackIfSet(settings.callback_exit, element);\n\tif (!settings.load_delay) {\n\t\treturn;\n\t}\n\tcancelDelayLoad(element);\n};\n\nconst cancelDelayLoad = element => {\n\tvar timeoutId = getTimeoutData(element);\n\tif (!timeoutId) {\n\t\treturn; // do nothing if timeout doesn't exist\n\t}\n\tclearTimeout(timeoutId);\n\tsetTimeoutData(element, null);\n};\n\nconst delayLoad = (element, instance) => {\n\tvar loadDelay = instance._settings.load_delay;\n\tvar timeoutId = getTimeoutData(element);\n\tif (timeoutId) {\n\t\treturn; // do nothing if timeout already set\n\t}\n\ttimeoutId = setTimeout(function() {\n\t\trevealAndUnobserve(element, instance);\n\t\tcancelDelayLoad(element);\n\t}, loadDelay);\n\tsetTimeoutData(element, timeoutId);\n};\n\nconst revealElement = (element, instance, force) => {\n\tvar settings = instance._settings;\n\tif (!force && getWasProcessedData(element)) {\n\t\treturn; // element has already been processed and force wasn't true\n\t}\n\tif (managedTags.indexOf(element.tagName) > -1) {\n\t\taddOneShotEventListeners(element, instance);\n\t\taddClass(element, settings.class_loading);\n\t}\n\tsetSources(element, instance);\n\tsetWasProcessedData(element);\n\tcallbackIfSet(settings.callback_reveal, element);\n};\n\nconst isIntersecting = entry => entry.intersectionRatio > 0;\n\nconst getObserverSettings = settings => ({\n\troot: settings.container === document ? null : settings.container,\n\trootMargin: settings.thresholds || settings.threshold + \"px\"\n});\n\nconst setObserver = instance => {\n\tif (!supportsIntersectionObserver) {\n\t\treturn false;\n\t}\n\tinstance._observer = new IntersectionObserver(entries => {\n\t\tentries.forEach(entry =>\n\t\t\tisIntersecting(entry)\n\t\t\t\t? onEnter(entry.target, instance)\n\t\t\t\t: onExit(entry.target, instance)\n\t\t);\n\t}, getObserverSettings(instance._settings));\n\treturn true;\n};\n\nconst LazyLoad = function(customSettings, elements) {\n\tthis._settings = getInstanceSettings(customSettings);\n\tthis._loadingCount = 0;\n\tsetObserver(this);\n\tthis.update(elements);\n};\n\nLazyLoad.prototype = {\n\tupdate: function(elements) {\n\t\tconst settings = this._settings;\n\t\tconst nodeSet =\n\t\t\telements ||\n\t\t\tsettings.container.querySelectorAll(settings.elements_selector);\n\n\t\tthis._elements = purgeProcessedElements(\n\t\t\tArray.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility\n\t\t);\n\n\t\tif (isBot || !this._observer) {\n\t\t\tthis.loadAll();\n\t\t\treturn;\n\t\t}\n\n\t\tthis._elements.forEach(element => {\n\t\t\tthis._observer.observe(element);\n\t\t});\n\t},\n\n\tdestroy: function() {\n\t\tif (this._observer) {\n\t\t\tthis._elements.forEach(element => {\n\t\t\t\tthis._observer.unobserve(element);\n\t\t\t});\n\t\t\tthis._observer = null;\n\t\t}\n\t\tthis._elements = null;\n\t\tthis._settings = null;\n\t},\n\n\tload: function(element, force) {\n\t\trevealElement(element, this, force);\n\t},\n\n\tloadAll: function() {\n\t\tvar elements = this._elements;\n\t\telements.forEach(element => {\n\t\t\trevealAndUnobserve(element, this);\n\t\t});\n\t}\n};\n\n/* Automatic instances creation if required (useful for async script loading) */\nif (runningOnBrowser) {\n\tautoInitialize(LazyLoad, window.lazyLoadOptions);\n}\n\nreturn LazyLoad;\n\n})));\n"]}
|
assets/js/lazyload-8.17.js
DELETED
@@ -1,480 +0,0 @@
|
|
1 |
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
2 |
-
|
3 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
4 |
-
|
5 |
-
(function (global, factory) {
|
6 |
-
(typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
|
7 |
-
})(this, function () {
|
8 |
-
'use strict';
|
9 |
-
|
10 |
-
var getDefaultSettings = function getDefaultSettings() {
|
11 |
-
return {
|
12 |
-
elements_selector: "img",
|
13 |
-
container: window,
|
14 |
-
threshold: 300,
|
15 |
-
throttle: 150,
|
16 |
-
data_src: "src",
|
17 |
-
data_srcset: "srcset",
|
18 |
-
data_sizes: "sizes",
|
19 |
-
data_bg: "bg",
|
20 |
-
class_loading: "loading",
|
21 |
-
class_loaded: "loaded",
|
22 |
-
class_error: "error",
|
23 |
-
class_initial: "initial",
|
24 |
-
skip_invisible: true,
|
25 |
-
callback_load: null,
|
26 |
-
callback_error: null,
|
27 |
-
callback_set: null,
|
28 |
-
callback_enter: null,
|
29 |
-
callback_finish: null,
|
30 |
-
to_webp: false
|
31 |
-
};
|
32 |
-
};
|
33 |
-
|
34 |
-
var dataPrefix = "data-";
|
35 |
-
var processedDataName = "was-processed";
|
36 |
-
var processedDataValue = "true";
|
37 |
-
|
38 |
-
var getData = function getData(element, attribute) {
|
39 |
-
return element.getAttribute(dataPrefix + attribute);
|
40 |
-
};
|
41 |
-
|
42 |
-
var setData = function setData(element, attribute, value) {
|
43 |
-
var attrName = dataPrefix + attribute;
|
44 |
-
if (value === null) {
|
45 |
-
element.removeAttribute(attrName);
|
46 |
-
return;
|
47 |
-
}
|
48 |
-
element.setAttribute(attrName, value);
|
49 |
-
};
|
50 |
-
|
51 |
-
var setWasProcessedData = function setWasProcessedData(element) {
|
52 |
-
return setData(element, processedDataName, processedDataValue);
|
53 |
-
};
|
54 |
-
|
55 |
-
var getWasProcessedData = function getWasProcessedData(element) {
|
56 |
-
return getData(element, processedDataName) === processedDataValue;
|
57 |
-
};
|
58 |
-
|
59 |
-
var purgeProcessedElements = function purgeProcessedElements(elements) {
|
60 |
-
return elements.filter(function (element) {
|
61 |
-
return !getWasProcessedData(element);
|
62 |
-
});
|
63 |
-
};
|
64 |
-
|
65 |
-
var purgeOneElement = function purgeOneElement(elements, elementToPurge) {
|
66 |
-
return elements.filter(function (element) {
|
67 |
-
return element !== elementToPurge;
|
68 |
-
});
|
69 |
-
};
|
70 |
-
|
71 |
-
var getTopOffset = function getTopOffset(element) {
|
72 |
-
return element.getBoundingClientRect().top + window.pageYOffset - element.ownerDocument.documentElement.clientTop;
|
73 |
-
};
|
74 |
-
|
75 |
-
var isBelowViewport = function isBelowViewport(element, container, threshold) {
|
76 |
-
var fold = container === window ? window.innerHeight + window.pageYOffset : getTopOffset(container) + container.offsetHeight;
|
77 |
-
return fold <= getTopOffset(element) - threshold;
|
78 |
-
};
|
79 |
-
|
80 |
-
var getLeftOffset = function getLeftOffset(element) {
|
81 |
-
return element.getBoundingClientRect().left + window.pageXOffset - element.ownerDocument.documentElement.clientLeft;
|
82 |
-
};
|
83 |
-
|
84 |
-
var isAtRightOfViewport = function isAtRightOfViewport(element, container, threshold) {
|
85 |
-
var documentWidth = window.innerWidth;
|
86 |
-
var fold = container === window ? documentWidth + window.pageXOffset : getLeftOffset(container) + documentWidth;
|
87 |
-
return fold <= getLeftOffset(element) - threshold;
|
88 |
-
};
|
89 |
-
|
90 |
-
var isAboveViewport = function isAboveViewport(element, container, threshold) {
|
91 |
-
var fold = container === window ? window.pageYOffset : getTopOffset(container);
|
92 |
-
return fold >= getTopOffset(element) + threshold + element.offsetHeight;
|
93 |
-
};
|
94 |
-
|
95 |
-
var isAtLeftOfViewport = function isAtLeftOfViewport(element, container, threshold) {
|
96 |
-
var fold = container === window ? window.pageXOffset : getLeftOffset(container);
|
97 |
-
return fold >= getLeftOffset(element) + threshold + element.offsetWidth;
|
98 |
-
};
|
99 |
-
|
100 |
-
function isInsideViewport(element, container, threshold) {
|
101 |
-
return !isBelowViewport(element, container, threshold) && !isAboveViewport(element, container, threshold) && !isAtRightOfViewport(element, container, threshold) && !isAtLeftOfViewport(element, container, threshold);
|
102 |
-
}
|
103 |
-
|
104 |
-
/* Creates instance and notifies it through the window element */
|
105 |
-
var createInstance = function createInstance(classObj, options) {
|
106 |
-
var event;
|
107 |
-
var eventString = "LazyLoad::Initialized";
|
108 |
-
var instance = new classObj(options);
|
109 |
-
try {
|
110 |
-
// Works in modern browsers
|
111 |
-
event = new CustomEvent(eventString, { detail: { instance: instance } });
|
112 |
-
} catch (err) {
|
113 |
-
// Works in Internet Explorer (all versions)
|
114 |
-
event = document.createEvent("CustomEvent");
|
115 |
-
event.initCustomEvent(eventString, false, false, { instance: instance });
|
116 |
-
}
|
117 |
-
window.dispatchEvent(event);
|
118 |
-
};
|
119 |
-
|
120 |
-
/* Auto initialization of one or more instances of lazyload, depending on the
|
121 |
-
options passed in (plain object or an array) */
|
122 |
-
function autoInitialize(classObj, options) {
|
123 |
-
if (!options) {
|
124 |
-
return;
|
125 |
-
}
|
126 |
-
if (!options.length) {
|
127 |
-
// Plain object
|
128 |
-
createInstance(classObj, options);
|
129 |
-
} else {
|
130 |
-
// Array of objects
|
131 |
-
for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
|
132 |
-
createInstance(classObj, optionsItem);
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
var replaceExtToWebp = function replaceExtToWebp(value, condition) {
|
138 |
-
return condition ? value.replace(/\.(jpe?g|png)/gi, ".webp") : value;
|
139 |
-
};
|
140 |
-
|
141 |
-
var detectWebp = function detectWebp() {
|
142 |
-
var webpString = "image/webp";
|
143 |
-
var canvas = document.createElement("canvas");
|
144 |
-
|
145 |
-
if (canvas.getContext && canvas.getContext("2d")) {
|
146 |
-
return canvas.toDataURL(webpString).indexOf('data:' + webpString) === 0;
|
147 |
-
}
|
148 |
-
|
149 |
-
return false;
|
150 |
-
};
|
151 |
-
|
152 |
-
var runningOnBrowser = typeof window !== "undefined";
|
153 |
-
|
154 |
-
var isBot = runningOnBrowser && !("onscroll" in window) || /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);
|
155 |
-
var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
|
156 |
-
|
157 |
-
var supportsWebp = runningOnBrowser && detectWebp();
|
158 |
-
|
159 |
-
var addClass = function addClass(element, className) {
|
160 |
-
if (supportsClassList) {
|
161 |
-
element.classList.add(className);
|
162 |
-
return;
|
163 |
-
}
|
164 |
-
element.className += (element.className ? " " : "") + className;
|
165 |
-
};
|
166 |
-
|
167 |
-
var removeClass = function removeClass(element, className) {
|
168 |
-
if (supportsClassList) {
|
169 |
-
element.classList.remove(className);
|
170 |
-
return;
|
171 |
-
}
|
172 |
-
element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
|
173 |
-
};
|
174 |
-
|
175 |
-
var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName, toWebpFlag) {
|
176 |
-
for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
|
177 |
-
if (childTag.tagName === "SOURCE") {
|
178 |
-
var attrValue = getData(childTag, dataAttrName);
|
179 |
-
setAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);
|
180 |
-
}
|
181 |
-
}
|
182 |
-
};
|
183 |
-
|
184 |
-
var setAttributeIfValue = function setAttributeIfValue(element, attrName, value, toWebpFlag) {
|
185 |
-
if (!value) {
|
186 |
-
return;
|
187 |
-
}
|
188 |
-
element.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));
|
189 |
-
};
|
190 |
-
|
191 |
-
var setSourcesImg = function setSourcesImg(element, settings) {
|
192 |
-
var toWebpFlag = supportsWebp && settings.to_webp;
|
193 |
-
var srcsetDataName = settings.data_srcset;
|
194 |
-
var parent = element.parentNode;
|
195 |
-
|
196 |
-
if (parent && parent.tagName === "PICTURE") {
|
197 |
-
setSourcesInChildren(parent, "srcset", srcsetDataName, toWebpFlag);
|
198 |
-
}
|
199 |
-
var sizesDataValue = getData(element, settings.data_sizes);
|
200 |
-
setAttributeIfValue(element, "sizes", sizesDataValue);
|
201 |
-
var srcsetDataValue = getData(element, srcsetDataName);
|
202 |
-
setAttributeIfValue(element, "srcset", srcsetDataValue, toWebpFlag);
|
203 |
-
var srcDataValue = getData(element, settings.data_src);
|
204 |
-
setAttributeIfValue(element, "src", srcDataValue, toWebpFlag);
|
205 |
-
};
|
206 |
-
|
207 |
-
var setSourcesIframe = function setSourcesIframe(element, settings) {
|
208 |
-
var srcDataValue = getData(element, settings.data_src);
|
209 |
-
|
210 |
-
setAttributeIfValue(element, "src", srcDataValue);
|
211 |
-
};
|
212 |
-
|
213 |
-
var setSourcesVideo = function setSourcesVideo(element, settings) {
|
214 |
-
var srcDataName = settings.data_src;
|
215 |
-
var srcDataValue = getData(element, srcDataName);
|
216 |
-
|
217 |
-
setSourcesInChildren(element, "src", srcDataName);
|
218 |
-
setAttributeIfValue(element, "src", srcDataValue);
|
219 |
-
element.load();
|
220 |
-
};
|
221 |
-
|
222 |
-
var setSourcesBgImage = function setSourcesBgImage(element, settings) {
|
223 |
-
var toWebpFlag = supportsWebp && settings.to_webp;
|
224 |
-
var srcDataValue = getData(element, settings.data_src);
|
225 |
-
var bgDataValue = getData(element, settings.data_bg);
|
226 |
-
|
227 |
-
if (srcDataValue) {
|
228 |
-
var setValue = replaceExtToWebp(srcDataValue, toWebpFlag);
|
229 |
-
element.style.backgroundImage = 'url("' + setValue + '")';
|
230 |
-
}
|
231 |
-
|
232 |
-
if (bgDataValue) {
|
233 |
-
var _setValue = replaceExtToWebp(bgDataValue, toWebpFlag);
|
234 |
-
element.style.backgroundImage = _setValue;
|
235 |
-
}
|
236 |
-
};
|
237 |
-
|
238 |
-
var setSourcesFunctions = {
|
239 |
-
IMG: setSourcesImg,
|
240 |
-
IFRAME: setSourcesIframe,
|
241 |
-
VIDEO: setSourcesVideo
|
242 |
-
};
|
243 |
-
|
244 |
-
var setSources = function setSources(element, instance) {
|
245 |
-
var settings = instance._settings;
|
246 |
-
var tagName = element.tagName;
|
247 |
-
var setSourcesFunction = setSourcesFunctions[tagName];
|
248 |
-
if (setSourcesFunction) {
|
249 |
-
setSourcesFunction(element, settings);
|
250 |
-
instance._updateLoadingCount(1);
|
251 |
-
instance._elements = purgeOneElement(instance._elements, element);
|
252 |
-
return;
|
253 |
-
}
|
254 |
-
setSourcesBgImage(element, settings);
|
255 |
-
};
|
256 |
-
|
257 |
-
var callbackIfSet = function callbackIfSet(callback, argument) {
|
258 |
-
if (callback) {
|
259 |
-
callback(argument);
|
260 |
-
}
|
261 |
-
};
|
262 |
-
|
263 |
-
var genericLoadEventName = "load";
|
264 |
-
var mediaLoadEventName = "loadeddata";
|
265 |
-
var errorEventName = "error";
|
266 |
-
|
267 |
-
var addEventListener = function addEventListener(element, eventName, handler) {
|
268 |
-
element.addEventListener(eventName, handler);
|
269 |
-
};
|
270 |
-
|
271 |
-
var removeEventListener = function removeEventListener(element, eventName, handler) {
|
272 |
-
element.removeEventListener(eventName, handler);
|
273 |
-
};
|
274 |
-
|
275 |
-
var addAllEventListeners = function addAllEventListeners(element, loadHandler, errorHandler) {
|
276 |
-
addEventListener(element, genericLoadEventName, loadHandler);
|
277 |
-
addEventListener(element, mediaLoadEventName, loadHandler);
|
278 |
-
addEventListener(element, errorEventName, errorHandler);
|
279 |
-
};
|
280 |
-
|
281 |
-
var removeAllEventListeners = function removeAllEventListeners(element, loadHandler, errorHandler) {
|
282 |
-
removeEventListener(element, genericLoadEventName, loadHandler);
|
283 |
-
removeEventListener(element, mediaLoadEventName, loadHandler);
|
284 |
-
removeEventListener(element, errorEventName, errorHandler);
|
285 |
-
};
|
286 |
-
|
287 |
-
var eventHandler = function eventHandler(event, success, instance) {
|
288 |
-
var settings = instance._settings;
|
289 |
-
var className = success ? settings.class_loaded : settings.class_error;
|
290 |
-
var callback = success ? settings.callback_load : settings.callback_error;
|
291 |
-
var element = event.target;
|
292 |
-
|
293 |
-
removeClass(element, settings.class_loading);
|
294 |
-
addClass(element, className);
|
295 |
-
callbackIfSet(callback, element);
|
296 |
-
|
297 |
-
instance._updateLoadingCount(-1);
|
298 |
-
};
|
299 |
-
|
300 |
-
var addOneShotEventListeners = function addOneShotEventListeners(element, instance) {
|
301 |
-
var loadHandler = function loadHandler(event) {
|
302 |
-
eventHandler(event, true, instance);
|
303 |
-
removeAllEventListeners(element, loadHandler, errorHandler);
|
304 |
-
};
|
305 |
-
var errorHandler = function errorHandler(event) {
|
306 |
-
eventHandler(event, false, instance);
|
307 |
-
removeAllEventListeners(element, loadHandler, errorHandler);
|
308 |
-
};
|
309 |
-
addAllEventListeners(element, loadHandler, errorHandler);
|
310 |
-
};
|
311 |
-
|
312 |
-
var managedTags = ["IMG", "IFRAME", "VIDEO"];
|
313 |
-
|
314 |
-
function revealElement(element, instance, force) {
|
315 |
-
var settings = instance._settings;
|
316 |
-
if (!force && getWasProcessedData(element)) {
|
317 |
-
return; // element has already been processed and force wasn't true
|
318 |
-
}
|
319 |
-
callbackIfSet(settings.callback_enter, element);
|
320 |
-
if (managedTags.indexOf(element.tagName) > -1) {
|
321 |
-
addOneShotEventListeners(element, instance);
|
322 |
-
addClass(element, settings.class_loading);
|
323 |
-
}
|
324 |
-
setSources(element, instance);
|
325 |
-
setWasProcessedData(element);
|
326 |
-
callbackIfSet(settings.callback_set, element);
|
327 |
-
}
|
328 |
-
|
329 |
-
var removeFromArray = function removeFromArray(elements, indexes) {
|
330 |
-
while (indexes.length) {
|
331 |
-
elements.splice(indexes.pop(), 1);
|
332 |
-
}
|
333 |
-
};
|
334 |
-
|
335 |
-
/*
|
336 |
-
* Constructor
|
337 |
-
*/
|
338 |
-
|
339 |
-
var LazyLoad = function LazyLoad(instanceSettings) {
|
340 |
-
this._settings = _extends({}, getDefaultSettings(), instanceSettings);
|
341 |
-
this._loadingCount = 0;
|
342 |
-
this._queryOriginNode = this._settings.container === window ? document : this._settings.container;
|
343 |
-
|
344 |
-
this._previousLoopTime = 0;
|
345 |
-
this._loopTimeout = null;
|
346 |
-
this._boundHandleScroll = this.handleScroll.bind(this);
|
347 |
-
|
348 |
-
this._isFirstLoop = true;
|
349 |
-
window.addEventListener("resize", this._boundHandleScroll);
|
350 |
-
this.update();
|
351 |
-
};
|
352 |
-
|
353 |
-
LazyLoad.prototype = {
|
354 |
-
_loopThroughElements: function _loopThroughElements(forceDownload) {
|
355 |
-
var settings = this._settings,
|
356 |
-
elements = this._elements,
|
357 |
-
elementsLength = !elements ? 0 : elements.length;
|
358 |
-
var i = void 0,
|
359 |
-
processedIndexes = [],
|
360 |
-
isFirstLoop = this._isFirstLoop;
|
361 |
-
|
362 |
-
if (isFirstLoop) {
|
363 |
-
this._isFirstLoop = false;
|
364 |
-
}
|
365 |
-
|
366 |
-
if (elementsLength === 0) {
|
367 |
-
this._stopScrollHandler();
|
368 |
-
return;
|
369 |
-
}
|
370 |
-
|
371 |
-
for (i = 0; i < elementsLength; i++) {
|
372 |
-
var element = elements[i];
|
373 |
-
/* If must skip_invisible and element is invisible, skip it */
|
374 |
-
if (settings.skip_invisible && element.offsetParent === null) {
|
375 |
-
continue;
|
376 |
-
}
|
377 |
-
|
378 |
-
if (forceDownload || isInsideViewport(element, settings.container, settings.threshold)) {
|
379 |
-
if (isFirstLoop) {
|
380 |
-
addClass(element, settings.class_initial);
|
381 |
-
}
|
382 |
-
this.load(element);
|
383 |
-
processedIndexes.push(i);
|
384 |
-
}
|
385 |
-
}
|
386 |
-
|
387 |
-
// Removing processed elements from this._elements.
|
388 |
-
removeFromArray(elements, processedIndexes);
|
389 |
-
},
|
390 |
-
|
391 |
-
_startScrollHandler: function _startScrollHandler() {
|
392 |
-
if (!this._isHandlingScroll) {
|
393 |
-
this._isHandlingScroll = true;
|
394 |
-
this._settings.container.addEventListener("scroll", this._boundHandleScroll);
|
395 |
-
}
|
396 |
-
},
|
397 |
-
|
398 |
-
_stopScrollHandler: function _stopScrollHandler() {
|
399 |
-
if (this._isHandlingScroll) {
|
400 |
-
this._isHandlingScroll = false;
|
401 |
-
this._settings.container.removeEventListener("scroll", this._boundHandleScroll);
|
402 |
-
}
|
403 |
-
},
|
404 |
-
|
405 |
-
_updateLoadingCount: function _updateLoadingCount(plusMinus) {
|
406 |
-
this._loadingCount += plusMinus;
|
407 |
-
if (this._elements.length === 0 && this._loadingCount === 0) {
|
408 |
-
callbackIfSet(this._settings.callback_finish);
|
409 |
-
}
|
410 |
-
},
|
411 |
-
|
412 |
-
handleScroll: function handleScroll() {
|
413 |
-
var throttle = this._settings.throttle;
|
414 |
-
|
415 |
-
if (throttle !== 0) {
|
416 |
-
var now = Date.now();
|
417 |
-
var remainingTime = throttle - (now - this._previousLoopTime);
|
418 |
-
if (remainingTime <= 0 || remainingTime > throttle) {
|
419 |
-
if (this._loopTimeout) {
|
420 |
-
clearTimeout(this._loopTimeout);
|
421 |
-
this._loopTimeout = null;
|
422 |
-
}
|
423 |
-
this._previousLoopTime = now;
|
424 |
-
this._loopThroughElements();
|
425 |
-
} else if (!this._loopTimeout) {
|
426 |
-
this._loopTimeout = setTimeout(function () {
|
427 |
-
this._previousLoopTime = Date.now();
|
428 |
-
this._loopTimeout = null;
|
429 |
-
this._loopThroughElements();
|
430 |
-
}.bind(this), remainingTime);
|
431 |
-
}
|
432 |
-
} else {
|
433 |
-
this._loopThroughElements();
|
434 |
-
}
|
435 |
-
},
|
436 |
-
|
437 |
-
loadAll: function loadAll() {
|
438 |
-
this._loopThroughElements(true);
|
439 |
-
},
|
440 |
-
|
441 |
-
update: function update(elements) {
|
442 |
-
var settings = this._settings;
|
443 |
-
var nodeSet = elements || this._queryOriginNode.querySelectorAll(settings.elements_selector);
|
444 |
-
|
445 |
-
this._elements = purgeProcessedElements(Array.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility
|
446 |
-
);
|
447 |
-
|
448 |
-
if (isBot) {
|
449 |
-
this.loadAll();
|
450 |
-
return;
|
451 |
-
}
|
452 |
-
|
453 |
-
this._loopThroughElements();
|
454 |
-
this._startScrollHandler();
|
455 |
-
},
|
456 |
-
|
457 |
-
destroy: function destroy() {
|
458 |
-
window.removeEventListener("resize", this._boundHandleScroll);
|
459 |
-
if (this._loopTimeout) {
|
460 |
-
clearTimeout(this._loopTimeout);
|
461 |
-
this._loopTimeout = null;
|
462 |
-
}
|
463 |
-
this._stopScrollHandler();
|
464 |
-
this._elements = null;
|
465 |
-
this._queryOriginNode = null;
|
466 |
-
this._settings = null;
|
467 |
-
},
|
468 |
-
|
469 |
-
load: function load(element, force) {
|
470 |
-
revealElement(element, this, force);
|
471 |
-
}
|
472 |
-
};
|
473 |
-
|
474 |
-
/* Automatic instances creation if required (useful for async script loading) */
|
475 |
-
if (runningOnBrowser) {
|
476 |
-
autoInitialize(LazyLoad, window.lazyLoadOptions);
|
477 |
-
}
|
478 |
-
|
479 |
-
return LazyLoad;
|
480 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/lazyload-8.17.min.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";function t(t,e,n){return!(u(t,e,n)||_(t,e,n)||f(t,e,n)||h(t,e,n))}function e(t,e,n){var o=e._settings;!n&&r(t)||(C(o.callback_enter,t),R.indexOf(t.tagName)>-1&&(x(t,e),y(t,o.class_loading)),H(t,e),s(t),C(o.callback_set,t))}var n=function(){return{elements_selector:"img",container:window,threshold:300,throttle:150,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_initial:"initial",skip_invisible:!0,callback_load:null,callback_error:null,callback_set:null,callback_enter:null,callback_finish:null,to_webp:!1}},o=function(t,e){return t.getAttribute("data-"+e)},i=function(t,e,n){var o="data-"+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},s=function(t){return i(t,"was-processed","true")},r=function(t){return"true"===o(t,"was-processed")},l=function(t){return t.filter(function(t){return!r(t)})},a=function(t,e){return t.filter(function(t){return t!==e})},c=function(t){return t.getBoundingClientRect().top+window.pageYOffset-t.ownerDocument.documentElement.clientTop},u=function(t,e,n){return(e===window?window.innerHeight+window.pageYOffset:c(e)+e.offsetHeight)<=c(t)-n},d=function(t){return t.getBoundingClientRect().left+window.pageXOffset-t.ownerDocument.documentElement.clientLeft},f=function(t,e,n){var o=window.innerWidth;return(e===window?o+window.pageXOffset:d(e)+o)<=d(t)-n},_=function(t,e,n){return(e===window?window.pageYOffset:c(e))>=c(t)+n+t.offsetHeight},h=function(t,e,n){return(e===window?window.pageXOffset:d(e))>=d(t)+n+t.offsetWidth},p=function(t,e){var n,o=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)},g=function(t,e){return e?t.replace(/\.(jpe?g|png)/gi,".webp"):t},m="undefined"!=typeof window,w=m&&!("onscroll"in window)||/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),v=m&&"classList"in document.createElement("p"),b=m&&function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))&&0===t.toDataURL("image/webp").indexOf("data:image/webp")}(),y=function(t,e){v?t.classList.add(e):t.className+=(t.className?" ":"")+e},E=function(t,e){v?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},L=function(t,e,n,i){for(var s,r=0;s=t.children[r];r+=1)if("SOURCE"===s.tagName){var l=o(s,n);T(s,e,l,i)}},T=function(t,e,n,o){n&&t.setAttribute(e,g(n,o))},S=function(t,e){var n=b&&e.to_webp,i=o(t,e.data_src),s=o(t,e.data_bg);if(i){var r=g(i,n);t.style.backgroundImage='url("'+r+'")'}if(s){var l=g(s,n);t.style.backgroundImage=l}},O={IMG:function(t,e){var n=b&&e.to_webp,i=e.data_srcset,s=t.parentNode;s&&"PICTURE"===s.tagName&&L(s,"srcset",i,n);var r=o(t,e.data_sizes);T(t,"sizes",r);var l=o(t,i);T(t,"srcset",l,n);var a=o(t,e.data_src);T(t,"src",a,n)},IFRAME:function(t,e){var n=o(t,e.data_src);T(t,"src",n)},VIDEO:function(t,e){var n=e.data_src,i=o(t,n);L(t,"src",n),T(t,"src",i),t.load()}},H=function(t,e){var n=e._settings,o=t.tagName,i=O[o];if(i)return i(t,n),e._updateLoadingCount(1),void(e._elements=a(e._elements,t));S(t,n)},C=function(t,e){t&&t(e)},k=function(t,e,n){t.addEventListener(e,n)},z=function(t,e,n){t.removeEventListener(e,n)},N=function(t,e,n){k(t,"load",e),k(t,"loadeddata",e),k(t,"error",n)},A=function(t,e,n){z(t,"load",e),z(t,"loadeddata",e),z(t,"error",n)},I=function(t,e,n){var o=n._settings,i=e?o.class_loaded:o.class_error,s=e?o.callback_load:o.callback_error,r=t.target;E(r,o.class_loading),y(r,i),C(s,r),n._updateLoadingCount(-1)},x=function(t,e){var n=function n(i){I(i,!0,e),A(t,n,o)},o=function o(i){I(i,!1,e),A(t,n,o)};N(t,n,o)},R=["IMG","IFRAME","VIDEO"],D=function(t,e){for(;e.length;)t.splice(e.pop(),1)},F=function(t){this._settings=_extends({},n(),t),this._loadingCount=0,this._queryOriginNode=this._settings.container===window?document:this._settings.container,this._previousLoopTime=0,this._loopTimeout=null,this._boundHandleScroll=this.handleScroll.bind(this),this._isFirstLoop=!0,window.addEventListener("resize",this._boundHandleScroll),this.update()};return F.prototype={_loopThroughElements:function(e){var n=this._settings,o=this._elements,i=o?o.length:0,s=void 0,r=[],l=this._isFirstLoop;if(l&&(this._isFirstLoop=!1),0!==i){for(s=0;s<i;s++){var a=o[s];n.skip_invisible&&null===a.offsetParent||(e||t(a,n.container,n.threshold))&&(l&&y(a,n.class_initial),this.load(a),r.push(s))}D(o,r)}else this._stopScrollHandler()},_startScrollHandler:function(){this._isHandlingScroll||(this._isHandlingScroll=!0,this._settings.container.addEventListener("scroll",this._boundHandleScroll))},_stopScrollHandler:function(){this._isHandlingScroll&&(this._isHandlingScroll=!1,this._settings.container.removeEventListener("scroll",this._boundHandleScroll))},_updateLoadingCount:function(t){this._loadingCount+=t,0===this._elements.length&&0===this._loadingCount&&C(this._settings.callback_finish)},handleScroll:function(){var t=this._settings.throttle;if(0!==t){var e=Date.now(),n=t-(e-this._previousLoopTime);n<=0||n>t?(this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._previousLoopTime=e,this._loopThroughElements()):this._loopTimeout||(this._loopTimeout=setTimeout(function(){this._previousLoopTime=Date.now(),this._loopTimeout=null,this._loopThroughElements()}.bind(this),n))}else this._loopThroughElements()},loadAll:function(){this._loopThroughElements(!0)},update:function(t){var e=this._settings,n=t||this._queryOriginNode.querySelectorAll(e.elements_selector);this._elements=l(Array.prototype.slice.call(n)),w?this.loadAll():(this._loopThroughElements(),this._startScrollHandler())},destroy:function(){window.removeEventListener("resize",this._boundHandleScroll),this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._stopScrollHandler(),this._elements=null,this._queryOriginNode=null,this._settings=null},load:function(t,n){e(t,this,n)}},m&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)p(t,n);else p(t,e)}(F,window.lazyLoadOptions),F});
|
2 |
-
//# sourceMappingURL=lazyload-8.17.min.js.map
|
|
|
|
assets/js/lazyload-8.17.min.js.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["lazyload.js"],"names":["global","factory","exports","_typeof","module","define","amd","LazyLoad","this","createInstance","element","classObj","isBelowViewport","eventString","container","threshold","isAboveViewport","isAtRightOfViewport","isAtLeftOfViewport","instanceSettings","settings","instance","_settings","force","_loadingCount","callbackIfSet","_previousLoopTime","callback_enter","managedTags","_loopTimeout","tagName","addOneShotEventListeners","handleScroll","addClass","class_loading","window","addEventListener","setWasProcessedData","callback_set","getDefaultSettings","elements_selector","throttle","data_src","data_srcset","data_sizes","data_bg","class_loaded","class_error","class_initial","skip_invisible","callback_load","callback_error","getData","attribute","dataPrefix","callback_finish","setData","value","attrName","removeAttribute","getWasProcessedData","purgeProcessedElements","processedDataName","elements","filter","purgeOneElement","elementToPurge","getTopOffset","getBoundingClientRect","top","pageYOffset","ownerDocument","documentElement","clientTop","fold","left","pageXOffset","getLeftOffset","documentWidth","innerWidth","offsetWidth","event","initCustomEvent","options","CustomEvent","dispatchEvent","detail","autoInitialize","document","createEvent","replaceExtToWebp","condition","replace","className","isBot","test","navigator","userAgent","supportsClassList","runningOnBrowser","removeClass","remove","getContext","createElement","detectWebp","classList","add","childTag","parentTag","children","setAttributeIfValue","RegExp","setSourcesInChildren","dataAttrName","toWebpFlag","parent","i","attrValue","setSourcesVideo","setSourcesFunction","setSourcesFunctions","to_webp","_updateLoadingCount","srcDataValue","setValue","setSourcesBgImage","callback","bgDataValue","argument","genericLoadEventName","IMG","srcDataName","parentNode","srcsetDataValue","srcsetDataName","backgroundImage","IFRAME","VIDEO","setSourcesImg","setSourcesIframe","setSources","removeEventListener","addAllEventListeners","_elements","loadHandler","eventName","handler","eventHandler","success","removeAllEventListeners","errorHandler","revealElement","length","splice","indexes","pop","_loopThroughElements","_extends","elementsLength","_queryOriginNode","_boundHandleScroll","offsetParent","_isFirstLoop","update","prototype","forceDownload","processedIndexes","push","removeFromArray","isFirstLoop","_startScrollHandler","_isHandlingScroll","remainingTime","_stopScrollHandler","loadAll","plusMinus","destroy","Date","now","clearTimeout","setTimeout","load","bind","nodeSet","querySelectorAll","Array","slice","call","optionsItem","webpString","lazyLoadOptions"],"mappings":"kYAAC,SAAUA,EAAQC,GACC,YAAnB,oBAAOC,QAAP,YAAAC,QAAOD,WAA0C,oBAAXE,OAAyBA,OAAOF,QAAUD,IAC9D,mBAAXI,QAAyBA,OAAOC,IAAMD,OAAOJ,GACnDD,EAAOO,SAAWN,IA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J,wBACAzI,KAAYO,eApIErB,KAAAqB,aAAAuJ,WAuFhB,WAgDJC,KAAM3J,kBAAkBH,KAAlB2J,MACL3B,KAAAA,aAAuB,KACvB/I,KAAAoJ,wBAzIF0B,KAAA9K,MA4FKoK,SAmDJpK,KAAAoJ,wBA3CAkB,QAAS,WACRtK,KAAKoJ,sBAAqB,IAG3BO,OAAQ,SAASpG,GAChB,IAAM3C,EAAWZ,KAAKc,UAChBiK,EACLxH,GACAvD,KAAKuJ,iBAAiByB,iBAAiBpK,EAASoB,mBAEjDhC,KAAKuI,UAAYlF,EAChB4H,MAAMrB,UAAUsB,MAAMC,KAAKJ,IAGxBzF,EACHtF,KAAKsK,WAINtK,KAAKoJ,uBACLpJ,KAAKkK,wBAGNM,QAAS,WACR7I,OAAO0G,oBAAoB,SAAUrI,KAAKwJ,oBACtCxJ,KAAKqB,eACRsJ,aAAa3K,KAAKqB,cAClBrB,KAAKqB,aAAe,MAErBrB,KAAKqK,qBACLrK,KAAKuI,UAAY,KACjBvI,KAAKuJ,iBAAmB,KACxBvJ,KAAKc,UAAY,MAGlB+J,KAAM,SAAS3K,EAASa,GACvBgI,EAAc7I,EAASF,KAAMe,KAK3B4E,GA5XD1F,SAAeE,EAAUiL,GACzB,GAAAzG,EAPF,GAAKA,EAAQqE,OAcd,IAAMhD,IAAaoF,EAAbpF,EAAAA,EAAAA,EAAmBrB,EAAAiC,GAAAA,GAAA,EACxB3G,EAAIoL,EAAaD,QAJOnL,EACxBkF,EAAkBC,GAuXlBL,CAAehF,EAAU4B,OAAO2J,iBAG1BvL","file":"lazyload.min.js","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.LazyLoad = factory());\n}(this, (function () { 'use strict';\n\nvar getDefaultSettings = () => ({\n\telements_selector: \"img\",\n\tcontainer: window,\n\tthreshold: 300,\n\tthrottle: 150,\n\tdata_src: \"src\",\n\tdata_srcset: \"srcset\",\n\tdata_sizes: \"sizes\",\n\tdata_bg: \"bg\",\n\tclass_loading: \"loading\",\n\tclass_loaded: \"loaded\",\n\tclass_error: \"error\",\n\tclass_initial: \"initial\",\n\tskip_invisible: true,\n\tcallback_load: null,\n\tcallback_error: null,\n\tcallback_set: null,\n\tcallback_enter: null,\n\tcallback_finish: null,\n\tto_webp: false\n});\n\nconst dataPrefix = \"data-\";\nconst processedDataName = \"was-processed\";\nconst processedDataValue = \"true\";\n\nconst getData = (element, attribute) => {\n\treturn element.getAttribute(dataPrefix + attribute);\n};\n\nconst setData = (element, attribute, value) => {\n\tvar attrName = dataPrefix + attribute;\n\tif (value === null) {\n\t\telement.removeAttribute(attrName);\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, value);\n};\n\nconst setWasProcessedData = element =>\n\tsetData(element, processedDataName, processedDataValue);\n\nconst getWasProcessedData = element =>\n\tgetData(element, processedDataName) === processedDataValue;\n\nconst purgeProcessedElements = elements => {\n\treturn elements.filter(element => !getWasProcessedData(element));\n};\n\nconst purgeOneElement = (elements, elementToPurge) => {\n\treturn elements.filter(element => element !== elementToPurge);\n};\n\nconst getTopOffset = function(element) {\n\treturn (\n\t\telement.getBoundingClientRect().top +\n\t\twindow.pageYOffset -\n\t\telement.ownerDocument.documentElement.clientTop\n\t);\n};\n\nconst isBelowViewport = function(element, container, threshold) {\n\tconst fold =\n\t\tcontainer === window\n\t\t\t? window.innerHeight + window.pageYOffset\n\t\t\t: getTopOffset(container) + container.offsetHeight;\n\treturn fold <= getTopOffset(element) - threshold;\n};\n\nconst getLeftOffset = function(element) {\n\treturn (\n\t\telement.getBoundingClientRect().left +\n\t\twindow.pageXOffset -\n\t\telement.ownerDocument.documentElement.clientLeft\n\t);\n};\n\nconst isAtRightOfViewport = function(element, container, threshold) {\n\tconst documentWidth = window.innerWidth;\n\tconst fold =\n\t\tcontainer === window\n\t\t\t? documentWidth + window.pageXOffset\n\t\t\t: getLeftOffset(container) + documentWidth;\n\treturn fold <= getLeftOffset(element) - threshold;\n};\n\nconst isAboveViewport = function(element, container, threshold) {\n\tconst fold =\n\t\tcontainer === window ? window.pageYOffset : getTopOffset(container);\n\treturn fold >= getTopOffset(element) + threshold + element.offsetHeight;\n};\n\nconst isAtLeftOfViewport = function(element, container, threshold) {\n\tconst fold =\n\t\tcontainer === window ? window.pageXOffset : getLeftOffset(container);\n\treturn fold >= getLeftOffset(element) + threshold + element.offsetWidth;\n};\n\nfunction isInsideViewport(element, container, threshold) {\n\treturn (\n\t\t!isBelowViewport(element, container, threshold) &&\n\t\t!isAboveViewport(element, container, threshold) &&\n\t\t!isAtRightOfViewport(element, container, threshold) &&\n\t\t!isAtLeftOfViewport(element, container, threshold)\n\t);\n}\n\n/* Creates instance and notifies it through the window element */\nconst createInstance = function(classObj, options) {\n\tvar event;\n\tlet eventString = \"LazyLoad::Initialized\";\n\tlet instance = new classObj(options);\n\ttry {\n\t\t// Works in modern browsers\n\t\tevent = new CustomEvent(eventString, { detail: { instance } });\n\t} catch (err) {\n\t\t// Works in Internet Explorer (all versions)\n\t\tevent = document.createEvent(\"CustomEvent\");\n\t\tevent.initCustomEvent(eventString, false, false, { instance });\n\t}\n\twindow.dispatchEvent(event);\n};\n\n/* Auto initialization of one or more instances of lazyload, depending on the \n options passed in (plain object or an array) */\nfunction autoInitialize(classObj, options) {\n\tif (!options) {\n\t\treturn;\n\t}\n\tif (!options.length) {\n\t\t// Plain object\n\t\tcreateInstance(classObj, options);\n\t} else {\n\t\t// Array of objects\n\t\tfor (let i = 0, optionsItem; (optionsItem = options[i]); i += 1) {\n\t\t\tcreateInstance(classObj, optionsItem);\n\t\t}\n\t}\n}\n\nconst replaceExtToWebp = (value, condition) =>\n\tcondition ? value.replace(/\\.(jpe?g|png)/gi, \".webp\") : value;\n\nconst detectWebp = () => {\n\tvar webpString = \"image/webp\";\n\tvar canvas = document.createElement(\"canvas\");\n\n\tif (canvas.getContext && canvas.getContext(\"2d\")) {\n\t\treturn canvas.toDataURL(webpString).indexOf(`data:${webpString}`) === 0;\n\t}\n\n\treturn false;\n};\n\nconst runningOnBrowser = typeof window !== \"undefined\";\n\nconst isBot =\n\t(runningOnBrowser && !(\"onscroll\" in window)) ||\n\t/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);\nconst supportsClassList =\n\trunningOnBrowser && \"classList\" in document.createElement(\"p\");\n\nconst supportsWebp = runningOnBrowser && detectWebp();\n\nconst addClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.add(className);\n\t\treturn;\n\t}\n\telement.className += (element.className ? \" \" : \"\") + className;\n};\n\nconst removeClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.remove(className);\n\t\treturn;\n\t}\n\telement.className = element.className.\n\t\treplace(new RegExp(\"(^|\\\\s+)\" + className + \"(\\\\s+|$)\"), \" \").\n\t\treplace(/^\\s+/, \"\").\n\t\treplace(/\\s+$/, \"\");\n};\n\nconst setSourcesInChildren = function(\n\tparentTag,\n\tattrName,\n\tdataAttrName,\n\ttoWebpFlag\n) {\n\tfor (let i = 0, childTag; (childTag = parentTag.children[i]); i += 1) {\n\t\tif (childTag.tagName === \"SOURCE\") {\n\t\t\tlet attrValue = getData(childTag, dataAttrName);\n\t\t\tsetAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);\n\t\t}\n\t}\n};\n\nconst setAttributeIfValue = function(\n\telement,\n\tattrName,\n\tvalue,\n\ttoWebpFlag\n) {\n\tif (!value) {\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));\n};\n\nconst setSourcesImg = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcsetDataName = settings.data_srcset;\n\tconst parent = element.parentNode;\n\n\tif (parent && parent.tagName === \"PICTURE\") {\n\t\tsetSourcesInChildren(parent, \"srcset\", srcsetDataName, toWebpFlag);\n\t}\n\tconst sizesDataValue = getData(element, settings.data_sizes);\n\tsetAttributeIfValue(element, \"sizes\", sizesDataValue);\n\tconst srcsetDataValue = getData(element, srcsetDataName);\n\tsetAttributeIfValue(element, \"srcset\", srcsetDataValue, toWebpFlag);\n\tconst srcDataValue = getData(element, settings.data_src);\n\tsetAttributeIfValue(element, \"src\", srcDataValue, toWebpFlag);\n};\n\nconst setSourcesIframe = (element, settings) => {\n\tconst srcDataValue = getData(element, settings.data_src);\n\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n};\n\nconst setSourcesVideo = (element, settings) => {\n\tconst srcDataName = settings.data_src;\n\tconst srcDataValue = getData(element, srcDataName);\n\n\tsetSourcesInChildren(element, \"src\", srcDataName);\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n\telement.load();\n};\n\nconst setSourcesBgImage = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcDataValue = getData(element, settings.data_src);\n\tconst bgDataValue = getData(element, settings.data_bg);\n\n\tif (srcDataValue) {\n\t\tlet setValue = replaceExtToWebp(srcDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = `url(\"${setValue}\")`;\n\t}\n\n\tif (bgDataValue) {\n\t\tlet setValue = replaceExtToWebp(bgDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = setValue;\n\t}\n};\n\nconst setSourcesFunctions = {\n\tIMG: setSourcesImg,\n\tIFRAME: setSourcesIframe,\n\tVIDEO: setSourcesVideo\n};\n\nconst setSources = (element, instance) => {\n\tconst settings = instance._settings;\n\tconst tagName = element.tagName;\n\tconst setSourcesFunction = setSourcesFunctions[tagName];\n\tif (setSourcesFunction) {\n\t\tsetSourcesFunction(element, settings);\n\t\tinstance._updateLoadingCount(1);\n\t\tinstance._elements = purgeOneElement(instance._elements, element);\n\t\treturn;\n\t}\n\tsetSourcesBgImage(element, settings);\n};\n\nconst callbackIfSet = function(callback, argument) {\n\tif (callback) {\n\t\tcallback(argument);\n\t}\n};\n\nconst genericLoadEventName = \"load\";\nconst mediaLoadEventName = \"loadeddata\";\nconst errorEventName = \"error\";\n\nconst addEventListener = (element, eventName, handler) => {\n\telement.addEventListener(eventName, handler);\n};\n\nconst removeEventListener = (element, eventName, handler) => {\n\telement.removeEventListener(eventName, handler);\n};\n\nconst addAllEventListeners = (element, loadHandler, errorHandler) => {\n\taddEventListener(element, genericLoadEventName, loadHandler);\n\taddEventListener(element, mediaLoadEventName, loadHandler);\n\taddEventListener(element, errorEventName, errorHandler);\n};\n\nconst removeAllEventListeners = (element, loadHandler, errorHandler) => {\n\tremoveEventListener(element, genericLoadEventName, loadHandler);\n\tremoveEventListener(element, mediaLoadEventName, loadHandler);\n\tremoveEventListener(element, errorEventName, errorHandler);\n};\n\nconst eventHandler = function(event, success, instance) {\n\tvar settings = instance._settings;\n\tconst className = success ? settings.class_loaded : settings.class_error;\n\tconst callback = success ? settings.callback_load : settings.callback_error;\n\tconst element = event.target;\n\n\tremoveClass(element, settings.class_loading);\n\taddClass(element, className);\n\tcallbackIfSet(callback, element);\n\n\tinstance._updateLoadingCount(-1);\n};\n\nconst addOneShotEventListeners = (element, instance) => {\n\tconst loadHandler = event => {\n\t\teventHandler(event, true, instance);\n\t\tremoveAllEventListeners(element, loadHandler, errorHandler);\n\t};\n\tconst errorHandler = event => {\n\t\teventHandler(event, false, instance);\n\t\tremoveAllEventListeners(element, loadHandler, errorHandler);\n\t};\n\taddAllEventListeners(element, loadHandler, errorHandler);\n};\n\nconst managedTags = [\"IMG\", \"IFRAME\", \"VIDEO\"];\n\nfunction revealElement(element, instance, force) {\n\tvar settings = instance._settings;\n\tif (!force && getWasProcessedData(element)) {\n\t\treturn; // element has already been processed and force wasn't true\n\t}\n\tcallbackIfSet(settings.callback_enter, element);\n\tif (managedTags.indexOf(element.tagName) > -1) {\n\t\taddOneShotEventListeners(element, instance);\n\t\taddClass(element, settings.class_loading);\n\t}\n\tsetSources(element, instance);\n\tsetWasProcessedData(element);\n\tcallbackIfSet(settings.callback_set, element);\n}\n\nconst removeFromArray = (elements, indexes) => {\n\twhile (indexes.length) {\n\t\telements.splice(indexes.pop(), 1);\n\t}\n};\n\n/*\n * Constructor\n */\n\nconst LazyLoad = function(instanceSettings) {\n\tthis._settings = Object.assign({}, getDefaultSettings(), instanceSettings);\n\tthis._loadingCount = 0;\n\tthis._queryOriginNode =\n\t\tthis._settings.container === window\n\t\t\t? document\n\t\t\t: this._settings.container;\n\n\tthis._previousLoopTime = 0;\n\tthis._loopTimeout = null;\n\tthis._boundHandleScroll = this.handleScroll.bind(this);\n\n\tthis._isFirstLoop = true;\n\twindow.addEventListener(\"resize\", this._boundHandleScroll);\n\tthis.update();\n};\n\nLazyLoad.prototype = {\n\t_loopThroughElements: function(forceDownload) {\n\t\tconst settings = this._settings,\n\t\t\telements = this._elements,\n\t\t\telementsLength = !elements ? 0 : elements.length;\n\t\tlet i,\n\t\t\tprocessedIndexes = [],\n\t\t\tisFirstLoop = this._isFirstLoop;\n\n\t\tif (isFirstLoop) {\n\t\t\tthis._isFirstLoop = false;\n\t\t}\n\n\t\tif (elementsLength === 0) {\n\t\t\tthis._stopScrollHandler();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (i = 0; i < elementsLength; i++) {\n\t\t\tlet element = elements[i];\n\t\t\t/* If must skip_invisible and element is invisible, skip it */\n\t\t\tif (settings.skip_invisible && element.offsetParent === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tforceDownload ||\n\t\t\t\tisInsideViewport(\n\t\t\t\t\telement,\n\t\t\t\t\tsettings.container,\n\t\t\t\t\tsettings.threshold\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tif (isFirstLoop) {\n\t\t\t\t\taddClass(element, settings.class_initial);\n\t\t\t\t}\n\t\t\t\tthis.load(element);\n\t\t\t\tprocessedIndexes.push(i);\n\t\t\t}\n\t\t}\n\n\t\t// Removing processed elements from this._elements.\n\t\tremoveFromArray(elements, processedIndexes);\n\t},\n\n\t_startScrollHandler: function() {\n\t\tif (!this._isHandlingScroll) {\n\t\t\tthis._isHandlingScroll = true;\n\t\t\tthis._settings.container.addEventListener(\n\t\t\t\t\"scroll\",\n\t\t\t\tthis._boundHandleScroll\n\t\t\t);\n\t\t}\n\t},\n\n\t_stopScrollHandler: function() {\n\t\tif (this._isHandlingScroll) {\n\t\t\tthis._isHandlingScroll = false;\n\t\t\tthis._settings.container.removeEventListener(\n\t\t\t\t\"scroll\",\n\t\t\t\tthis._boundHandleScroll\n\t\t\t);\n\t\t}\n\t},\n\n\t_updateLoadingCount: function(plusMinus) {\n\t\tthis._loadingCount += plusMinus;\n\t\tif (this._elements.length === 0 && this._loadingCount === 0) {\n\t\t\tcallbackIfSet(this._settings.callback_finish);\n\t\t}\n\t},\n\n\thandleScroll: function() {\n\t\tconst throttle = this._settings.throttle;\n\n\t\tif (throttle !== 0) {\n\t\t\tlet now = Date.now();\n\t\t\tlet remainingTime = throttle - (now - this._previousLoopTime);\n\t\t\tif (remainingTime <= 0 || remainingTime > throttle) {\n\t\t\t\tif (this._loopTimeout) {\n\t\t\t\t\tclearTimeout(this._loopTimeout);\n\t\t\t\t\tthis._loopTimeout = null;\n\t\t\t\t}\n\t\t\t\tthis._previousLoopTime = now;\n\t\t\t\tthis._loopThroughElements();\n\t\t\t} else if (!this._loopTimeout) {\n\t\t\t\tthis._loopTimeout = setTimeout(\n\t\t\t\t\tfunction() {\n\t\t\t\t\t\tthis._previousLoopTime = Date.now();\n\t\t\t\t\t\tthis._loopTimeout = null;\n\t\t\t\t\t\tthis._loopThroughElements();\n\t\t\t\t\t}.bind(this),\n\t\t\t\t\tremainingTime\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._loopThroughElements();\n\t\t}\n\t},\n\n\tloadAll: function() {\n\t\tthis._loopThroughElements(true);\n\t},\n\n\tupdate: function(elements) {\n\t\tconst settings = this._settings;\n\t\tconst nodeSet =\n\t\t\telements ||\n\t\t\tthis._queryOriginNode.querySelectorAll(settings.elements_selector);\n\n\t\tthis._elements = purgeProcessedElements(\n\t\t\tArray.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility\n\t\t);\n\n\t\tif (isBot) {\n\t\t\tthis.loadAll();\n\t\t\treturn;\n\t\t}\n\n\t\tthis._loopThroughElements();\n\t\tthis._startScrollHandler();\n\t},\n\n\tdestroy: function() {\n\t\twindow.removeEventListener(\"resize\", this._boundHandleScroll);\n\t\tif (this._loopTimeout) {\n\t\t\tclearTimeout(this._loopTimeout);\n\t\t\tthis._loopTimeout = null;\n\t\t}\n\t\tthis._stopScrollHandler();\n\t\tthis._elements = null;\n\t\tthis._queryOriginNode = null;\n\t\tthis._settings = null;\n\t},\n\n\tload: function(element, force) {\n\t\trevealElement(element, this, force);\n\t}\n};\n\n/* Automatic instances creation if required (useful for async script loading) */\nif (runningOnBrowser) {\n\tautoInitialize(LazyLoad, window.lazyLoadOptions);\n}\n\nreturn LazyLoad;\n\n})));\n"]}
|
|
composer.lock
CHANGED
@@ -273,16 +273,16 @@
|
|
273 |
},
|
274 |
{
|
275 |
"name": "wp-media/rocket-lazyload-common",
|
276 |
-
"version": "v2.
|
277 |
"source": {
|
278 |
"type": "git",
|
279 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
280 |
-
"reference": "
|
281 |
},
|
282 |
"dist": {
|
283 |
"type": "zip",
|
284 |
-
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/
|
285 |
-
"reference": "
|
286 |
"shasum": ""
|
287 |
},
|
288 |
"require": {
|
@@ -317,7 +317,7 @@
|
|
317 |
}
|
318 |
],
|
319 |
"description": "Common Code between WP Rocket and Lazyload by WP Rocket",
|
320 |
-
"time": "2019-02-
|
321 |
}
|
322 |
],
|
323 |
"packages-dev": [
|
273 |
},
|
274 |
{
|
275 |
"name": "wp-media/rocket-lazyload-common",
|
276 |
+
"version": "v2.2.1",
|
277 |
"source": {
|
278 |
"type": "git",
|
279 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
280 |
+
"reference": "d30621c96381bfd97d0196910e66d0bb4c503f78"
|
281 |
},
|
282 |
"dist": {
|
283 |
"type": "zip",
|
284 |
+
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/d30621c96381bfd97d0196910e66d0bb4c503f78",
|
285 |
+
"reference": "d30621c96381bfd97d0196910e66d0bb4c503f78",
|
286 |
"shasum": ""
|
287 |
},
|
288 |
"require": {
|
317 |
}
|
318 |
],
|
319 |
"description": "Common Code between WP Rocket and Lazyload by WP Rocket",
|
320 |
+
"time": "2019-02-26T17:10:45+00:00"
|
321 |
}
|
322 |
],
|
323 |
"packages-dev": [
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: wp_rocket, wp_media
|
3 |
Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar, youtube
|
4 |
Requires at least: 4.7
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
|
10 |
|
@@ -74,13 +74,22 @@ Some plugins are not compatible without lazy loading. Please open a support thre
|
|
74 |
|
75 |
= How can I lazyload a background-image? =
|
76 |
|
77 |
-
The
|
|
|
|
|
|
|
|
|
78 |
|
79 |
`<div class="rocket-lazyload-bg" data-bg="url(../img/image.jpg)"></div>`
|
80 |
|
81 |
The element must have the class `rocket-lazyload-bg`, and a `data-bg` attribute, which value is the CSS url for the image.
|
82 |
|
83 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
84 |
= 2.0.4 =
|
85 |
* Enhancement: Add filter for iframe lazyload pattern exclusion
|
86 |
* Enhancement: Auto-exclude soliloquy-image pattern from lazyload
|
2 |
Contributors: wp_rocket, wp_media
|
3 |
Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar, youtube
|
4 |
Requires at least: 4.7
|
5 |
+
Tested up to: 5.1
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 2.1
|
8 |
|
9 |
Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
|
10 |
|
74 |
|
75 |
= How can I lazyload a background-image? =
|
76 |
|
77 |
+
The plugin will automatically lazyload background-images set with a `style` attribute to a `div` element:
|
78 |
+
|
79 |
+
`<div style="background-image: url(image.jpg);">`
|
80 |
+
|
81 |
+
You can also apply it manually. The element you want to apply lazyload on must have this specific markup:
|
82 |
|
83 |
`<div class="rocket-lazyload-bg" data-bg="url(../img/image.jpg)"></div>`
|
84 |
|
85 |
The element must have the class `rocket-lazyload-bg`, and a `data-bg` attribute, which value is the CSS url for the image.
|
86 |
|
87 |
== Changelog ==
|
88 |
+
= 2.1 =
|
89 |
+
* Enhancement: Update lazyload script to the latest version
|
90 |
+
* Enhancement: Apply lazyload on picture elements found on the page
|
91 |
+
* Enhancement: Apply lazyload on div elements with a background image found on the page. See FAQ for more info.
|
92 |
+
|
93 |
= 2.0.4 =
|
94 |
* Enhancement: Add filter for iframe lazyload pattern exclusion
|
95 |
* Enhancement: Auto-exclude soliloquy-image pattern from lazyload
|
rocket-lazy-load.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Lazy Load by WP Rocket
|
4 |
* Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
|
5 |
* Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
|
6 |
-
* Version: 2.
|
7 |
* Author: WP Rocket
|
8 |
* Author URI: https://wp-rocket.me
|
9 |
* Text Domain: rocket-lazy-load
|
@@ -29,7 +29,7 @@
|
|
29 |
|
30 |
defined('ABSPATH') || die('Cheatin\' uh?');
|
31 |
|
32 |
-
define('ROCKET_LL_VERSION', '2.
|
33 |
define('ROCKET_LL_WP_VERSION', '4.7');
|
34 |
define('ROCKET_LL_PHP_VERSION', '5.4');
|
35 |
define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
|
3 |
* Plugin Name: Lazy Load by WP Rocket
|
4 |
* Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
|
5 |
* Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
|
6 |
+
* Version: 2.1
|
7 |
* Author: WP Rocket
|
8 |
* Author URI: https://wp-rocket.me
|
9 |
* Text Domain: rocket-lazy-load
|
29 |
|
30 |
defined('ABSPATH') || die('Cheatin\' uh?');
|
31 |
|
32 |
+
define('ROCKET_LL_VERSION', '2.1');
|
33 |
define('ROCKET_LL_WP_VERSION', '4.7');
|
34 |
define('ROCKET_LL_PHP_VERSION', '5.4');
|
35 |
define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
|
src/Subscriber/LazyloadSubscriber.php
CHANGED
@@ -132,10 +132,8 @@ class LazyloadSubscriber implements SubscriberInterface
|
|
132 |
|
133 |
$args = [
|
134 |
'base_url' => ROCKET_LL_FRONT_JS_URL,
|
135 |
-
'suffix' => defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min',
|
136 |
'threshold' => $threshold,
|
137 |
-
'version' => '
|
138 |
-
'fallback' => '8.17',
|
139 |
];
|
140 |
|
141 |
if ($this->option_array->get('images')) {
|
@@ -308,6 +306,8 @@ class LazyloadSubscriber implements SubscriberInterface
|
|
308 |
|
309 |
if ($this->option_array->get('images')) {
|
310 |
$html = $this->image->lazyloadImages($html, $buffer);
|
|
|
|
|
311 |
}
|
312 |
|
313 |
if ($this->option_array->get('iframes')) {
|
132 |
|
133 |
$args = [
|
134 |
'base_url' => ROCKET_LL_FRONT_JS_URL,
|
|
|
135 |
'threshold' => $threshold,
|
136 |
+
'version' => '11.0.2',
|
|
|
137 |
];
|
138 |
|
139 |
if ($this->option_array->get('images')) {
|
306 |
|
307 |
if ($this->option_array->get('images')) {
|
308 |
$html = $this->image->lazyloadImages($html, $buffer);
|
309 |
+
$html = $this->image->lazyloadPictures($html, $buffer);
|
310 |
+
$html = $this->image->lazyloadBackgroundImages($html, $buffer);
|
311 |
}
|
312 |
|
313 |
if ($this->option_array->get('iframes')) {
|
vendor/composer/installed.json
CHANGED
@@ -274,17 +274,17 @@
|
|
274 |
},
|
275 |
{
|
276 |
"name": "wp-media/rocket-lazyload-common",
|
277 |
-
"version": "v2.
|
278 |
-
"version_normalized": "2.
|
279 |
"source": {
|
280 |
"type": "git",
|
281 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
282 |
-
"reference": "
|
283 |
},
|
284 |
"dist": {
|
285 |
"type": "zip",
|
286 |
-
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/
|
287 |
-
"reference": "
|
288 |
"shasum": ""
|
289 |
},
|
290 |
"require": {
|
@@ -302,7 +302,7 @@
|
|
302 |
"symfony/yaml": "2.8.*",
|
303 |
"wp-coding-standards/wpcs": "^2.0.0"
|
304 |
},
|
305 |
-
"time": "2019-02-
|
306 |
"type": "library",
|
307 |
"installation-source": "dist",
|
308 |
"autoload": {
|
274 |
},
|
275 |
{
|
276 |
"name": "wp-media/rocket-lazyload-common",
|
277 |
+
"version": "v2.2.1",
|
278 |
+
"version_normalized": "2.2.1.0",
|
279 |
"source": {
|
280 |
"type": "git",
|
281 |
"url": "https://github.com/wp-media/rocket-lazyload-common.git",
|
282 |
+
"reference": "d30621c96381bfd97d0196910e66d0bb4c503f78"
|
283 |
},
|
284 |
"dist": {
|
285 |
"type": "zip",
|
286 |
+
"url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/d30621c96381bfd97d0196910e66d0bb4c503f78",
|
287 |
+
"reference": "d30621c96381bfd97d0196910e66d0bb4c503f78",
|
288 |
"shasum": ""
|
289 |
},
|
290 |
"require": {
|
302 |
"symfony/yaml": "2.8.*",
|
303 |
"wp-coding-standards/wpcs": "^2.0.0"
|
304 |
},
|
305 |
+
"time": "2019-02-26T17:10:45+00:00",
|
306 |
"type": "library",
|
307 |
"installation-source": "dist",
|
308 |
"autoload": {
|
vendor/wp-media/rocket-lazyload-common/src/Assets.php
CHANGED
@@ -39,17 +39,14 @@ class Assets
|
|
39 |
],
|
40 |
'threshold' => 300,
|
41 |
'version' => '',
|
42 |
-
'fallback' => '',
|
43 |
];
|
44 |
|
45 |
$args = wp_parse_args($args, $defaults);
|
46 |
-
$min = defined('SCRIPT_DEBUG') ? '' : '.min';
|
47 |
|
48 |
-
return '<script>
|
49 |
-
|
50 |
-
|
51 |
-
s.src = !("IntersectionObserver" in w) ? "' . $args['base_url'] . 'lazyload-' . $args['fallback'] . $min . '.js" : "' . $args['base_url'] . 'lazyload-' . $args['version'] . $min . '.js";
|
52 |
-
w.lazyLoadOptions = {
|
53 |
elements_selector: "' . esc_attr(implode(',', $args['elements'])) . '",
|
54 |
data_src: "lazy-src",
|
55 |
data_srcset: "lazy-srcset",
|
@@ -69,9 +66,7 @@ class Assets
|
|
69 |
}
|
70 |
}
|
71 |
}
|
72 |
-
};
|
73 |
-
b.appendChild(s);
|
74 |
-
}(window, document));
|
75 |
|
76 |
// Listen to the Initialized event
|
77 |
window.addEventListener(\'LazyLoad::Initialized\', function (e) {
|
@@ -91,7 +86,8 @@ class Assets
|
|
91 |
observer.observe(b, config);
|
92 |
}
|
93 |
}, false);
|
94 |
-
</script>
|
|
|
95 |
}
|
96 |
|
97 |
/**
|
39 |
],
|
40 |
'threshold' => 300,
|
41 |
'version' => '',
|
|
|
42 |
];
|
43 |
|
44 |
$args = wp_parse_args($args, $defaults);
|
45 |
+
$min = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
|
46 |
|
47 |
+
return '<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=default%2CIntersectionObserver%2CIntersectionObserverEntry"></script>
|
48 |
+
<script>
|
49 |
+
window.lazyLoadOptions = {
|
|
|
|
|
50 |
elements_selector: "' . esc_attr(implode(',', $args['elements'])) . '",
|
51 |
data_src: "lazy-src",
|
52 |
data_srcset: "lazy-srcset",
|
66 |
}
|
67 |
}
|
68 |
}
|
69 |
+
};
|
|
|
|
|
70 |
|
71 |
// Listen to the Initialized event
|
72 |
window.addEventListener(\'LazyLoad::Initialized\', function (e) {
|
86 |
observer.observe(b, config);
|
87 |
}
|
88 |
}, false);
|
89 |
+
</script>
|
90 |
+
<script async src="' . $args['base_url'] . 'lazyload-' . $args['version'] . $min . '.js"></script>';
|
91 |
}
|
92 |
|
93 |
/**
|
vendor/wp-media/rocket-lazyload-common/src/Image.php
CHANGED
@@ -50,6 +50,105 @@ class Image
|
|
50 |
return $html;
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
/**
|
54 |
* Checks if the provided string matches with the provided excluded patterns
|
55 |
*
|
50 |
return $html;
|
51 |
}
|
52 |
|
53 |
+
/**
|
54 |
+
* Applies lazyload on background images defined in style attributes
|
55 |
+
*
|
56 |
+
* @param string $html Original HTML.
|
57 |
+
* @param string $buffer Content to parse.
|
58 |
+
* @return string
|
59 |
+
*/
|
60 |
+
public function lazyloadBackgroundImages($html, $buffer)
|
61 |
+
{
|
62 |
+
if (! preg_match_all('#<div\s+(?<before>[^>]*)style\s*=\s*([\'"])(?<styles>(?:(?!\2).)*?)\2(?<after>[^>]*)>#is', $buffer, $elements, PREG_SET_ORDER)) {
|
63 |
+
return $html;
|
64 |
+
}
|
65 |
+
|
66 |
+
foreach ($elements as $element) {
|
67 |
+
if ($this->isExcluded($element['before'] . $element['after'], $this->getExcludedAttributes())) {
|
68 |
+
continue;
|
69 |
+
}
|
70 |
+
|
71 |
+
if (! preg_match('#background-image\s*:\s*(?<attr>\s*url\s*\((?<url>[^)]+)\))\s*;?#is', $element['styles'], $url)) {
|
72 |
+
continue;
|
73 |
+
}
|
74 |
+
|
75 |
+
$url['url'] = trim($url['url'], '\'" ');
|
76 |
+
|
77 |
+
if ($this->isExcluded($url['url'], $this->getExcludedSrc())) {
|
78 |
+
continue;
|
79 |
+
}
|
80 |
+
|
81 |
+
$lazy_bg = $this->addLazyBgCLass($element[0]);
|
82 |
+
$lazy_bg = str_replace($url[0], '', $lazy_bg);
|
83 |
+
$lazy_bg = str_replace('<div', '<div data-bg="url(' . esc_attr($url['url']) . ')"', $lazy_bg);
|
84 |
+
|
85 |
+
$html = str_replace($element[0], $lazy_bg, $html);
|
86 |
+
unset($lazy_bg);
|
87 |
+
}
|
88 |
+
|
89 |
+
return $html;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Add the identifier class to the element
|
94 |
+
*
|
95 |
+
* @param string $element Element to add the class to.
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
private function addLazyBgClass($element)
|
99 |
+
{
|
100 |
+
if (preg_match('#class=["\']?(?<classes>[^"\'>]*)["\']?#is', $element, $class)) {
|
101 |
+
$classes = str_replace($class['classes'], $class['classes'] . ' rocket-lazyload-bg', $class[0]);
|
102 |
+
$element = str_replace($class[0], $classes, $element);
|
103 |
+
|
104 |
+
return $element;
|
105 |
+
}
|
106 |
+
|
107 |
+
return str_replace('<div', '<div class="rocket-lazyload-bg"', $element);
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Applies lazyload on picture elements found in the HTML.
|
112 |
+
*
|
113 |
+
* @param string $html Original HTML.
|
114 |
+
* @param string $buffer Content to parse.
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function lazyloadPictures($html, $buffer)
|
118 |
+
{
|
119 |
+
preg_match_all('#<picture(?:.*)?>(?<sources>.*)</picture>#iUs', $buffer, $pictures, PREG_SET_ORDER);
|
120 |
+
|
121 |
+
if (empty($pictures)) {
|
122 |
+
return $html;
|
123 |
+
}
|
124 |
+
|
125 |
+
$pictures = array_unique($pictures, SORT_REGULAR);
|
126 |
+
$excluded = array_merge($this->getExcludedAttributes(), $this->getExcludedSrc());
|
127 |
+
|
128 |
+
foreach ($pictures as $picture) {
|
129 |
+
preg_match_all('#<source(?<atts>\s.+)>#iUs', $picture['sources'], $sources, PREG_SET_ORDER);
|
130 |
+
|
131 |
+
if (empty($sources)) {
|
132 |
+
continue;
|
133 |
+
}
|
134 |
+
|
135 |
+
$sources = array_unique($sources, SORT_REGULAR);
|
136 |
+
|
137 |
+
foreach ($sources as $source) {
|
138 |
+
if ($this->isExcluded($source['atts'], $excluded)) {
|
139 |
+
continue;
|
140 |
+
}
|
141 |
+
|
142 |
+
$lazyload_srcset = preg_replace('/([\s"\'])srcset/i', '\1data-srcset', $source[0]);
|
143 |
+
$html = str_replace($source[0], $lazyload_srcset, $html);
|
144 |
+
|
145 |
+
unset($lazyload_srcset);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
return $html;
|
150 |
+
}
|
151 |
+
|
152 |
/**
|
153 |
* Checks if the provided string matches with the provided excluded patterns
|
154 |
*
|