Bug Tracker

Changeset 5341

Show
Ignore:
Timestamp:
04/28/08 13:50:32 (8 months ago)
Author:
joern.zaefferer
Message:

tooltip plugin: Added positionLeft-option - positions the tooltip to the left of the cursor

Location:
trunk/plugins/tooltip
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/tooltip/changelog.txt

    r5286 r5341  
    44* Added fade option for fading in/out tooltips 
    55* Fixed imagemaps in IE, added back example 
     6* Added positionLeft-option - positions the tooltip to the left of the cursor 
    67 
    781.2 
  • trunk/plugins/tooltip/demo/index.html

    r5285 r5341  
    4545}); 
    4646 
    47 $("map > area").tooltip(); 
     47$("map > area").tooltip({ positionLeft: true }); 
    4848 
    4949$("#fancy, #fancy2").tooltip({ 
     
    7474    extraClass: "right" 
    7575}); 
    76 $('#right2 a').tooltip({ showURL: false }); 
     76$('#right2 a').tooltip({ showURL: false, positionLeft: true }); 
    7777 
    7878$("#block").click($.tooltip.block); 
     
    232232        </map> 
    233233        <h3>Code</h3> 
    234         <pre><code class="mix">$("map *").Tooltip();</code></pre> 
     234        <pre><code class="mix">$("map *").tooltip({ positionLeft: true });</code></pre> 
    235235    </fieldset> 
    236236     
     
    254254    extraClass: "right" 
    255255}); 
    256 $('#right2 a').tooltip({ showURL: false });</code></pre> 
     256$('#right2 a').tooltip({ showURL: false, positionLeft: true });</code></pre> 
    257257    </fieldset> 
    258258</div> 
  • trunk/plugins/tooltip/jquery.tooltip.js

    r5339 r5341  
    231231            left = event.pageX + settings(current).left; 
    232232            top = event.pageY + settings(current).top; 
     233            var right='auto'; 
     234            if (settings(current).positionLeft) { 
     235                right = $(window).width() - left; 
     236                left = 'auto'; 
     237            } 
    233238            helper.parent.css({ 
    234                 left: left + 'px', 
    235                 top: top + 'px' 
     239                left: left, 
     240                right: right, 
     241                top: top 
    236242            }); 
    237243        } 
  • trunk/plugins/tooltip/jquery.tooltip.min.js

    r4583 r5341  
    11/* 
    2  * jQuery Tooltip plugin 1.2 
     2 * jQuery Tooltip plugin 1.3pre 
    33 * 
    44 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ 
     
    77 * Copyright (c) 2006 - 2008 Jörn Zaefferer 
    88 * 
    9  * $Id: jquery.tooltip.js 4569 2008-01-31 19:36:35Z joern.zaefferer $ 
     9 * $Id: jquery.tooltip.js 5339 2008-04-28 13:06:08Z joern.zaefferer $ 
    1010 *  
    1111 * Dual licensed under the MIT and GPL licenses: 
    1212 *   http://www.opensource.org/licenses/mit-license.php 
    1313 *   http://www.gnu.org/licenses/gpl.html 
    14  */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip-settings",settings);this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).hover(save,hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip-settings");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else 
    15 show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;part=parts[i];i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else 
    16 helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;helper.parent.show();update();}function update(event){if($.tooltip.blocked)return;if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;helper.parent.css({left:left+'px',top:top+'px'});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;helper.parent.hide().removeClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.unfixPNG();}$.fn.Tooltip=$.fn.tooltip;})(jQuery); 
     14 */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false,fading=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){this.tSettings=settings;this.tOpacity=helper.parent.css("opacity")this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).hover(save,hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return element.tSettings;}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else 
     15show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else 
     16helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if(settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else 
     17helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if(tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else 
     18helper.parent.stop().fadeOut(tsettings.fade,complete);}else 
     19complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}$.fn.Tooltip=$.fn.tooltip;})(jQuery); 
  • trunk/plugins/tooltip/jquery.tooltip.pack.js

    r4583 r5341  
    11/* 
    2  * jQuery Tooltip plugin 1.2 
     2 * jQuery Tooltip plugin 1.3pre 
    33 * 
    44 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ 
     
    1313 *   http://www.gnu.org/licenses/gpl.html 
    1414 */ 
    15 eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(3($){m d={},k,g,w,S=$.2f.21&&/1Y\\s(5\\.5|6\\.)/.1B(1w.2e),H=1h;$.f={r:1h,1b:{O:1Q,11:Z,U:"",u:15,z:15,R:"f"},1t:3(){$.f.r=!$.f.r}};$.F.1o({f:3(a){a=$.1o({},$.f.1b,a);1j(a);e 2.B(3(){$.1d(2,"f-7",a);2.T=2.g;$(2).1W("g");2.1U=""}).1S(16,l).1O(l)},D:S?3(){e 2.B(3(){m b=$(2).o(\'N\');4(b.1G(/^j\\(["\']?(.*\\.1C)["\']?\\)$/i)){b=1y.$1;$(2).o({\'N\':\'1x\',\'17\':"1u:1s.1r.2c(2b=Z, 2a=29, 1k=\'"+b+"\')"}).B(3(){m a=$(2).o(\'1m\');4(a!=\'23\'&&a!=\'1i\')$(2).o(\'1m\',\'1i\')})}})}:3(){e 2},1g:S?3(){e 2.B(3(){$(2).o({\'17\':\'\',N:\'\'})})}:3(){e 2},1f:3(){e 2.B(3(){$(2)[$(2).C()?"n":"l"]()})},j:3(){e 2.1e(\'1Z\')||2.1e(\'1k\')}});3 1j(a){4(d.8)e;d.8=$(\'<p R="\'+a.R+\'"><W></W><p 1c="9"></p><p 1c="j"></p></p>\').1X(I.9).l();4($.F.1a)d.8.1a();d.g=$(\'W\',d.8);d.9=$(\'p.9\',d.8);d.j=$(\'p.j\',d.8)}3 7(a){e $.1d(a,"f-7")}3 19(a){4(7(2).O)w=1T(n,7(2).O);A n();H=!!7(2).H;$(I.9).1R(\'K\',q);q(a)}3 16(){4($.f.r||2==k||(!2.T&&!7(2).J))e;k=2;g=2.T;4(7(2).J){d.g.l();m a=7(2).J.1P(2);4(a.1N||a.1M){d.9.12().P(a)}A{d.9.C(a)}d.9.n()}A 4(7(2).10){m b=g.1L(7(2).10);d.g.C(b.1K()).n();d.9.12();1J(m i=0,M;M=b[i];i++){4(i>0)d.9.P("<1I/>");d.9.P(M)}d.9.1f()}A{d.g.C(g).n();d.9.l()}4(7(2).11&&$(2).j())d.j.C($(2).j().1H(\'1F://\',\'\')).n();A d.j.l();d.8.V(7(2).U);4(7(2).D)d.8.D();19.1E(2,1D)}3 n(){w=L;d.8.n();q()}3 q(c){4($.f.r)e;4(!H&&d.8.1A(":1z")){$(I.9).18(\'K\',q)}4(k==L){$(I.9).18(\'K\',q);e}d.8.Q("t-Y").Q("t-13");m b=d.8[0].14;m a=d.8[0].X;4(c){b=c.1v+7(k).z;a=c.1V+7(k).u;d.8.o({z:b+\'E\',u:a+\'E\'})}m v=t(),h=d.8[0];4(v.x+v.1q<h.14+h.1p){b-=h.1p+20+7(k).z;d.8.o({z:b+\'E\'}).V("t-Y")}4(v.y+v.1l<h.X+h.1n){a-=h.1n+20+7(k).u;d.8.o({u:a+\'E\'}).V("t-13")}}3 t(){e{x:$(G).28(),y:$(G).27(),1q:$(G).26(),1l:$(G).25()}}3 l(a){4($.f.r)e;4(w)24(w);k=L;d.8.l().Q(7(2).U);4(7(2).D)d.8.1g()}$.F.2d=$.F.f})(22);',62,140,'||this|function|if|||settings|parent|body|||||return|tooltip|title|||url|current|hide|var|show|css|div|update|blocked||viewport|top||tID|||left|else|each|html|fixPNG|px|fn|window|track|document|bodyHandler|mousemove|null|part|backgroundImage|delay|append|removeClass|id|IE|tooltipText|extraClass|addClass|h3|offsetTop|right|true|showBody|showURL|empty|bottom|offsetLeft||save|filter|unbind|handle|bgiframe|defaults|class|data|attr|hideWhenEmpty|unfixPNG|false|relative|createHelper|src|cy|position|offsetHeight|extend|offsetWidth|cx|Microsoft|DXImageTransform|block|progid|pageX|navigator|none|RegExp|visible|is|test|png|arguments|apply|http|match|replace|br|for|shift|split|jquery|nodeType|click|call|200|bind|hover|setTimeout|alt|pageY|removeAttr|appendTo|MSIE|href||msie|jQuery|absolute|clearTimeout|height|width|scrollTop|scrollLeft|crop|sizingMethod|enabled|AlphaImageLoader|Tooltip|userAgent|browser'.split('|'),0,{})) 
     15eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(8($){j e={},9,n,F,N=$.2v.2g&&/28\\s(5\\.5|6\\.)/.1M(1H.2u),M=K,2c=K;$.k={u:K,1f:{10:22,r:K,19:18,V:"",A:15,E:15,13:"k"},2r:8(){$.k.u=!$.k.u}};$.L.1r({k:8(a){a=$.1r({},$.k.1f,a);1v(a);g 2.C(8(){2.1i=a;2.11=e.3.l("1u")2.Z=2.n;$(2).23("n");2.21=""}).1Y(1c,o).1S(o)},G:N?8(){g 2.C(8(){j b=$(2).l(\'Y\');4(b.1J(/^p\\(["\']?(.*\\.1I)["\']?\\)$/i)){b=1F.$1;$(2).l({\'Y\':\'1D\',\'1B\':"2s:2q.2m.2l(2j=18, 2i=2h, 1p=\'"+b+"\')"}).C(8(){j a=$(2).l(\'1o\');4(a!=\'2f\'&&a!=\'1t\')$(2).l(\'1o\',\'1t\')})}})}:8(){g 2},1k:N?8(){g 2.C(8(){$(2).l({\'1B\':\'\',Y:\'\'})})}:8(){g 2},1x:8(){g 2.C(8(){$(2)[$(2).B()?"m":"o"]()})},p:8(){g 2.1j(\'27\')||2.1j(\'1p\')}});8 1v(a){4(e.3)g;e.3=$(\'<t 13="\'+a.13+\'"><12></12><t 1h="f"></t><t 1h="p"></t></t>\').26(I.f).o();4($.L.1g)e.3.1g();e.n=$(\'12\',e.3);e.f=$(\'t.f\',e.3);e.p=$(\'t.p\',e.3)}8 7(a){g a.1i}8 1e(a){4(7(2).10)F=25(m,7(2).10);q m();M=!!7(2).M;$(I.f).24(\'X\',z);z(a)}8 1c(){4($.k.u||2==9||(!2.Z&&!7(2).U))g;9=2;n=2.Z;4(7(2).U){e.n.o();j a=7(2).U.1Z(2);4(a.1V||a.1U){e.f.1b().S(a)}q{e.f.B(a)}e.f.m()}q 4(7(2).1a){j b=n.1T(7(2).1a);e.n.B(b.1R()).m();e.f.1b();1Q(j i=0,W;(W=b[i]);i++){4(i>0)e.f.S("<1P/>");e.f.S(W)}e.f.1x()}q{e.n.B(n).m();e.f.o()}4(7(2).19&&$(2).p())e.p.B($(2).p().1O(\'1N://\',\'\')).m();q e.p.o();e.3.O(7(2).V);4(7(2).G)e.3.G();1e.1L(2,1K)}8 m(){F=R;4(7(9).r){4(e.3.H(":17"))e.3.P().m().Q(7(9).r,9.11);q e.3.H(\':16\')?e.3.Q(7(9).r,9.11):e.3.1G(7(9).r)}q{e.3.m()}z()}8 z(c){4($.k.u)g;4(c&&c.1W.1X=="1E"){g}4(!M&&e.3.H(":16")){$(I.f).1d(\'X\',z)}4(9==R){$(I.f).1d(\'X\',z);g}e.3.T("w-14").T("w-1A");j b=e.3[0].1z;j a=e.3[0].1y;4(c){b=c.2o+7(9).E;a=c.2n+7(9).A;j d=\'1w\';4(7(9).2k){d=$(D).1l()-b;b=\'1w\'}e.3.l({E:b,14:d,A:a})}j v=w(),h=e.3[0];4(v.x+v.1q<h.1z+h.1n){b-=h.1n+20+7(9).E;e.3.l({E:b+\'1C\'}).O("w-14")}4(v.y+v.1s<h.1y+h.1m){a-=h.1m+20+7(9).A;e.3.l({A:a+\'1C\'}).O("w-1A")}}8 w(){g{x:$(D).2e(),y:$(D).2d(),1q:$(D).1l(),1s:$(D).2p()}}8 o(a){4($.k.u)g;4(F)2b(F);9=R;j b=7(2);8 J(){e.3.T(b.V).o().l("1u","")}4(b.r){4(e.3.H(\':17\'))e.3.P().Q(b.r,0,J);q e.3.P().2a(b.r,J)}q J();4(7(2).G)e.3.1k()}$.L.2t=$.L.k})(29);',62,156,'||this|parent|if|||settings|function|current||||||body|return|||var|tooltip|css|show|title|hide|url|else|fade||div|blocked||viewport|||update|top|html|each|window|left|tID|fixPNG|is|document|complete|false|fn|track|IE|addClass|stop|fadeTo|null|append|removeClass|bodyHandler|extraClass|part|mousemove|backgroundImage|tooltipText|delay|tOpacity|h3|id|right||visible|animated|true|showURL|showBody|empty|save|unbind|handle|defaults|bgiframe|class|tSettings|attr|unfixPNG|width|offsetHeight|offsetWidth|position|src|cx|extend|cy|relative|opacity|createHelper|auto|hideWhenEmpty|offsetTop|offsetLeft|bottom|filter|px|none|OPTION|RegExp|fadeIn|navigator|png|match|arguments|apply|test|http|replace|br|for|shift|click|split|jquery|nodeType|target|tagName|hover|call||alt|200|removeAttr|bind|setTimeout|appendTo|href|MSIE|jQuery|fadeOut|clearTimeout|fading|scrollTop|scrollLeft|absolute|msie|crop|sizingMethod|enabled|positionLeft|AlphaImageLoader|Microsoft|pageY|pageX|height|DXImageTransform|block|progid|Tooltip|userAgent|browser'.split('|'),0,{}))