forked from ryanve/verge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verge.min.js
6 lines (6 loc) · 1.55 KB
/
verge.min.js
1
2
3
4
5
6
/*!
* verge 1.8.3+201312102220
* https://github.com/ryanve/verge
* MIT License 2013 Ryan Van Etten
*/
!function(a,b,c){"undefined"!=typeof module&&module.exports?module.exports=c():a[b]=c()}(this,"verge",function(){function a(){return{width:l(),height:m()}}function b(a,b){var c={};return b=+b||0,c.width=(c.right=a.right+b)-(c.left=a.left-b),c.height=(c.bottom=a.bottom+b)-(c.top=a.top-b),c}function c(a,c){return a=a&&!a.nodeType?a[0]:a,a&&1===a.nodeType?b(a.getBoundingClientRect(),c):!1}function d(b){b=null==b?a():1===b.nodeType?c(b):b;var d=b.height,e=b.width;return d="function"==typeof d?d.call(b):d,e="function"==typeof e?e.call(b):e,e/d}var e={},f="undefined"!=typeof window&&window,g="undefined"!=typeof document&&document,h=g&&g.documentElement,i=f.Modernizr,j=f.matchMedia||f.msMatchMedia,k=j?function(a){return!!j.call(f,a).matches}:function(){return!1},l=h.clientWidth<f.innerWidth?function(){return f.innerWidth}:function(){return h.clientWidth},m=h.clientHeight<f.innerHeight?function(){return f.innerHeight}:function(){return h.clientHeight};return e.mq=!j&&i&&i.mq||k,e.matchMedia=j?function(){return j.apply(f,arguments)}:function(){return{}},e.viewportW=l,e.viewportH=m,e.viewport=a,e.scrollX=function(){return f.pageXOffset||h.scrollLeft},e.scrollY=function(){return f.pageYOffset||h.scrollTop},e.rectangle=c,e.aspect=d,e.inX=function(a,b){var d=c(a,b);return!!d&&d.right>=0&&d.left<=l()},e.inY=function(a,b){var d=c(a,b);return!!d&&d.bottom>=0&&d.top<=m()},e.inViewport=function(a,b){var d=c(a,b);return!!d&&d.bottom>=0&&d.right>=0&&d.top<=m()&&d.left<=l()},e});