| Server IP : 68.178.247.200 / Your IP : 216.73.217.50 Web Server : Apache System : Linux p3plzcpnl489463.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 User : x9dppmxs4rgd ( 8559391) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/x9dppmxs4rgd/www/wp-content/plugins/wp-fastest-cache-premium/pro/js/ |
Upload File : |
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("wpfc-data-original-src");
originalsrcset = e.getAttribute("wpfc-data-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();