1234567 |
- /*!
- * Angular Material Design
- * https://github.com/angular/material
- * @license MIT
- * v0.11.3-master-3fe7d76
- */
- !function(t,e,o){"use strict";function n(t,o,n,i,l,r,a,u,c){function d(d,s,p){function m(){e.isDefined(p.mdDelay)||(d.delay=f)}function v(){d.$on("$destroy",function(){d.visible=!1,s.remove(),e.element(o).off("resize",P)}),d.$watch("visible",function(t){t?E():q()})}function g(){D.attr("aria-label")||D.text().trim()||D.attr("aria-label",s.text().trim())}function w(){s.detach(),s.attr("role","tooltip")}function b(){for(var t=s.parent();$("pointer-events","none",t);)t=t.parent();return t}function y(){for(var t=s.parent()[0];t&&t!==a[0]&&t!==document.body;)t=t.parentNode;return t}function $(t,n,i){var l=!1;if(i&&i.length){t=p.$normalize(t),i=i[0]||s[0];var r=o.getComputedStyle(i);l=e.isDefined(r[t])&&r[t]==n}return l}function M(){var t=!1,n=e.element(o),l=function(){r=document.activeElement===D[0]},r=!1;n.on("blur",l),d.$on("$destroy",function(){n.off("blur",l)});var a=function(t){return"focus"===t.type&&r?void(r=!1):(D.on("blur mouseleave touchend touchcancel",u),void x(!0))},u=function(){var e=d.hasOwnProperty("autohide")?d.autohide:p.hasOwnProperty("mdAutohide");(e||t||i[0].activeElement!==D[0])&&(D.off("blur mouseleave touchend touchcancel",u),D.triggerHandler("blur"),x(!1)),t=!1};D.on("mousedown",function(){t=!0}),D.on("focus mouseenter touchstart",a),e.element(o).on("resize",P)}function x(e){x.value=!!e,x.queued||(e?(x.queued=!0,t(function(){d.visible=x.value,x.queued=!1},d.delay)):l.nextTick(function(){d.visible=!1}))}function E(){return N.append(s),$("display","none")?(d.visible=!1,void s.detach()):(C(),void e.forEach([s,k,z],function(t){u.addClass(t,"md-show")}))}function q(){var t=[];e.forEach([s,k,z],function(e){e.parent()&&e.hasClass("md-show")&&t.push(u.removeClass(e,"md-show"))}),c.all(t).then(function(){d.visible||s.detach()})}function C(){function t(){var t="left"===A||"right"===A?2*Math.sqrt(Math.pow(n.width,2)+Math.pow(n.height/2,2)):2*Math.sqrt(Math.pow(n.width/2,2)+Math.pow(n.height,2)),e="left"===A?{left:100,top:50}:"right"===A?{left:0,top:50}:"top"===A?{left:50,top:100}:{left:50,top:0};k.css({width:t+"px",height:t+"px",left:e.left+"%",top:e.top+"%"})}function e(t){var e={left:t.left,top:t.top};return e.left=Math.min(e.left,N.prop("scrollWidth")-n.width-h),e.left=Math.max(e.left,h),e.top=Math.min(e.top,N.prop("scrollHeight")-n.height-h),e.top=Math.max(e.top,h),e}function o(t){return"left"===t?{left:i.left-n.width-h,top:i.top+i.height/2-n.height/2}:"right"===t?{left:i.left+i.width+h,top:i.top+i.height/2-n.height/2}:"top"===t?{left:i.left+i.width/2-n.width/2,top:i.top-n.height-h}:{left:i.left+i.width/2-n.width/2,top:i.top+i.height+h}}var n=l.offsetRect(s,N),i=l.offsetRect(D,N),r=o(A);A?r=e(r):r.top>s.prop("offsetParent").scrollHeight-n.height-h&&(r=e(o("top"))),s.css({top:r.top+"px",left:r.left+"px"}),t()}r(s);var D=b(),k=e.element(s[0].getElementsByClassName("md-background")[0]),z=e.element(s[0].getElementsByClassName("md-content")[0]),A=p.mdDirection,H=y(),N=e.element(H||document.body),P=n.throttle(function(){d.visible&&C()});m(),w(),M(),v(),g()}var f=300,h=8;return{restrict:"E",transclude:!0,priority:210,template:'<div class="md-background"></div><div class="md-content" ng-transclude></div>',scope:{visible:"=?mdVisible",delay:"=?mdDelay",autohide:"=?mdAutohide"},link:d}}e.module("material.components.tooltip",["material.core"]).directive("mdTooltip",n),n.$inject=["$timeout","$window","$$rAF","$document","$mdUtil","$mdTheming","$rootElement","$animate","$q"]}(window,window.angular);
|