/* * bubbletip * * Copyright (c) 2009-2010, UhLeeKa. * Version: * 1.0.6 * Licensed under the GNU Lesser General Public License: * http://www.gnu.org/licenses/lgpl-3.0.html * Author Website: * http://www.uhleeka.com * Project Hosting on Google Code: * http://code.google.com/p/bubbletip/ */ !function(a){var b=0;a.fn.extend({bubbletip:function(c,d){function r(){var b;l||(l=!0,m&&n.stop(!0,!1),h.calculateOnShow&&t(),h.positionAt.match(/^element|body$/i)?h.deltaDirection.match(/^up|down$/i)?(m||n.css("top",parseInt(i.top+i.delta)+"px"),b={top:i.top+"px"}):(m||n.css("left",parseInt(i.left+i.delta)+"px"),b={left:i.left+"px"}):h.deltaDirection.match(/^up|down$/i)?(m||(i.mouseTop=e.pageY+i.top,n.css({top:parseInt(i.mouseTop+i.delta)+"px",left:parseInt(e.pageX-n.width()/2)+"px"})),b={top:i.mouseTop+"px"}):(m||(i.mouseLeft=e.pageX+i.left,n.css({left:parseInt(i.mouseLeft+i.delta)+"px",top:parseInt(e.pageY-n.height()/2)+"px"})),b={left:i.left+"px"}),m=!1,f.css("position","relative"),h.zIndex>0&&n.css("z-index",h.zIndex),n.show(),b=a.extend(b,{opacity:1}),n.animate(b,h.animationDuration,h.animationEasing,function(){n.css("opacity",""),l=!0}))}function s(){var b;l=!1,m=!0,b=h.positionAt.match(/^element|body$/i)?h.deltaDirection.match(/^up|down$/i)?{top:parseInt(i.top-i.delta)+"px"}:{left:parseInt(i.left-i.delta)+"px"}:h.deltaDirection.match(/^up|down$/i)?{top:parseInt(i.mouseTop-i.delta)+"px"}:{left:parseInt(i.mouseLeft-i.delta)+"px"},b=a.extend(b,{opacity:0}),n.animate(b,h.animationDuration,h.animationEasing,function(){n.hide(),m=!1})}function t(){if(h.positionAt.match(/^element$/i)){var a=h.positionAtElement.offset();h.deltaDirection.match(/^up$/i)?(i.top=a.top+h.offsetTop-n.outerHeight()+h.deltaShift,i.left=a.left+h.offsetLeft+(h.positionAtElement.outerWidth()-n.outerWidth())/2,i.delta=h.deltaPosition):h.deltaDirection.match(/^down$/i)?(i.top=a.top+h.positionAtElement.outerHeight()+h.offsetTop-h.deltaShift,i.left=a.left+h.offsetLeft+(h.positionAtElement.outerWidth()-n.outerWidth())/2,i.delta=-h.deltaPosition):h.deltaDirection.match(/^left$/i)?(i.top=a.top+h.offsetTop+(h.positionAtElement.outerHeight()-n.outerHeight())/2,i.left=a.left+h.offsetLeft-n.outerWidth()+h.deltaShift,i.delta=h.deltaPosition):h.deltaDirection.match(/^right$/i)&&(i.top=a.top+h.offsetTop+(h.positionAtElement.outerHeight()-n.outerHeight())/2,i.left=a.left+h.positionAtElement.outerWidth()+h.offsetLeft-h.deltaShift,i.delta=-h.deltaPosition)}else h.positionAt.match(/^body$/i)?h.deltaDirection.match(/^up|left$/i)?(i.top=h.offsetTop,i.left=h.offsetLeft,i.delta=h.deltaPosition):(h.deltaDirection.match(/^down$/i)?(i.top=parseInt(h.offsetTop+n.outerHeight()),i.left=h.offsetLeft):(i.top=h.offsetTop,i.left=parseInt(h.offsetLeft+n.outerWidth())),i.delta=-h.deltaPosition):h.positionAt.match(/^mouse$/i)&&(h.deltaDirection.match(/^up|left$/i)?(h.deltaDirection.match(/^up$/i)?(i.top=-(h.offsetTop+n.outerHeight()),i.left=h.offsetLeft):h.deltaDirection.match(/^left$/i)&&(i.top=h.offsetTop,i.left=-(h.offsetLeft+n.outerWidth())),i.delta=h.deltaPosition):(i.top=h.offsetTop,i.left=h.offsetLeft,i.delta=-h.deltaPosition));h.positionAt.match(/^element|body$/i)&&n.css({position:"absolute",top:i.top+"px",left:i.left+"px"})}if(a("div.bubbletip #"+a(c).get(0).id).length>0)return this;var f,g,h,i,j,k,l,m,n,o,p,q;return f=a(this),g=a(c),o=b++,h={wrapperContainer:"body",positionAt:"element",positionAtElement:f,offsetTop:0,offsetLeft:0,deltaPosition:30,deltaShift:10,deltaDirection:"up",animationDuration:250,animationEasing:"swing",bindShow:"mouseover",bindHide:"mouseout",bindClose:"click",delayShow:0,delayHide:500,calculateOnShow:!1,showOnInit:!1,zIndex:0},d&&(h=a.extend(h,d)),i={top:0,left:0,delta:0,mouseTop:0,mouseLeft:0,bindShow:(h.bindShow+" ").replace(/ +/g,".bubbletip"+o+" "),bindHide:(h.bindHide+" ").replace(/ +/g,".bubbletip"+o+" "),bindClose:(h.bindClose+" ").replace(/ +/g,".bubbletip"+o+" ")},j=null,k=null,l=!1,m=!1,f.data("bubbletip_tips")?f.data("bubbletip_tips",a.merge(f.data("bubbletip_tips"),[[g.get(0).id,o]])):f.data("bubbletip_tips",[[g.get(0).id,o]]),h.positionAt.match(/^element|body|mouse$/i)||(h.positionAt="element"),h.deltaDirection.match(/^up|down|left|right$/i)||(h.deltaDirection="up"),h.deltaDirection.match(/^up$/i)?n=a('
'):h.deltaDirection.match(/^down$/i)?n=a('
'):h.deltaDirection.match(/^left$/i)?n=a('
'):h.deltaDirection.match(/^right$/i)&&(n=a('
')),n.appendTo(h.wrapperContainer),/msie/.test(navigator.userAgent.toLowerCase())&&!/opera/.test(navigator.userAgent.toLowerCase())&&a("*",n).each(function(){var b=a(this).css("background-image");b.match(/^url\(["']?(.*\.png)["']?\)$/i)&&(b=RegExp.$1,a(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod="+("no-repeat"==a(this).css("backgroundRepeat")?"crop":"scale")+", src='"+b+"')"}).each(function(){var b=a(this).css("position");"absolute"!=b&&"relative"!=b&&a(this).css("position","relative")}))}),a(".bt-content",n).append(g),g.show(),n.css("opacity",0),n.css({width:n.width()+2,height:n.height()}),t(),n.hide(),a(window).bind("resize.bubbletip"+o,function(){var b=a(window).width(),c=a(window).height();b===p&&c===q||(p=b,q=c,k&&clearTimeout(k),k=setTimeout(function(){t()},250))}),a([n.get(0),this.get(0)]).bind(i.bindShow,function(){return j&&clearTimeout(j),0===h.delayShow?r():j=setTimeout(function(){r()},h.delayShow),!1}).bind(i.bindHide,function(){return j&&clearTimeout(j),0===h.delayHide?s():j=setTimeout(function(){s()},h.delayHide),!1}),a(n.get(0)).bind(i.bindClose,function(){m=!0,n.animate({opacity:0},h.animationDuration,h.animationEasing,function(){n.hide(),m=!1,l=!1})}),h.showOnInit&&r(),this},removeBubbletip:function(b){var c,f,g,h,i,d=new Array,e=new Array;for(c=a.makeArray(a(this).data("bubbletip_tips")),f=a.makeArray(b),g=0;g=0){for(i=a("#"+c[g][0]).get(0).parentNode;"table"!=i.tagName.toLowerCase();)i=i.parentNode;a("#"+c[g][0]).appendTo(_options.wrapperContainer).hide(),a(i).remove(),a(this).unbind(".bubbletip"+c[g][1]),a(window).unbind(".bubbletip"+c[g][1])}else e.push(c[g]);return a(this).data("bubbletip_tips",e),this}})}(jQuery);