This repository has been archived by the owner on Jun 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
mediatizr.W.min.js
4 lines (4 loc) · 2.92 KB
/
mediatizr.W.min.js
1
2
3
4
/*! W 1.2.2 (https://github.com/pyrsmk/W) */
!function(a,b,c){"undefined"!=typeof module&&module.exports?module.exports=c:"function"==typeof define&&define.amd?define(c):a[b]=c}(this,"W",function(){function a(){var a,b,c,d,e=[{width:screen.availWidth,height:screen.availHeight},{width:window.outerWidth,height:window.outerHeight},{width:window.innerWidth,height:window.innerHeight}];if(/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&"landscape"==m()?(a=screen.height,b=screen.width):(a=screen.width,b=screen.height),k)return{width:a,height:b};for(c=0,d=e.length;d>c;++c)e[c].note=e[c].width>a||e[c].height>b||!e[c].width||!e[c].height?0:e[c].width<a||e[c].height<b?2+(a-e[c].width)+(b-e[c].height):1;return e.sort(function(a,b){return b.note-a.note}),{width:e[0].width,height:e[0].height}}var b,c,d,e,f=window,g=document,h=g.documentElement,i=[],j=!1,k=!1,l=function(){b=g.createElement("div"),b.style.width="1em",h.appendChild(b),e=b.offsetWidth,e=e?e:16,h.removeChild(b)},m=function(){return"orientation"in window?window.orientation?"landscape":"portrait":h.clientWidth>h.clientHeight?"landscape":"portrait"};return l(),f.addEventListener?"onorientationchange"in f?f.addEventListener("orientationchange",function(){j=!0},!1):f.addEventListener("resize",function(){j=!0},!1):f.attachEvent("onresize",function(){j=!0}),c=g.createElement("b"),c.style.position="absolute",c.style.top="-99em",c.innerHTML="W",h.appendChild(c),d=c.offsetHeight,setInterval(function(){if(b=c.offsetHeight,b!=d&&(j=!0),d=b,j&&h.clientWidth){l();for(var a=0,e=i.length;e>a;++a)i[a]();j=!1}},250),{px2em:function(a){return a/e},getViewportWidth:function(){return a().width},getViewportHeight:function(){return a().height},addListener:function(a){return i.push(a),a},setAbsoluteMode:function(a){k=!!a},getOrientation:function(){return m()}}}());
/*! mediatizr 0.4.3 (https://github.com/pyrsmk/mediatizr) */
!function(){var a,b=window,c=document,d=c.documentElement,e=b.Sheethub,f="mediatizr",g="get",h="node",i=function(){var a,b,c,d,i,j,k,l,m,n=e[g](),o={},p="indexOf",q=function(){var a,b,c,d,f,i;for(a in o)for(d=o[a].split("and"),b=-1;d[++b];)c=d[b].match(/\(\s*(.+?)\s*:\s*(.+?)(px|em)\s*\)/),f=W.px2em(W.getViewportWidth("em"==c[3])),i=c[2],e[g](a)[h]().disabled=c[1][p]("min")?f>i:i>f},r=function(a){for(var b,c,d=0,e=0;-1!=b||-1!=c;)if(b=a[p]("{",d),c=a[p]("}",d),c>b&&-1!=b?(++e,d=b+1):(--e,d=c+1),!e)return c;return-1};m=0;for(a in n)if(!a.match("^"+f))for(d=n[a][g](),l=0;-1!=(i=d[p]("@media",l));)j=r(d.substr(i)),(k=d.substr(i+6,j-4).match(/([\S\s]+?)and([\S\s]+?)\{([\S\s]+)/i))&&(e.add(b=f+ ++m+a,k[3]),c=e[g](b)[h](),c.media=k[1],o[b]=(k[2]+"").toLowerCase(),c.disabled=!0),l=i+j;W.addListener(q),q()};(b.supportMediaQueries=function(){return b.matchMedia?!0:(a=c.createElement("p"),a.id=f,a.style.position="absolute",a.style.top="-99em",d.appendChild(a),e.add(f,"#"+f+"{width:9px}"),e[g](f)[h]().media="only all",9==a.offsetWidth&&!e.remove(f)&&!!d.removeChild(a))}())||(e.ready()?i():e.listen(i))}();