forked from zswang/csst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
csst.min.js
1 lines (1 loc) · 1.17 KB
/
csst.min.js
1
!function(e){function t(e,t,n){function i(){p&&p.parentNode&&(p.parentNode.removeChild(p),p=null),f&&f.parentNode&&(f.parentNode.removeChild(f),f=null),r&&(clearTimeout(r),r=null),n=null}function d(){if(n){var e=getComputedStyle(f,!1),t=e.content,o=t.match(/[\w+=\/]+/);if(o)try{t=decodeURIComponent(escape(atob(o[0])))}catch(d){return void n(d)}n(null,t)}i()}"function"==typeof t&&(n=t,t={}),t=t||{};var r,l=t.prefix||"__csst",u=t.name||l+o++,a=t.param||"id",c="undefined"!=typeof t.timeout?c:null;c&&(r=setTimeout(function(){i(),n&&n(new Error("Timeout"))},c));var m=document.querySelector("head"),p=document.createElement("link"),f=document.createElement("span");return f.style.visibility="hidden",f.style.position="absolute",f.style.top="-100px",f.id=u,document.documentElement.appendChild(f),f.addEventListener("animationstart",d,!1),f.addEventListener("webkitAnimationStart",d,!1),e+=(e.indexOf("?")>=0?"&":"?")+a+"="+encodeURIComponent(u),e=e.replace("?&","?"),p.href=e,p.rel="stylesheet",p.type="text/css",m.appendChild(p),i}var n=n||{},o=0,n=t;"function"==typeof define?define.amd&&define(function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:window[e]=n}("csst");