diff --git a/dist/jquery.qtip.basic.js b/dist/jquery.qtip.basic.js index bd9c6d89..2349dba2 100644 --- a/dist/jquery.qtip.basic.js +++ b/dist/jquery.qtip.basic.js @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Fri Apr 22 20:26:38 2011 +0100 +* Date: Fri Apr 22 20:28:01 2011 +0100 */ "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ @@ -314,6 +314,7 @@ function QTip(target, options, id, attr) function updateContent(content, reposition) { var elem = elements.content; + content = content || options.content.text; // Make sure tooltip is rendered and content is defined. If not return if(!self.rendered || !content) { return FALSE; } @@ -673,8 +674,7 @@ function QTip(target, options, id, attr) { if(self.rendered) { return self; } // If tooltip has already been rendered, exit - var content = options.content.text, - title = options.content.title.text, + var title = options.content.title.text, callback = $.Event('tooltiprender'); // Add ARIA attributes to target @@ -716,7 +716,7 @@ function QTip(target, options, id, attr) } // Set proper rendered flag and update content - updateContent(content); + updateContent(); self.rendered = TRUE; // Setup widget classes @@ -896,7 +896,10 @@ function QTip(target, options, id, attr) // Focus the tooltip self.focus(event); - // Update tooltip position + // Update tooltip content if it's a dynamic function + if($.isFunction(options.content.text)) { updateContent(); } + + // Update the tooltip position self.reposition(event); // Hide other tooltips if tooltip is solo, using it as the context diff --git a/dist/jquery.qtip.css b/dist/jquery.qtip.css index 7f33361f..af93ce73 100644 --- a/dist/jquery.qtip.css +++ b/dist/jquery.qtip.css @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Fri Apr 22 20:26:38 2011 +0100 +* Date: Fri Apr 22 20:28:01 2011 +0100 */ /* Fluid class for determining actual width in IE */ diff --git a/dist/jquery.qtip.js b/dist/jquery.qtip.js index 4e70b82c..81e75965 100644 --- a/dist/jquery.qtip.js +++ b/dist/jquery.qtip.js @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Fri Apr 22 20:26:38 2011 +0100 +* Date: Fri Apr 22 20:28:01 2011 +0100 */ "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ @@ -314,6 +314,7 @@ function QTip(target, options, id, attr) function updateContent(content, reposition) { var elem = elements.content; + content = content || options.content.text; // Make sure tooltip is rendered and content is defined. If not return if(!self.rendered || !content) { return FALSE; } @@ -673,8 +674,7 @@ function QTip(target, options, id, attr) { if(self.rendered) { return self; } // If tooltip has already been rendered, exit - var content = options.content.text, - title = options.content.title.text, + var title = options.content.title.text, callback = $.Event('tooltiprender'); // Add ARIA attributes to target @@ -716,7 +716,7 @@ function QTip(target, options, id, attr) } // Set proper rendered flag and update content - updateContent(content); + updateContent(); self.rendered = TRUE; // Setup widget classes @@ -896,7 +896,10 @@ function QTip(target, options, id, attr) // Focus the tooltip self.focus(event); - // Update tooltip position + // Update tooltip content if it's a dynamic function + if($.isFunction(options.content.text)) { updateContent(); } + + // Update the tooltip position self.reposition(event); // Hide other tooltips if tooltip is solo, using it as the context diff --git a/dist/jquery.qtip.min.js b/dist/jquery.qtip.min.js index 8f2fca5e..52fb36a3 100644 --- a/dist/jquery.qtip.min.js +++ b/dist/jquery.qtip.min.js @@ -9,5 +9,5 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Fri Apr 22 20:26:38 2011 +0100 -*/"use strict",function(a,b,c){function z(b){var c=this,d=b.elements,e=d.tooltip,f=".bgiframe-"+b.id;a.extend(c,{init:function(){d.bgiframe=a(''),d.bgiframe.appendTo(e),e.bind("tooltipmove"+f,c.adjust)},adjust:function(){var a=b.get("dimensions"),c=b.plugins.tip,f=d.tip,g,h;h=parseInt(e.css("border-left-width"),10)||0,h={left:-h,top:-h},c&&f&&(g=c.corner.precedance==="x"?["width","left"]:["height","top"],h[g[1]]-=f[g[0]]()),d.bgiframe.css(h).css(a)},destroy:function(){d.bgiframe.remove(),e.unbind(f)}}),c.init()}function y(c){var f=this,g=c.options.show.modal,h=c.elements,i=h.tooltip,j="#qtip-overlay",k=".qtipmodal",l;c.checks.modal={"^show.modal.(on|blur)$":function(){f.init(),h.overlay.toggle(i.is(":visible"))}},a.extend(f,{init:function(){if(!g.on)return f;i.unbind(k).unbind(k+c.id).bind("tooltipshow"+k+" tooltiphide"+k,function(b,c,d){var e=b.type.replace("tooltip","");a.isFunction(g[e])?g[e].call(h.overlay,d,c):f[e](d)}).bind("tooltipfocus",function(a,b,c){l.css("z-index",c-1)}),f.create(),h.overlay.css("cursor",g.blur?"pointer":""),g.blur===d&&h.overlay.bind("click"+k+c.id,function(){c.hide.call(c)});return f},create:function(){var c=a(j);if(c.length){h.overlay=c;return c}l=h.overlay=a("
",{id:j.substr(1),css:{position:"absolute",top:0,left:0,display:"none"},mousedown:function(){return e}}).appendTo(document.body),a(b).bind("resize"+k,function(){l.css({height:Math.max(a(b).height(),a(document).height()),width:Math.max(a(b).width(),a(document).width())})}).trigger("resize");return l},toggle:function(b){var g=c.options.show.modal.effect,h=b?"show":"hide",i;l||(l=f.create());if(!l.is(":animated")||b){l.stop(d,e),a.isFunction(g)?g.call(l,b):g===e?l[h]():l.fadeTo(90,b?.7:0,function(){b||a(this).hide()});return f}},show:function(){return f.toggle(d)},hide:function(){return f.toggle(e)},destroy:function(){var d=l;d&&(a(j).each(function(){var b=a(this).data("qtip");if(b&&b.id!==b.id&&b.options.show.modal)return d=e}),d?(h.overlay.remove(),a(b).unbind(k)):h.overlay.unbind(k+c.id));return i.unbind(k)}}),f.init()}function x(b,g){function v(a){var b=a.precedance==="y",c=n[b?"width":"height"],d=n[b?"height":"width"],e=a.string().indexOf("center")>-1,f=c*(e?.5:1),g=Math.pow,h=Math.round,i,j,k,l=Math.sqrt(g(f,2)+g(d,2)),m=[p/f*l,p/d*l];m[2]=Math.sqrt(g(m[0],2)-g(p,2)),m[3]=Math.sqrt(g(m[1],2)-g(p,2)),i=l+m[2]+m[3]+(e?0:m[0]),j=i/l,k=[h(j*d),h(j*c)];return{height:k[b?0:1],width:k[b?1:0]}}function u(b){var c=k.titlebar&&b.y==="top",d=c?k.titlebar:k.content,e=a.browser.mozilla,f=e?"-moz-":a.browser.webkit?"-webkit-":"",g=b.y+(e?"":"-")+b.x,h=f+(e?"border-radius-"+g:"border-"+g+"-radius");return parseInt(d.css(h),10)||parseInt(l.css(h),10)||0}function t(a,b,c){b=b?b:a[a.precedance];var d=k.titlebar&&a.y==="top",e=d?k.titlebar:k.content,f="border-"+b+"-width",g=parseInt(e.css(f),10);return(c?g||parseInt(l.css(f),10):g)||0}function s(f,g,h,l){if(k.tip){var n=a.extend({},i.corner),o=h.adjusted,p=b.options.position.adjust.method.split(" "),q=p[0],r=p[1]||p[0],s={left:e,top:e,x:0,y:0},t,u={},v;i.corner.fixed!==d&&(q==="shift"&&n.precedance==="x"&&o.left&&n.y!=="center"?n.precedance=n.precedance==="x"?"y":"x":q==="flip"&&o.left&&(n.x=n.x==="center"?o.left>0?"left":"right":n.x==="left"?"right":"left"),r==="shift"&&n.precedance==="y"&&o.top&&n.x!=="center"?n.precedance=n.precedance==="y"?"x":"y":r==="flip"&&o.top&&(n.y=n.y==="center"?o.top>0?"top":"bottom":n.y==="top"?"bottom":"top"),n.string()!==m.corner&&(m.top!==o.top||m.left!==o.left)&&i.update(n,e)),t=i.position(n,o),t.right!==c&&(t.left=-t.right),t.bottom!==c&&(t.top=-t.bottom),t.user=Math.max(0,j.offset);if(s.left=q==="shift"&&!!o.left)n.x==="center"?u["margin-left"]=s.x=t["margin-left"]-o.left:(v=t.right!==c?[o.left,-t.left]:[-o.left,t.left],(s.x=Math.max(v[0],v[1]))>v[0]&&(h.left-=o.left,s.left=e),u[t.right!==c?"right":"left"]=s.x);if(s.top=r==="shift"&&!!o.top)n.y==="center"?u["margin-top"]=s.y=t["margin-top"]-o.top:(v=t.bottom!==c?[o.top,-t.top]:[-o.top,t.top],(s.y=Math.max(v[0],v[1]))>v[0]&&(h.top-=o.top,s.top=e),u[t.bottom!==c?"bottom":"top"]=s.y);k.tip.css(u).toggle(!(s.x&&s.y||n.x==="center"&&s.y||n.y==="center"&&s.x)),h.left-=t.left.charAt?t.user:q!=="shift"||s.top||!s.left&&!s.top?t.left:0,h.top-=t.top.charAt?t.user:r!=="shift"||s.left||!s.left&&!s.top?t.top:0,m.left=o.left,m.top=o.top,m.corner=n.string()}}var i=this,j=b.options.style.tip,k=b.elements,l=k.tooltip,m={top:0,left:0,corner:""},n={width:j.width,height:j.height},o={},p=j.border||0,q=".qtip-tip",r=a("")[0].getContext;i.corner=f,i.mimic=f,i.position={},b.checks.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){i.init()||i.destroy(),b.reposition()},"^style.tip.(height|width)$":function(){n={width:j.width,height:j.height},i.create(),i.update(),b.reposition()},"^content.title.text|style.(classes|widget)$":function(){k.tip&&i.update()}},a.extend(i,{init:function(){var b=i.detectCorner()&&(r||a.browser.msie);b&&(i.create(),i.update(),l.unbind(q).bind("tooltipmove"+q,s));return b},detectCorner:function(){var a=j.corner,c=b.options.position,f=c.at,g=c.my.string?c.my.string():c.my;if(a===e||g===e&&f===e)return e;a===d?i.corner=new h.Corner(g):a.string||(i.corner=new h.Corner(a),i.corner.fixed=d);return i.corner.string()!=="centercenter"},detectColours:function(){var c,d,e,f=k.tip.css({backgroundColor:"",border:""}),g=i.corner,h=g[g.precedance],m="border-"+h+"-color",p="border"+h.charAt(0)+h.substr(1)+"Color",q=/rgba?\(0, 0, 0(, 0)?\)|transparent/i,r="background-color",s="transparent",t="ui-tooltip-fluid",u=a(document.body).css("color"),v=b.elements.content.css("color"),w=k.titlebar&&(g.y==="top"||g.y==="center"&&f.position().top+n.height/2+j.offset