HEX
Server: Apache
System: Linux webm020.cluster127.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: bohousj (181416)
PHP: 8.4.22
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/bohousj/www/wp-content/plugins/wp-fastest-cache-premium/pro/js/lazy-load.js
var Wpfc_Lazyload = {
	sources: [],
	loaded_index:[],
	init: function(){
		this.set_source(document.getElementsByTagName("img"));
		this.set_source(document.getElementsByTagName("iframe"));

		this.load_sources(true);
		window.addEventListener('scroll', function(){Wpfc_Lazyload.load_sources(false);});
		window.addEventListener('resize', function(){Wpfc_Lazyload.load_sources(false);});
	},
	set_source: function(arr){
		if(arr.length > 0){
			var self = this;
			[].forEach.call(arr, function(e, index) {
				self.sources.push(e);
			});
		}
	},
	load_sources: function(pageload){
		var self = this;
		var originalsrc,originalsrcset;
		var winH = document.documentElement.clientHeight || body.clientHeight;
		var number = pageload ? 0 : 300;

		[].forEach.call(self.sources, function(e, index) {
			try{
				var elemRect = e.getBoundingClientRect();

				if(winH - elemRect.top + number > 0){
					if(self.loaded_index.indexOf(index) == -1){
						originalsrc = e.getAttribute("data-wpfc-original-src");
						originalsrcset = e.getAttribute("data-wpfc-original-srcset");

						if(originalsrc || originalsrcset){
							if(originalsrc){
								e.setAttribute('src', originalsrc);
							}

							if(originalsrcset){
								e.setAttribute('srcset', originalsrcset);
							}

							self.loaded_index.push(index);
						}
					}
				}

			}catch(error){
				console.log(error);
				console.log("==>", e);
			}
		});
	}
};
Wpfc_Lazyload.init();