css,js,ws
This commit is contained in:
1
www/static/file/home/js/home-fallback-advanced-1.0.min.js
vendored
Normal file
1
www/static/file/home/js/home-fallback-advanced-1.0.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function t_falladv__handleDomTimeOut(){if("loading"==document.readyState&&"object"==typeof window.performance&&null!==document.head.querySelector('script[src^="https://static.tildacdn."]')){var e=window.performance.getEntriesByType("resource"),t="";if(e.forEach((function(e){e.name.indexOf("https://static.tildacdn.")>-1&&e.startTime>0&&(t="ok")})),"ok"!=t){console.log("Force switching origin");var r=document.querySelectorAll("script,link,img");Array.prototype.forEach.call(r,(function(e){t_falladv__reloadSRC(e)})),window.lazy_err_static="y"}}}function t_falladv__reloadSRC(e){var t=e.tagName,r="",n="";if(!("LINK"!=t&&"SCRIPT"!=t&&"IMG"!=t||("LINK"==t&&(r=e.getAttribute("href")),"SCRIPT"!=t&&"IMG"!=t||(r=e.getAttribute("src")),"string"!=typeof r||"IMG"==t&&-1!==r.indexOf("/-/empty/")))){var o=/\/static\.tildacdn\.(info|.{1,3})\//;if(o.test(r))n=r.replace(o,"/static3.tildacdn.com/");else if(0===r.indexOf("https://ws.tildacdn.com/")){var c=r.split("/");n="/"+c[c.length-1]}if(n.indexOf("/css/fonts-tildasans")>0&&(n=n.replace(".css",".s3.css")),""!=n){if("SCRIPT"==t){if(null!==document.head.querySelector('script[src^="'+n+'"]'))return}else if("LINK"==t&&null!==document.head.querySelector('link[href^="'+n+'"]'))return;if("LINK"==t){var i=window.document.createElement("link");i.rel="stylesheet",i.type="text/css",i.href=n,i.media="all",i.onload=function(){e.remove()},document.head.appendChild(i)}else if("SCRIPT"==t){var a=window.document.createElement("script");a.async=!0,a.src=n,a.onload=function(){e.remove()},document.head.appendChild(a)}else"IMG"==t&&(e.src=n);"object"!=typeof window.t_cdnerrors&&(window.t_cdnerrors=[]),window.t_cdnerrors.push({url:r}),console.log("(fallback) Try to reload: "+n)}}}
|
||||
Reference in New Issue
Block a user