101if (document.head.querySelector('link[href^="' + newsrc + '"]') !== null) return;102}103104//105// перезагружаем ресурс106if (tag == 'LINK') {107var link = window.document.createElement('link');108link.rel = 'stylesheet';109link.type = 'text/css';110link.href = newsrc;111link.media = 'all';112link.onload = function () {
el.remove(); }; document.head.appendChild(link); } else if (tag == 'SCRIPT') { var isModule = el.getAttribute('type') === 'module'; var script = window.document.createElement('script'); //script.defer = true; script.async = true; script.src = newsrc; if (isModule) script.type = 'module'; script.onload = function () { el.remove(); }; document.head.appendChild(script); } else if (tag == 'IMG') { el.src = newsrc; } // - Save error detail to statistic array if (typeof window.t_cdnerrors !== 'object') window.t_cdnerrors = []; window.t_cdnerrors.push({ url: src }); console.log('(fallback) Try to reload: ' + newsrc);}/*function t_falladv__isResourceLoaded(src){ if (typeof window.performance != 'object') return false; var flag=false; var resources = window.performance.getEntriesByType("resource"); resources.forEach(function (resource) { if( resource.name == src ){ if(parseInt(resource.responseEnd)>0 && parseInt(resource.responseEnd)<10000){ flag=true; return false; //выходим из foreach } } }); return flag;}*/