document.addEventListener('DOMContentLoaded', function (){
window.addEventListener('load', function (){
setTimeout(function (){
var lazyScripts=[].slice.call(document.querySelectorAll('script'));
if(lazyScripts.length > 0){
lazyScripts.forEach(function (lazyScript){
if(lazyScript.dataset.src){
lazyScript.src=lazyScript.dataset.src;
}});
}}, 4000);
});
var lazyVideos=[].slice.call(document.querySelectorAll('video.lazy-video'));
if('IntersectionObserver' in window){
var lazyVideoObserver=new IntersectionObserver(function (entries, observer){
entries.forEach(function (video){
if(video.isIntersecting){
for (var source in video.target.children){
var videoSource=video.target.children[source];
if(typeof videoSource.tagName==='string'&&videoSource.tagName==='SOURCE'){
videoSource.src=videoSource.dataset.src;
}}
video.target.load();
video.target.classList.remove('lazy');
lazyVideoObserver.unobserve(video.target);
}});
});
lazyVideos.forEach(function (lazyVideo){
lazyVideoObserver.observe(lazyVideo);
});
}
if('IntersectionObserver' in window){
var lazyMCObserver=new IntersectionObserver(function (entries, observer){
entries.forEach(function (form){
if(form.isIntersecting){
var script=document.querySelector('script#mc-validate');
if(script){
script.src=script.dataset.src;
}}
});
});
var mcForm=document.querySelector('#mc_embed_signup');
if(mcForm){
lazyMCObserver.observe(mcForm);
}}
});