/* * 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('