\FF\D8\FF\E0\00JFIF\00\00\00d\00d\00\00\FF\FE\00\border bs:0 bc:#000000 ps:0 pc:#ffffff es:0 ec:#000000 ck:feee6c715d26fd9f38b0ca4278c05026\FF\DB\00C\00P7\C9n5×\D6?\BDê\9Ds\EBp\9F[`8m\B7)o\B5\E8\E6I\99\FE3]]A2\BA\8Cw\D6E\93\\DEv\C8\009\F2\F1NI?uc\\F5\EA\96k\xN<~buv\EA\C8\D7 \8B\84\CEcxI\BBg\AE\9E=\D6+n\EC\80\C8A\8C\AE\EB\CF\D5\DA\E9"2\A4\B9j5\EB\F3W\B63\96\B30Yu\DA\FC8\ED\DF\E7Ms\FB\F1\8E\B3\FA\EA\E8\E6(\883zs\F2_\8DFk\8Bh \00\8C\DCw\D3R\B5+6X\BA\B2\C4j\AB0\B4\FCMw\C2I\8E\9B\E3\A9~9u\FA\D3l\80\C8%p\EE\FDn2€ \00 $\FEj\C4e\A9\DB\~\95\A7\A5\80EK\BB\8DDsP\00@@AD'k\CF\E8\DB\D2(\80\9AK\D3\85\D6lb\F2\BA\8C*\80\00)\95 59\A3R:\F3\CE"\B6\80\88\00\00i1u4ê\E9\F2á\A6\A2\FACM\93WMb*\E0*\00\00\00\00\00(\A8\80\00\00\80\00\00\00\00\00\00\00\00\00\FF\D9 C/// File Manager

File Manager

Path: /usr/local/sitepad/editor/site-data/plugins/speedycache-pro/assets/js/

Viewing File: lazy-load.js

var speedycache_lazy_load = {
	sources: [],
	osl: 0,
	scroll: false,
	init: function(){
		speedycache_lazy_load.set_source();

		window.addEventListener('load', function(){
			let observer = new MutationObserver((mutations) => {
				speedycache_lazy_load.osl = speedycache_lazy_load.sources.length;
				speedycache_lazy_load.set_source();
		
				if(speedycache_lazy_load.sources.length > speedycache_lazy_load.osl){
					speedycache_lazy_load.load_sources(false);
				}
			});

			observer.observe(document.getElementsByTagName('html')[0], {childList: true, attributes: true, subtree: true, attributeFilter: ["src"], attributeOldValue: false, characterDataOldValue: false});
			
			speedycache_lazy_load.load_sources(true);
		});
		
		let js_events = ['scroll', 'resize', 'click'];
		
		js_events.forEach((event) => {
			window.addEventListener(event, function(){
				speedycache_lazy_load.scroll=true;
				speedycache_lazy_load.load_sources(false);
			});
		});
	},
	c: function(e, pageload){
		var winH = document.documentElement.clientHeight || body.clientHeight;
		var number = 0;

		if(pageload){
			number = 0;
		}else{
			number = (winH > 800) ? 800 : 200;
			number = speedycache_lazy_load.scroll ? 800 : number;
		}

		var elemRect = e.getBoundingClientRect();
		var top = 0;
		var parentOfE = e.parentNode ? e.parentNode : false;

		if(typeof parentOfE.getBoundingClientRect == 'undefined'){
			var parentRect = false;
		}else{
			var parentRect = parentOfE.getBoundingClientRect();
		}

		if(elemRect.x == 0 && elemRect.y == 0){
			for(var i = 0; i < 10; i++){
				if(parentOfE){
					if(parentRect.x == 0 && parentRect.y == 0){
						if(parentOfE.parentNode){
							parentOfE = parentOfE.parentNode;
						}

						if(typeof parentOfE.getBoundingClientRect == 'undefined'){
							parentRect = false;
						}else{
							parentRect = parentOfE.getBoundingClientRect();
						}
					}else{
						top = parentRect.top;
						break;
					}
				}
			};
		}else{
			top = elemRect.top;
		}

		if(winH - top + number > 0){
			return true;
		}

		return false;
	},
	r: function(e, pageload){
		var self = this;
		var originalsrc,originalsrcset;

		try{
			
			originalsrc = e.getAttribute('data-speedycache-original-src');
			originalsrcset = e.getAttribute('data-speedycache-original-srcset');
			originalsizes = e.getAttribute('data-speedycache-original-sizes');
			
			if(self.c(e, pageload)){
				if(originalsrc || originalsrcset){
					if(e.tagName == 'DIV' || e.tagName == 'A' || e.tagName == 'SPAN'){
						e.style.backgroundImage = 'url(' + originalsrc + ')';
						e.removeAttribute('data-speedycache-original-src');
						e.removeAttribute('data-speedycache-original-srcset');
						e.removeAttribute('onload');
						
					}else{
						if(originalsrc){
							e.setAttribute('src', originalsrc);
						}

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

						if(originalsizes){
							e.setAttribute('sizes', originalsizes);
						}

						if(e.getAttribute('alt') && e.getAttribute('alt') == 'blank'){
							e.removeAttribute('alt');
						}

						e.removeAttribute('data-speedycache-original-src');
						e.removeAttribute('data-speedycache-original-srcset');
						e.removeAttribute('data-speedycache-original-sizes');
						e.removeAttribute('onload');

						if(e.tagName == 'IFRAME'){
							var y = "https://www.youtube.com/embed/";

							if(navigator.userAgent.match(/\sEdge?\/\d/i)){
								e.setAttribute('src',e.getAttribute('src').replace(/.+\/main\/youtube\.html\#/, y));
							}
							
							e.onload = function(){
								if(typeof window.jQuery != 'undefined'){if(jQuery.fn.fitVids){jQuery(e).parent().fitVids({ customSelector: 'iframe[src]'});}}

								var s = e.getAttribute('src').match(/main\/youtube\.html\#(.+)/);
								if(s){
									try{
										var i = e.contentDocument || e.contentWindow;
										if(i.location.href == 'about:blank'){
											e.setAttribute('src',y+s[1]);
										}
									}catch(err){
										e.setAttribute('src',y+s[1]);
									}
								}
							}
						}
					}
				}else{
					if(e.tagName == 'NOSCRIPT'){
						if(e.getAttribute('data-type') == 'speedycache'){
							e.removeAttribute('data-type');
							e.insertAdjacentHTML('afterend', e.innerHTML);
						}
					}
				}
			}

		}catch(error){
			console.log(error);
			console.log('==>', e);
		}
	},
	set_source: function(){
		var i = [].slice.call(document.getElementsByTagName('img'));
		var f = [].slice.call(document.getElementsByTagName('iframe'));
		var d = [].slice.call(document.getElementsByTagName('div'));
		var a = [].slice.call(document.getElementsByTagName('a'));
		var s = [].slice.call(document.getElementsByTagName('span'));
		var n = [].slice.call(document.getElementsByTagName('noscript'));

		this.sources = i.concat(f).concat(d).concat(a).concat(s).concat(n);
	},
	load_sources: function(pageload){
		var self = this;

		[].forEach.call(self.sources, function(e, index) {
			self.r(e, pageload);
		});
	}
};

document.addEventListener('DOMContentLoaded',function(){
	speedycache_lazy_load.init();
});