PageSourceSearch

https://www.efficiencymaine.com/wp-content/themes/Office/js/jquery.tipsy.js?ver=1.0

js efficiencymaine.com collected 2026-10-02 04:51:36 UTC 4,634 bytes, 109 lines download raw bytes

1// tipsy, facebook style tooltips for jquery
2// version 1.0.0a
3// (c) 2008-2010 jason frame [[email protected]]
4// released under the MIT license
5
6(function($) {
7    $.fn.tipsy = function(options) {
8
9        options = $.extend({}, $.fn.tipsy.defaults, options);
10        
11        return this.each(function() {
12            
13            var opts = $.fn.tipsy.elementOptions(this, options);
14            
15            $(this).hover(function() {
16
17                $.data(this, 'cancel.tipsy', true);
18
19                var tip = $.data(this, 'active.tipsy');
20                if (!tip) {
21                    tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>');
22                    tip.css({position: 'absolute', zIndex: 100000});
23                    $.data(this, 'active.tipsy', tip);
24                }
25
26                if ($(this).attr('title') || typeof($(this).attr('original-title')) != 'string') {
27                    $(this).attr('original-title', $(this).attr('title') || '').removeAttr('title');
28                }
29
30                var title;
31                if (typeof opts.title == 'string') {
32                    title = $(this).attr(opts.title == 'title' ? 'original-title' : opts.title);
33                } else if (typeof opts.title == 'function') {
34                    title = opts.title.call(this);
35                }
36
37                tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback);
38
39                var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight});
40                tip.get(0).className = 'tipsy'; // reset classname in case of dynamic gravity
41                tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
42                var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight;
43                var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(this) : opts.gravity;
44
45                switch (gravity.charAt(0)) {
46                    case 'n':
47                        tip.css({top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-north');
48                        break;
49                    case 's':
50                        tip.css({top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-south');
51                        break;
52                    case 'e':
53                        tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}).addClass('tipsy-east');
54                        break;
55                    case 'w':
56                        tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}).addClass('tipsy-west');
57                        break;
58                }
59
60                if (opts.fade) {
61                    tip.css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: 0.8});
62                } else {
63                    tip.css({visibility: 'visible'});
64                }
65
66            }, function() {
67                $.data(this, 'cancel.tipsy', false);
68                var self = this;
69                setTimeout(function() {
70                    if ($.data(this, 'cancel.tipsy')) return;
71                    var tip = $.data(self, 'active.tipsy');
72                    if (opts.fade) {
73                        tip.stop().fadeOut(function() { $(this).remove(); });
74                    } else {
75                        tip.remove();
76                    }
77                }, 100);
78
79            });
80            
81        });
82        
83    };
84    
85    // Overwrite this method to provide options on a per-element basis.
86    // For example, you could store the gravity in a 'tipsy-gravity' attribute:
87    // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
88    // (remember - do not modify 'options' in place!)
89    $.fn.tipsy.elementOptions = function(ele, options) {
90        return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
91    };
92    
93    $.fn.tipsy.defaults = {
94        fade: false,
95        fallback: '',
96        gravity: 'n',
97        html: false,
98        title: 'title'
99    };
100    
101    $.fn.tipsy.autoNS = function() {
102        return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
103    };
104    
105    $.fn.tipsy.autoWE = function() {
106        return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
107    };
108    
109})(jQuery);

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.