1jQuery.fn.tooltip = function(options){ 2 var defaults = { 3 offset: [0,0], 4 decalageIE: [0, 0], 5 speed: 200, 6 slide: 5, 7 wait: 250, 8 position: 'top' 9 }; 10 11 options = jQuery.extend(defaults, options); 12 13 jQuery(this).each(function(){ 14 var me = jQuery(this); 15 var tip = me.parent().next(); 16 var timer = null, timerWait = null; 17 18 var getPosition = function () { 19 var offset = me.offset(); 20 var ret = {}; 21 if (options.position == 'top' || options.position == 'bottom') { 22 ret.left = offset.left - (tip.outerWidth() / 2) + (me.outerWidth() / 2); 23 if (options.position == 'top') { 24 ret.top = offset.top - tip.outerHeight(); 25 } 26 else { 27 ret.top = offset.top + me.outerHeight(); 28 } 29 } 30 else { 31 ret.top = offset.top; 32 if (options.position == 'right') { 33 ret.left = offset.left + me.outerWidth(); 34 } 35 else { 36 ret.left = offset.left - tip.outerWidth(); 37 } 38 } 39 ret.top += options.offset[0]; 40 ret.left += options.offset[1]; 41 return ret; 42 }; 43 44 var showTooltip = function () { 45 var pos = getPosition(); 46 tip.css({ 47 'top': pos.top + (tip.is(':hidden') ? options.slide : 0), 48 'left': pos.left, 49 'position': 'absolute', 50 'display': 'block' 51 }); 52 tip.animate({'top': pos.top, 'opacity': 1}, options.speed); 53 }; 54 55 jQuery([this, tip[0]]).hover(function() { 56 if (timer != null) { 57 clearTimeout(timer); 58 } 59 tip.stop(true, true); 60 if (this == me[0]) { 61 timerWait = setTimeout(showTooltip, options.wait); 62 } 63 else { 64 if (timerWait != null) { 65 clearTimeout(timerWait); 66 } 67 showTooltip(); 68 } 69 }, 70 function() { 71 if (timerWait != null) { 72 clearTimeout(timerWait); 73 } 74 timer = setTimeout(function () { 75 var pos = getPosition(); 76 tip.stop(true, true).animate({'top':pos.top-options.slide,'opacity':0}, 77 options.speed, function () { tip.css('display', 'none'); }); 78 }, 100); 79 } 80 ); 81 }); 82}; 83jQuery(function () { 84 jQuery("#tooltipGo").tooltip({ 85 offset: [-30, 0], 86 position: 'right' 87 }); 88 jQuery("#tooltipGratuit").tooltip({ 89 offset: [0, -38] 90 }); 91});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.