-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprogressive.min.js
More file actions
3 lines (3 loc) · 1.5 KB
/
progressive.min.js
File metadata and controls
3 lines (3 loc) · 1.5 KB
1
2
3
var Progressive=function(){var d=document.createElement("style"),h=!1,i="",b=["Webkit","Moz","O","ms","Khtml"],k=b.length,g;document.getElementsByClassName=document.getElementsByClassName||function(c){var a=[],e,d=RegExp("(^|\\s)"+c+"(\\s|$)"),f,j,c=document.getElementsByTagName("*");e=c.length;for(j=f=0;f<e;f++)d.test(c[f].className)&&(a[j]=c[f],j++);return a};if(d.style.animationName)h=!0;else for(g=0;g<k;g++)if(void 0!==d.style[b[g]+"AnimationName"]){b=b[g];i="-"+b.toLowerCase()+"-";h=!0;break}return{enhance:function(c){var a;
a={};var e,b,f=function(){var a,b,d,e;for(a in c)if(c.hasOwnProperty(a)&&(b=document.getElementsByClassName(c[a].className),d=b.length,!c[a].count||c[a].count<d))for(e=0;e<d;e++)c[a].callback.call(b[e])};a="";b=function(a){var b=c[a.animationName];b&&(b.count=++b.count||1,b.callback.call(a.target))};if(h){for(e in c)c.hasOwnProperty(e)&&(a+="."+c[e].className+"{",a+=i+"animation:"+e+" 0.001s;",a+="}",a+="@"+i+"keyframes "+e+"{from{clip:rect(1px,auto,auto,auto);}to{clip:rect(0px,auto,auto,auto);}}");
a=document.createTextNode(a);d.type="text/css";d.styleSheet?d.styleSheet.cssText=a.nodeValue:d.appendChild(a);document.getElementsByTagName("script")[0].parentNode.appendChild(d);document.addEventListener("animationstart",b,!1);document.addEventListener("oanimationstart",b,!1);document.addEventListener("MSAnimationStart",b,!1);document.addEventListener("webkitAnimationStart",b,!1)}window.addEventListener?window.addEventListener("load",f):window.attachEvent&&window.attachEvent("onload",f)}}}();