diff --git a/bower.json b/bower.json index 329dfd7..008cd91 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-tooltips", - "version": "1.1.1", + "version": "1.1.2", "description": "Angular.js tooltips module.", "authors": [ "Filippo Oretti =15?(o.forEach(function(t){t()}),i=t):e.console.log("Skipped!")},l=function(){e.clearTimeout(t),t=e.setTimeout(function(){e.requestAnimationFrame(r)},500)},a=function(t){t&&o.push(t)};return{add:function(t){o.length||e.addEventListener("resize",l),a(t)},remove:function(){o.length||(e.clearTimeout(t),e.removeEventListener("resize",l))}}}(),r=function(t){var e={};return t.removeAttr(o),void 0!==t.attr("tooltip-template")&&(e["tooltip-template"]=t.attr("tooltip-template"),t.removeAttr("tooltip-template")),void 0!==t.attr("tooltip-template-url")&&(e["tooltip-template-url"]=t.attr("tooltip-template-url"),t.removeAttr("tooltip-template-url")),void 0!==t.attr("tooltip-controller")&&(e["tooltip-controller"]=t.attr("tooltip-controller"),t.removeAttr("tooltip-controller")),void 0!==t.attr("tooltip-side")&&(e["tooltip-side"]=t.attr("tooltip-side"),t.removeAttr("tooltip-side")),void 0!==t.attr("tooltip-show-trigger")&&(e["tooltip-show-trigger"]=t.attr("tooltip-show-trigger"),t.removeAttr("tooltip-show-trigger")),void 0!==t.attr("tooltip-hide-trigger")&&(e["tooltip-hide-trigger"]=t.attr("tooltip-hide-trigger"),t.removeAttr("tooltip-hide-trigger")),void 0!==t.attr("tooltip-smart")&&(e["tooltip-smart"]=t.attr("tooltip-smart"),t.removeAttr("tooltip-smart")),void 0!==t.attr("tooltip-class")&&(e["tooltip-class"]=t.attr("tooltip-class"),t.removeAttr("tooltip-class")),void 0!==t.attr("tooltip-close-button")&&(e["tooltip-close-button"]=t.attr("tooltip-close-button"),t.removeAttr("tooltip-close-button")),void 0!==t.attr("tooltip-size")&&(e["tooltip-size"]=t.attr("tooltip-size"),t.removeAttr("tooltip-size")),void 0!==t.attr("tooltip-speed")&&(e["tooltip-speed"]=t.attr("tooltip-speed"),t.removeAttr("tooltip-speed")),e},l=function(t){return e.getComputedStyle?e.getComputedStyle(t,""):t.currentStyle?t.currentStyle:void 0},a=function(o){for(var i,r,l=e.document.querySelectorAll("._exradicated-tooltip"),a=0,n=l.length;n>a;a+=1)if(i=l.item(a),i&&(r=t.element(i),r.data("_tooltip-parent")&&r.data("_tooltip-parent")===o))return r},n=function(t){var e=a(t);e&&e.remove()},s=function(t){if(t){var o=t[0].getBoundingClientRect();return o.top<0||o.top>e.document.body.offsetHeight||o.left<0||o.left>e.document.body.offsetWidth||o.bottom<0||o.bottom>e.document.body.offsetHeight||o.right<0||o.right>e.document.body.offsetWidth?(t.css({top:"",left:"",bottom:"",right:""}),!0):!1}throw new Error("You must provide a position")},p=function(){var t={side:"top",showTrigger:"mouseover",hideTrigger:"mouseleave","class":"",smart:!1,closeButton:!1,size:"",speed:"steady"};return{configure:function(e){var o,i=Object.keys(t),r=0;if(e)for(;r1?h.addClass("_multiline"):h.removeClass("_multiline")},P=function(o){if($.addClass("_hidden"),f.tooltipSmart)switch(f.tooltipSide){case"top":s($)&&(h.removeClass("_top"),h.addClass("_left"),s($)&&(h.removeClass("_left"),h.addClass("_bottom"),s($)&&(h.removeClass("_bottom"),h.addClass("_right"),s($)&&(h.removeClass("_right"),h.addClass("_top")))));break;case"left":s($)&&(h.removeClass("_left"),h.addClass("_bottom"),s($)&&(h.removeClass("_bottom"),h.addClass("_right"),s($)&&(h.removeClass("_right"),h.addClass("_top"),s($)&&(h.removeClass("_top"),h.addClass("_left")))));break;case"bottom":s($)&&(h.removeClass("_bottom"),h.addClass("_left"),s($)&&(h.removeClass("_left"),h.addClass("_top"),s($)&&(h.removeClass("_top"),h.addClass("_right"),s($)&&(h.removeClass("_right"),h.addClass("_bottom")))));break;case"right":s($)&&(h.removeClass("_right"),h.addClass("_top"),s($)&&(h.removeClass("_top"),h.addClass("_left"),s($)&&(h.removeClass("_left"),h.addClass("_bottom"),s($)&&(h.removeClass("_bottom"),h.addClass("_right")))));break;default:throw new Error("Position not supported")}if(f.tooltipAppendToBody){var i,r,a,p,d,c=l(A[0]),m=l(z[0]),u=l($[0]),g=$[0].getBoundingClientRect(),v=t.copy($),C=0,_=c.length,b=0,y=m.length,w=0,T=u.length,S={},B={},E={};for($.removeClass("_hidden"),v.removeClass("_hidden"),v.data("_tooltip-parent",h),n(h);_>C;C+=1)i=c[C],i&&c.getPropertyValue(i)&&(S[i]=c.getPropertyValue(i));for(;y>b;b+=1)i=m[b],i&&m.getPropertyValue(i)&&(E[i]=m.getPropertyValue(i));for(;T>w;w+=1)i=u[w],i&&"position"!==i&&"display"!==i&&"opacity"!==i&&"z-index"!==i&&"bottom"!==i&&"height"!==i&&"left"!==i&&"right"!==i&&"top"!==i&&"width"!==i&&u.getPropertyValue(i)&&(B[i]=u.getPropertyValue(i));r=e.parseInt(u.getPropertyValue("padding-top"),10),a=e.parseInt(u.getPropertyValue("padding-bottom"),10),p=e.parseInt(u.getPropertyValue("padding-left"),10),d=e.parseInt(u.getPropertyValue("padding-right"),10),B.top=g.top+e.scrollY+"px",B.left=g.left+e.scrollX+"px",B.height=g.height-(r+a)+"px",B.width=g.width-(p+d)+"px",v.css(B),v.children().css(S),v.children().next().css(E),o&&"true"!==f.tooltipHidden&&(v.addClass("_exradicated-tooltip"),t.element(e.document.body).append(v))}else $.removeClass("_hidden"),o&&"true"!==f.tooltipHidden&&h.addClass("active")},x=function(){f.tooltipAppendToBody?n(h):h.removeClass("active")},H=function it(t){var e,o=t.parent();t[0]&&(t[0].scrollHeight>t[0].clientHeight||t[0].scrollWidth>t[0].clientWidth)&&t.on("scroll",function(){var t=this;e&&c.cancel(e),e=c(function(){var e=a(h),o=h[0].getBoundingClientRect(),i=t.getBoundingClientRect();o.topi.bottom||o.lefti.right?n(h):e&&P(!0)})}),o&&o.length&&it(o)},V=function(t){t?(h.removeClass("_force-hidden"),A.empty(),A.append(B),A.append(t),c(function(){P()})):(A.empty(),h.addClass("_force-hidden"))},R=function(t){t?p.get(t).then(function(t){t&&t.data&&(h.removeClass("_force-hidden"),A.empty(),A.append(B),A.append(d(t.data)(g)),c(function(){P()}))}):(A.empty(),h.addClass("_force-hidden"))},W=function(t){t&&(_&&h.removeAttr("_"+_),h.addClass("_"+t),_=t)},I=function(t){t&&(b&&h.off(b),h.on(t,P),b=t)},U=function(t){t&&(y&&h.off(y),h.on(t,x),y=t)},Y=function(t){t&&(C&&$.removeClass(C),$.addClass(t),C=t)},j=function(){"boolean"!=typeof f.tooltipSmart&&(f.tooltipSmart="true"===f.tooltipSmart)},q=function(t){var e="true"===t;e?(B.on("click",x),B.css("display","block")):(B.off("click"),B.css("display","none"))},L=function(e){if(e){var o,i=m(e,{$scope:g}),r=g.$new(!1,g),l=e.indexOf("as");l>=0?(o=e.substr(l+3),r[o]=i):t.extend(r,i),A.replaceWith(d(A)(r)),Z()}},O=function(t){t&&(w&&A.removeClass("_"+w),A.addClass("_"+t),w=t)},F=function(t){t&&(T&&h.removeClass("_"+T),h.addClass("_"+t),T=t)},X=f.$observe("tooltipTemplate",V),D=f.$observe("tooltipTemplateUrl",R),G=f.$observe("tooltipSide",W),J=f.$observe("tooltipShowTrigger",I),K=f.$observe("tooltipHideTrigger",U),M=f.$observe("tooltipClass",Y),N=f.$observe("tooltipSmart",j),Q=f.$observe("tooltipCloseButton",q),Z=f.$observe("tooltipController",L),tt=f.$observe("tooltipSize",O),et=f.$observe("tooltipSpeed",F),ot=g.$watch(E,k);B.attr({id:"close-button"}),B.html("×"),$.addClass("_hidden"),A.append(B),A.append(f.tooltipTemplate),$.append(A),$.append(z),S.append(o),h.attr(v),h.addClass("tooltips"),h.append(S),h.append($),u.after(h),f.tooltipAppendToBody&&(i.add(function(){H(h)}),H(h)),i.add(function(){k(),P()}),c(function(){P(),$.removeClass("_hidden"),h.addClass("_ready")}),g.$on("$destroy",function(){X(),D(),G(),J(),K(),M(),N(),Q(),tt(),et(),ot(),i.remove(),o.off(f.tooltipShowTrigger+" "+f.tooltipHideTrigger)})})};return{restrict:"A",transclude:"element",priority:1,terminal:!0,link:f}}];t.module("720kb.tooltips",[]).provider(o+"Conf",p).directive(o,d)}(angular,window); //# sourceMappingURL=angular-tooltips.js.map diff --git a/package.json b/package.json index 8011c11..09e6562 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-tooltips", - "version": "1.1.1", + "version": "1.1.2", "description": "Angular.js tooltips module.", "homepage": "http://720kb.github.io/angular-tooltips", "main": "index.js",