dimensions.min.js 2.5 KB

12345678910
  1. /**
  2. * angular-strap
  3. * @version v2.3.9 - 2016-06-10
  4. * @link http://mgcrea.github.io/angular-strap
  5. * @author Olivier Louvignes <olivier@mg-crea.com> (https://github.com/mgcrea)
  6. * @license MIT License, http://www.opensource.org/licenses/MIT
  7. */
  8. 'use strict';angular.module('mgcrea.ngStrap.helpers.dimensions',[]).factory('dimensions',function(){function t(t){var n=t.ownerDocument,s=t.offsetParent||n;if(o(s,'#document'))return n.documentElement;for(;s&&!o(s,'html')&&'static'===e.css(s,'position');)s=s.offsetParent;return s||n.documentElement}var e={},o=e.nodeName=function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()};return e.css=function(t,e,o){var n;return n=t.currentStyle?t.currentStyle[e]:window.getComputedStyle?window.getComputedStyle(t)[e]:t.style[e],o===!0?parseFloat(n)||0:n},e.offset=function(t){var e=t.getBoundingClientRect(),o=t.ownerDocument;return{width:e.width||t.offsetWidth,height:e.height||t.offsetHeight,top:e.top+(window.pageYOffset||o.documentElement.scrollTop)-(o.documentElement.clientTop||0),left:e.left+(window.pageXOffset||o.documentElement.scrollLeft)-(o.documentElement.clientLeft||0)}},e.setOffset=function(t,o,n){var s,i,r,f,c,l,d,a=e.css(t,'position'),u=angular.element(t),p={};'static'===a&&(t.style.position='relative'),c=e.offset(t),r=e.css(t,'top'),l=e.css(t,'left'),d=('absolute'===a||'fixed'===a)&&(r+l).indexOf('auto')>-1,d?(s=e.position(t),f=s.top,i=s.left):(f=parseFloat(r)||0,i=parseFloat(l)||0),angular.isFunction(o)&&(o=o.call(t,n,c)),null!==o.top&&(p.top=o.top-c.top+f),null!==o.left&&(p.left=o.left-c.left+i),'using'in o?o.using.call(u,p):u.css({top:p.top+'px',left:p.left+'px'})},e.position=function(n){var s,i,r={top:0,left:0};return'fixed'===e.css(n,'position')?i=n.getBoundingClientRect():(s=t(n),i=e.offset(n),o(s,'html')||(r=e.offset(s)),r.top+=e.css(s,'borderTopWidth',!0),r.left+=e.css(s,'borderLeftWidth',!0)),{width:n.offsetWidth,height:n.offsetHeight,top:i.top-r.top-e.css(n,'marginTop',!0),left:i.left-r.left-e.css(n,'marginLeft',!0)}},e.height=function(t,o){var n=t.offsetHeight;return o?n+=e.css(t,'marginTop',!0)+e.css(t,'marginBottom',!0):n-=e.css(t,'paddingTop',!0)+e.css(t,'paddingBottom',!0)+e.css(t,'borderTopWidth',!0)+e.css(t,'borderBottomWidth',!0),n},e.width=function(t,o){var n=t.offsetWidth;return o?n+=e.css(t,'marginLeft',!0)+e.css(t,'marginRight',!0):n-=e.css(t,'paddingLeft',!0)+e.css(t,'paddingRight',!0)+e.css(t,'borderLeftWidth',!0)+e.css(t,'borderRightWidth',!0),n},e});
  9. //# sourceMappingURL=dimensions.min.js.map