// Generated by CoffeeScript 1.4.0 /* * * jQuery Tooltips by Gary Hepting - https://github.com/ghepting/jquery-tooltips * * Open source under the BSD License. * * Copyright © 2013 Gary Hepting. All rights reserved. * */(function(){(function(e){return e.fn.tooltip=function(t){var n,r,i,s,o,u,a,f;r={topOffset:0,delay:100,speed:100};t=e.extend(r,t);a=e("#tooltip");i="";f="";s=function(t){var n,r,i,s,o,u;i=t.offset();u=e(window);return{top:o=i.top-u.scrollTop(),left:r=i.left-u.scrollLeft(),bottom:n=u.height()-o-t.outerHeight(),right:s=u.width()-r-t.outerWidth()}};o=function(n){var r,i,o,u;i=s(n);a.outerWidth()>e(window).width()-20&&a.css("width",e(window).width()-20);r={};a.css("max-width",Math.min(e(window).width()-parseInt(e("body").css("padding-left"))-parseInt(e("body").css("padding-right")),parseInt(a.css("max-width"))));u=a.outerWidth();o=a.outerHeight();if(i.left<=i.right){a.addClass("left");r.left=i.left}else{a.addClass("right");r.right=i.right}if(i.top-t.topOffset>o+20){a.addClass("top");r.top=n.offset().top-o-20}else{a.addClass("bottom");r.top=n.offset().top+n.outerHeight()-4}return a.css(r)};n=function(){a.stop().remove();return e("[role=tooltip]").removeClass("on")};u=function(r){n();clearTimeout(i);return i=setTimeout(function(){if(e("#tooltip").length!==1){e("#tooltip").remove();a=e('
');a.appendTo("body")}a.css("opacity",0).text(r.attr("data-title"));o(r);r.addClass("on");return a.animate({top:"+=10",opacity:1},t.speed)},t.delay)};this.each(function(){var t;t=e(this);t.attr("role","tooltip").attr("data-title",t.attr("title"));return t.removeAttr("title")});e("body").on("focus","[role=tooltip]",function(){return u(e(this))}).on("blur","[role=tooltip]",function(){clearTimeout(i);return n()}).on("mouseenter","[role=tooltip]:not(input,select,textarea)",function(){return u(e(this))}).on("mouseleave","[role=tooltip]:not(input,select,textarea)",function(){clearTimeout(i);return n()});return e(window).on({scroll:function(){f=e("[role=tooltip].on");if(f.length){o(f);return e("#tooltip").css({top:"+=10"})}}})}})(jQuery)}).call(this);