2 lines
39 KiB
JavaScript
2 lines
39 KiB
JavaScript
|
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.tippy=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var o=e.ownerDocument.defaultView,r=o.getComputedStyle(e,null);return t?r[t]:r}function o(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function r(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var i=t(e),n=i.overflow,p=i.overflowX,s=i.overflowY;return /(auto|scroll|overlay)/.test(n+s+p)?e:r(o(e))}function n(e){return 11===e?we:10===e?Ee:we||Ee}function p(e){if(!e)return document.documentElement;for(var o=n(10)?document.body:null,r=e.offsetParent||null;r===o&&e.nextElementSibling;)r=(e=e.nextElementSibling).offsetParent;var i=r&&r.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TH','TD','TABLE'].indexOf(r.nodeName)&&'static'===t(r,'position')?p(r):r:e?e.ownerDocument.documentElement:document.documentElement}function s(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||p(e.firstElementChild)===e)}function a(e){return null===e.parentNode?e:a(e.parentNode)}function d(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var o=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=o?e:t,i=o?t:e,n=document.createRange();n.setStart(r,0),n.setEnd(i,0);var l=n.commonAncestorContainer;if(e!==l&&t!==l||r.contains(i))return s(l)?l:p(l);var c=a(e);return c.host?d(c.host,t):d(e,a(t).host)}function l(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',o='top'===t?'scrollTop':'scrollLeft',r=e.nodeName;if('BODY'===r||'HTML'===r){var i=e.ownerDocument.documentElement,n=e.ownerDocument.scrollingElement||i;return n[o]}return e[o]}function c(e,t){var o=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],r=l(t,'top'),i=l(t,'left'),n=o?-1:1;return e.top+=r*n,e.bottom+=r*n,e.left+=i*n,e.right+=i*n,e}function f(e,t){var o='x'===t?'Left':'Top',r='Left'===o?'Right':'Bottom';return parseFloat(e['border'+o+'Width'],10)+parseFloat(e['border'+r+'Width'],10)}function m(e,t,o,r){return re(t['offset'+e],t['scroll'+e],o['client'+e],o['offset'+e],o['scroll'+e],n(10)?parseInt(o['offset'+e])+parseInt(r['margin'+('Height'===e?'Top':'Left')])+parseInt(r['margin'+('Height'===e?'Bottom':'Right')]):0)}function h(e){var t=e.body,o=e.documentElement,r=n(10)&&getComputedStyle(o);return{height:m('Height',t,o,r),width:m('Width',t,o,r)}}function u(e){return Ce({},e,{right:e.left+e.width,bottom:e.top+e.height})}function b(e){var o={};try{if(n(10)){o=e.getBoundingClientRect();var r=l(e,'top'),i=l(e,'left');o.top+=r,o.left+=i,o.bottom+=r,o.right+=i}else o=e.getBoundingClientRect()}catch(t){}var p={left:o.left,top:o.top,width:o.right-o.left,height:o.bottom-o.top},s='HTML'===e.nodeName?h(e.ownerDocument):{},a=s.width||e.clientWidth||p.right-p.left,d=s.height||e.clientHeight||p.bottom-p.top,c=e.offsetWidth-a,m=e.offsetHeight-d;if(c||m){var b=t(e);c-=f(b,'x'),m-=f(b,'y'),p.width-=c,p.height-=m}return u(p)}function g(e,o){var i=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],p=n(10),s='HTML'===o.nodeName,a=b(e),d=b(o),l=r(e),f=t(o),m=parseFloat(f.borderTopWidth,10),h=parseFloat(f.borderLeftWidth,10);i&&s&&(d.top=re(d.top,0),d.left=re(d.left,0));var g=u({top:a.top-d.top-m,left:a.left-d.left-h,width:a.width,height:a.height});if(g.marginTop=0,g.marginLeft=0,!p&&s){var y=parseFloat(f.marginTop,10),v=parseFloat(f.marginLeft,10);g.top-=m-y,g.bottom-=m-y,g.left-=h-v,g.right-=h-v,g.marginTop=y,g.marginLeft=v}return(p&&!i?o.contains(l):o===l&&'BODY'!==l.nodeName)&&(g=c(g,o)),g}function y(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],o=e.ownerDocument.documentElement,r=g(e,o),i=re(o.clientWidth,window.innerWidth||0),n=re(o.clientHeight,window.innerHeight||0),p=t?0:l(o),s=t?0:l(o,'left'),a={top:p-r.top+r.marginTop,left:s-r.left+r.marginLeft,width:i,height:n};return u(a)}function v(e){var r=e.nodeName;return'BODY'!==r&&'HTML'!==r
|