core/skin/p009.yurecnt.ru/js/tilda-fonts.min.js

1 line
2.3 KiB
JavaScript
Executable File

!function(){var e=0,t=0;function n(){++e>9||("undefined"!=typeof TildaFonts?a():setTimeout(n,20))}function i(){clearTimeout(t),o(),window.tildafonts_loaded=!0}function o(){var e=document.getElementById("tildafonts-loading");void 0!==e&&null!=e&&e.parentNode.removeChild(e)}function a(){window.tildafonts_loaded=!1;var e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.innerHTML="body *{color:transparent!important;}",n.setAttribute("id","tildafonts-loading"),e.insertBefore(n,e.firstChild),t=setTimeout((function(){o()}),"y"===window.tildafontsswap?50:3e3);var i=(navigator.userAgent||navigator.vendor||window.opera).toLowerCase(),a={opera:"version",firefox:"firefox",safari:"version",msie:"msie"},s=["linux","windows","iphone","mac os"],d="default",f=0,l=-1,c="default",u="woff",w="y"===window.tildafontsswap?"&display=swap":"",m=/^Mozilla\/5\.0 \(.+[^)]+\) AppleWebKit\/[\d.]+ \(KHTML, like Gecko\) C[hrome|riOS]+\/(\d+)[\d.]+[ Mobile]*[/15E148]*[\sYaBrowser/[\d.]+]?[\sYowser/[\d.]+]? Safari\/[\d.]+[\sEdg/[\d.]+]?[\sOPR/[\d.]+]?$/.exec(navigator.userAgent),p;if(m){var g;parseInt(m[1],10)>=36&&(u="woff2")}else{for(var h in a)if(i.indexOf(h)>-1){l=i.indexOf(a[h]),d=h,f=i.substring(l+a[h].length+1,l+a[h].length+3);break}for(var v=0;v<s.length;v++)if(i.indexOf(s[v])>-1){c=s[v];break}switch("default"===d&&i.indexOf("instagram")>-1&&i.indexOf("iphone")>-1&&(l=i.indexOf("iphone os"),d="safari",c="iphone",f=i.substring(l+10,l+12)),d){case"firefox":f>=39&&(u="woff2");break;case"safari":"iphone"===c?f>=10&&(u="woff2"):f>=12&&(u="woff2");break;case"opera":f>=23&&(u="woff2")}}r("https://fonts.tildacdn.com/get/","?fonts="+TildaFonts+"&format="+u+w,!0,e)}function r(e,t,n,o){var a=document.createElement("link");if(a.addEventListener("load",(function(){i()})),n){a.addEventListener("error",(function(){r("https://fonts2.tildacdn.com/get/",t,!1,o)}));var s=window.performance.timing;if(!s)return;var d=s.responseEnd-s.connectStart,f=2e3;switch(!0){case d<=300:f=2e3;break;case d<=1e3:f=7e3;break;case d<=2e3:f=2e4;break;case d<=3e3:f=3e4;break;case d>3e3:f=45e3}setTimeout((function(){!1===window.tildafonts_loaded&&r("https://fonts2.tildacdn.com/get/",t,!1,o)}),f)}a.setAttribute("href",e+t),a.setAttribute("rel","stylesheet"),a.setAttribute("type","text/css"),a.setAttribute("media","all"),o.insertBefore(a,o.firstChild)}n()}();