diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-02-04 05:17:07 +0300 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-02-04 05:17:07 +0300 |
commit | f00dec32c9e59439d7dd9a66fa63d05e091c9537 (patch) | |
tree | afc7aa4cad7898356494dfe7f663ba8b62f0dd0d /libs | |
parent | 5e7bf8ca2c3594ee82b3598bc49f5b17b20d12a1 (diff) |
- fixed default width for graphs by introducing 2 new css classes
.parentDivGraph {
width:500px;
}
.parentDivGraphEvolution {
width:100%;
}
- trying to make tooltip look better but without success
Diffstat (limited to 'libs')
-rw-r--r-- | libs/jquery/tooltip/_jquery.tooltip.js | 342 | ||||
-rw-r--r-- | libs/jquery/tooltip/jquery.tooltip.css | 11 | ||||
-rw-r--r-- | libs/jquery/tooltip/jquery.tooltip.min.js | 17 | ||||
-rw-r--r-- | libs/jquery/tooltip/jquery.tooltip.pack.js | 15 |
4 files changed, 342 insertions, 43 deletions
diff --git a/libs/jquery/tooltip/_jquery.tooltip.js b/libs/jquery/tooltip/_jquery.tooltip.js new file mode 100644 index 0000000000..cf3c6e9b28 --- /dev/null +++ b/libs/jquery/tooltip/_jquery.tooltip.js @@ -0,0 +1,342 @@ +/* + * jQuery Tooltip plugin 1.1 + * + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ + * + * Copyright (c) 2006 J�rn Zaefferer, Stefan Petre + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Revision: $Id: jquery.tooltip.js 163 2008-01-14 04:40:16Z matt $ + * + */ + +/** + * Display a customized tooltip instead of the default one + * for every selected element. The tooltip behaviour mimics + * the default one, but lets you style the tooltip and + * specify the delay before displaying it. In addition, it displays the + * href value, if it is available. + * + * Requires dimensions plugin. + * + * When used on a page with select elements, include the bgiframe plugin. It is used if present. + * + * To style the tooltip, use these selectors in your stylesheet: + * + * #tooltip - The tooltip container + * + * #tooltip h3 - The tooltip title + * + * #tooltip div.body - The tooltip body, shown when using showBody + * + * #tooltip div.url - The tooltip url, shown when using showURL + * + * + * @example $('a, input, img').Tooltip(); + * @desc Shows tooltips for anchors, inputs and images, if they have a title + * + * @example $('label').Tooltip({ + * delay: 0, + * track: true, + * event: "click" + * }); + * @desc Shows tooltips for labels with no delay, tracking mousemovement, displaying the tooltip when the label is clicked. + * + * @example // modify global settings + * $.extend($.fn.Tooltip.defaults, { + * track: true, + * delay: 0, + * showURL: false, + * showBody: " - ", + * fixPNG: true + * }); + * // setup fancy tooltips + * $('a.pretty').Tooltip({ + * extraClass: "fancy" + * }); + $('img.pretty').Tooltip({ + * extraClass: "fancy-img", + * }); + * @desc This example starts with modifying the global settings, applying them to all following Tooltips; Afterwards, Tooltips for anchors with class pretty are created with an extra class for the Tooltip: "fancy" for anchors, "fancy-img" for images + * + * @param Object settings (optional) Customize your Tooltips + * @option Number delay The number of milliseconds before a tooltip is display. Default: 250 + * @option Boolean track If true, let the tooltip track the mousemovement. Default: false + * @option Boolean showURL If true, shows the href or src attribute within p.url. Defaul: true + * @option String showBody If specified, uses the String to split the title, displaying the first part in the h3 tag, all following in the p.body tag, separated with <br/>s. Default: null + * @option String extraClass If specified, adds the class to the tooltip helper. Default: null + * @option Boolean fixPNG If true, fixes transparent PNGs in IE. Default: false + * @option Function bodyHandler If specified its called to format the tooltip-body, hiding the title-part. Default: none + * @option Number top The top-offset for the tooltip position. Default: 15 + * @option Number left The left-offset for the tooltip position. Default: 15 + * + * @name Tooltip + * @type jQuery + * @cat Plugins/Tooltip + * @author J�rn Zaefferer (http://bassistance.de) + */ + +/** + * A global flag to disable all tooltips. + * + * @example $("button.openModal").click(function() { + * $.Tooltip.blocked = true; + * // do some other stuff, eg. showing a modal dialog + * $.Tooltip.blocked = false; + * }); + * + * @property + * @name $.Tooltip.blocked + * @type Boolean + * @cat Plugins/Tooltip + */ + +/** + * Global defaults for tooltips. Apply to all calls to the Tooltip plugin after modifying the defaults. + * + * @example $.extend($.Tooltip.defaults, { + * track: true, + * delay: 0 + * }); + * + * @property + * @name $.Tooltip.defaults + * @type Map + * @cat Plugins/Tooltip + */ +(function($) { + + // the tooltip element + var helper = {}, + // the current tooltipped element + current, + // the title of the current element, used for restoring + title, + // timeout id for delayed tooltips + tID, + // IE 5.5 or 6 + IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), + // flag for mouse tracking + track = false; + + $.Tooltip = { + blocked: false, + defaults: { + delay: 200, + showURL: true, + extraClass: "", + top: 15, + left: 15 + }, + block: function() { + $.Tooltip.blocked = !$.Tooltip.blocked; + } + }; + + $.fn.extend({ + Tooltip: function(settings) { + settings = $.extend({}, $.Tooltip.defaults, settings); + createHelper(); + return this.each(function() { + this.tSettings = settings; + // copy tooltip into its own expando and remove the title + this.tooltipText = this.title; + $(this).removeAttr("title"); + // also remove alt attribute to prevent default tooltip in IE + 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() { + // there can be only one tooltip helper + if( helper.parent ) + return; + // create the helper, h3 for title, div for url + helper.parent = $('<div id="tooltip"><h3></h3><div class="body"></div><div class="url"></div></div>') + // hide it at first + .hide() + // add to document + .appendTo('body'); + + // apply bgiframe if available + if ( $.fn.bgiframe ) + helper.parent.bgiframe(); + + // save references to title and url elements + helper.title = $('h3', helper.parent); + helper.body = $('div.body', helper.parent); + helper.url = $('div.url', helper.parent); + } + + // main event handler to start showing tooltips + function handle(event) { + // show helper, either with timeout or on instant + if( this.tSettings.delay ) + tID = setTimeout(show, this.tSettings.delay); + else + show(); + + // if selected, update the helper position when the mouse moves + track = !!this.tSettings.track; + $('body').bind('mousemove', update); + + // update at least once + update(event); + } + + // save elements title before the tooltip is displayed + function save() { + // if this is the current source, or it has no title (occurs with click event), stop + if ( $.Tooltip.blocked || this == current || !this.tooltipText ) + return; + + // save current + current = this; + title = this.tooltipText; + + if ( this.tSettings.bodyHandler ) { + helper.title.hide(); + helper.body.html( this.tSettings.bodyHandler.call(this) ).show(); + } else if ( this.tSettings.showBody ) { + var parts = title.split(this.tSettings.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 element has href or src, add and show it, otherwise hide it + if( this.tSettings.showURL && $(this).url() ) + helper.url.html( $(this).url().replace('http://', '') ).show(); + else + helper.url.hide(); + + // add an optional class for this tip + helper.parent.addClass(this.tSettings.extraClass); + + // fix PNG background for IE + if (this.tSettings.fixPNG ) + helper.parent.fixPNG(); + + handle.apply(this, arguments); + } + + // delete timeout and show helper + function show() { + tID = null; + helper.parent.show(); + update(); + } + + /** + * callback for mousemove + * updates the helper position + * removes itself when no current element + */ + function update(event) { + if($.Tooltip.blocked) + return; + + // stop updating when tracking is disabled and the tooltip is visible + if ( !track && helper.parent.is(":visible")) { + $('body').unbind('mousemove', update) + } + + // if no current element is available, remove this listener + if( current == null ) { + $('body').unbind('mousemove', update); + return; + } + var left = helper.parent[0].offsetLeft; + var top = helper.parent[0].offsetTop; + if(event) { + // position the helper 15 pixel to bottom right, starting from mouse position + left = event.pageX + current.tSettings.left; + top = event.pageY + current.tSettings.top; + helper.parent.css({ + left: left + 'px', + top: top + 'px' + }); + } + var v = viewport(), + h = helper.parent[0]; + // check horizontal position + if(v.x + v.cx < h.offsetLeft + h.offsetWidth) { + left -= h.offsetWidth + 20 + current.tSettings.left; + helper.parent.css({left: left + 'px'}); + } + // check vertical position + if(v.y + v.cy < h.offsetTop + h.offsetHeight) { + top -= h.offsetHeight + 20 + current.tSettings.top; + helper.parent.css({top: top + 'px'}); + } + } + + function viewport() { + return { + x: $(window).scrollLeft(), + y: $(window).scrollTop(), + cx: $(window).width(), + cy: $(window).height() + }; + } + + // hide helper and restore added classes and the title + function hide(event) { + if($.Tooltip.blocked) + return; + // clear timeout if possible + if(tID) + clearTimeout(tID); + // no more current element + current = null; + + helper.parent.hide().removeClass( this.tSettings.extraClass ); + + if( this.tSettings.fixPNG ) + helper.parent.unfixPNG(); + } + +})(jQuery); diff --git a/libs/jquery/tooltip/jquery.tooltip.css b/libs/jquery/tooltip/jquery.tooltip.css deleted file mode 100644 index 70316b6a3b..0000000000 --- a/libs/jquery/tooltip/jquery.tooltip.css +++ /dev/null @@ -1,11 +0,0 @@ -#tooltip {
- position: absolute;
- z-index: 3000;
- border: 1px solid #111;
- background-color: #eee;
- padding-left: 5px;
- padding-right: 5px; - opacity: 0.85;
- font: 0.6em "Trebuchet MS", Arial;
- margin: 0; -}
diff --git a/libs/jquery/tooltip/jquery.tooltip.min.js b/libs/jquery/tooltip/jquery.tooltip.min.js deleted file mode 100644 index 7b3e7f16e5..0000000000 --- a/libs/jquery/tooltip/jquery.tooltip.min.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * jQuery Tooltip plugin 1.1 - * - * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ - * - * Copyright (c) 2006 Jörn Zaefferer, Stefan Petre - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id$ - * - */ -(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},block:function(){$.Tooltip.blocked=!$.Tooltip.blocked;}};$.fn.extend({Tooltip:function(settings){settings=$.extend({},$.Tooltip.defaults,settings);createHelper();return this.each(function(){this.tSettings=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(){if(helper.parent)return;helper.parent=$('<div id="tooltip"><h3></h3><div class="body"></div><div class="url"></div></div>').hide().appendTo('body');if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function handle(event){if(this.tSettings.delay)tID=setTimeout(show,this.tSettings.delay);else -show();track=!!this.tSettings.track;$('body').bind('mousemove',update);update(event);}function save(){if($.Tooltip.blocked||this==current||!this.tooltipText)return;current=this;title=this.tooltipText;if(this.tSettings.bodyHandler){helper.title.hide();helper.body.html(this.tSettings.bodyHandler.call(this)).show();}else if(this.tSettings.showBody){var parts=title.split(this.tSettings.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(this.tSettings.showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else -helper.url.hide();helper.parent.addClass(this.tSettings.extraClass);if(this.tSettings.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")){$('body').unbind('mousemove',update)}if(current==null){$('body').unbind('mousemove',update);return;}var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+current.tSettings.left;top=event.pageY+current.tSettings.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+current.tSettings.left;helper.parent.css({left:left+'px'});}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+current.tSettings.top;helper.parent.css({top:top+'px'});}}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(this.tSettings.extraClass);if(this.tSettings.fixPNG)helper.parent.unfixPNG();}})(jQuery);
\ No newline at end of file diff --git a/libs/jquery/tooltip/jquery.tooltip.pack.js b/libs/jquery/tooltip/jquery.tooltip.pack.js deleted file mode 100644 index ce4467e193..0000000000 --- a/libs/jquery/tooltip/jquery.tooltip.pack.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * jQuery Tooltip plugin 1.1 - * - * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ - * - * Copyright (c) 2006 Jörn Zaefferer, Stefan Petre - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id$ - * - */ -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($){n d={},l,f,u,O=$.29.1W&&/1S\\s(5\\.5|6\\.)/.1s(1o.28),F=16;$.p={q:16,13:{K:1I,V:U,M:"",t:15,w:15},1n:3(){$.p.q=!$.p.q}};$.Q.1f({p:3(a){a=$.1f({},$.p.13,a);1d();e 2.A(3(){2.8=a;2.N=2.f;$(2).1R("f");2.1Q=""}).1N(11,g).1J(g)},D:O?3(){e 2.A(3(){n b=$(2).m(\'I\');4(b.1z(/^k\\(["\']?(.*\\.1v)["\']?\\)$/i)){b=1t.$1;$(2).m({\'I\':\'1r\',\'S\':"1p:1m.1l.1k(1j=U, 27=24, 1g=\'"+b+"\')"}).A(3(){n a=$(2).m(\'1e\');4(a!=\'1X\'&&a!=\'1b\')$(2).m(\'1e\',\'1b\')})}})}:3(){e 2},1a:O?3(){e 2.A(3(){$(2).m({\'S\':\'\',I:\'\'})})}:3(){e 2},19:3(){e 2.A(3(){$(2)[$(2).z()?"j":"g"]()})},k:3(){e 2.1c(\'1V\')||2.1c(\'1g\')}});3 1d(){4(d.7)e;d.7=$(\'<o 1U="1T"><L></L><o 14="9"></o><o 14="k"></o></o>\').g().1P(\'9\');4($.Q.12)d.7.12();d.f=$(\'L\',d.7);d.9=$(\'o.9\',d.7);d.k=$(\'o.k\',d.7)}3 P(a){4(2.8.K)u=1M(j,2.8.K);B j();F=!!2.8.F;$(\'9\').1L(\'G\',r);r(a)}3 11(){4($.p.q||2==l||!2.N)e;l=2;f=2.N;4(2.8.Z){d.f.g();d.9.z(2.8.Z.1H(2)).j()}B 4(2.8.X){n a=f.1F(2.8.X);d.f.z(a.1E()).j();d.9.1C();1B(n i=0,H;H=a[i];i++){4(i>0)d.9.T("<1A/>");d.9.T(H)}d.9.19()}B{d.f.z(f).j();d.9.g()}4(2.8.V&&$(2).k())d.k.z($(2).k().1y(\'1D://\',\'\')).j();B d.k.g();d.7.1x(2.8.M);4(2.8.D)d.7.D();P.1w(2,1G)}3 j(){u=J;d.7.j();r()}3 r(c){4($.p.q)e;4(!F&&d.7.1u(":1K")){$(\'9\').W(\'G\',r)}4(l==J){$(\'9\').W(\'G\',r);e}n b=d.7[0].Y;n a=d.7[0].10;4(c){b=c.1q+l.8.w;a=c.1O+l.8.t;d.7.m({w:b+\'C\',t:a+\'C\'})}n v=R(),h=d.7[0];4(v.x+v.1i<h.Y+h.18){b-=h.18+20+l.8.w;d.7.m({w:b+\'C\'})}4(v.y+v.17<h.10+h.1h){a-=h.1h+20+l.8.t;d.7.m({t:a+\'C\'})}}3 R(){e{x:$(E).26(),y:$(E).25(),1i:$(E).23(),17:$(E).22()}}3 g(a){4($.p.q)e;4(u)21(u);l=J;d.7.g().1Z(2.8.M);4(2.8.D)d.7.1a()}})(1Y);',62,134,'||this|function|if|||parent|tSettings|body|||||return|title|hide|||show|url|current|css|var|div|Tooltip|blocked|update||top|tID||left|||html|each|else|px|fixPNG|window|track|mousemove|part|backgroundImage|null|delay|h3|extraClass|tooltipText|IE|handle|fn|viewport|filter|append|true|showURL|unbind|showBody|offsetLeft|bodyHandler|offsetTop|save|bgiframe|defaults|class||false|cy|offsetWidth|hideWhenEmpty|unfixPNG|relative|attr|createHelper|position|extend|src|offsetHeight|cx|enabled|AlphaImageLoader|Microsoft|DXImageTransform|block|navigator|progid|pageX|none|test|RegExp|is|png|apply|addClass|replace|match|br|for|empty|http|shift|split|arguments|call|200|click|visible|bind|setTimeout|hover|pageY|appendTo|alt|removeAttr|MSIE|tooltip|id|href|msie|absolute|jQuery|removeClass||clearTimeout|height|width|crop|scrollTop|scrollLeft|sizingMethod|userAgent|browser'.split('|'),0,{}))
\ No newline at end of file |