forked from pyrsmk/mediatizr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmediatizr-0.2.0.W.min.js
1 lines (1 loc) · 1.68 KB
/
mediatizr-0.2.0.W.min.js
1
this.W=function(){var a=window,b=document,c=b.documentElement,d,e,f="style",g="createElement",h="appendChild",i="offsetHeight",j="offsetWidth",k=[];return function(l){var m=typeof l,n,o,p;if(m=="function"){(o=a.addEventListener)?o("resize",l,!1):a.attachEvent("onresize",l),k.length||(d=b[g]("span"),d[f].position="absolute",d[f].top="-99em",d.innerHTML="W",c[h](d),e=d[i],setInterval(function(a,b){if(e!=(b=d[i])){a=k.length;while(a)k[--a]()}e=b},250)),k.push(l);return}return o=b[g]("div"),o[f].width="1em",c[h](o),n=o[j],n=n?n:16,c.removeChild(o),m=="number"?l/n:(o=c[j],(p=a.innerWidth)||(p=c.clientWidth),o=(p-o)*100/p<5?p:o,l?o/n:o)}}();(function(){var e=window,t=document,n=t.documentElement,r=e.Sheethub,i="mediatizr",s="get",o="node",u,a=function(){var e=r[s](),t,n={},u,a,f,l,c,h,p,d="indexOf",v,m=function(){var e,t,i,u,a,f;for(e in n){u=n[e].split("and"),t=-1;while(u[++t])i=u[t].match(/\(\s*(.+?)\s*:\s*(.+?)(px|em)\s*\)/),a=W(i[3]=="em"),f=i[2],r[s](e)[o]().disabled=i[1][d]("min")?a>f:a<f}},g=function(e){var t,n,r=0,i=0;while(t!=-1||n!=-1){t=e[d]("{",r),n=e[d]("}",r),n>t&&t!=-1?(++i,r=t+1):(--i,r=n+1);if(!i)return n}return-1};v=0;for(t in e)if(!t.match("^"+i)){f=e[t][s](),p=0;while((l=f[d]("@media",p))!=-1){c=g(f.substr(l));if(h=f.substr(l+6,c-4).match(/([\S\s]+?)and([\S\s]+?)\{([\S\s]+)/i))r.add(u=i+ ++v+t,h[3]),a=r[s](u)[o](),a.media=h[1],n[u]=(h[2]+"").toLowerCase(),a.disabled=!0;p=l+c}}W(m),m()};(e.supportMediaQueries=function(){return e.matchMedia?!0:(u=t.createElement("p"),u.id=i,u.style.position="absolute",u.style.top="-99em",n.appendChild(u),r.add(i,"#"+i+"{width:9px}"),r[s](i)[o]().media="only all",u.offsetWidth==9&&!r.remove(i)&&!!n.removeChild(u))}())||(r.ready()?a():r.listen(a))})();