PageSourceSearch

https://peopleimages.com/js/tooltip.js?2688

js peopleimages.com collected 2026-10-01 11:28:21 UTC 2,626 bytes, 72 lines download raw bytes

1/**
2* Just a simple AWESOME tooltip
3* @author Slavic Dragovtev [[email protected]]
4*/
5function Tooltip(e,html,options){
6    var defaults = {
7        maxwidth: 160,
8        width: '',
9        purgatory: 300, // milliseconds one has to get to the choppa' before the tooltip disappears
10        top_offset: 29,
11        left_offset: 0,
12        arrow: false
13    }
14    var trigger = e
15    $.extend(defaults,options, $(e).data())
16    $('#tooltip').remove()  // any existing..
17    var ttThis = this,
18    offset = $(trigger).offset();
19    if(offset == null) return false; //page not fully loaded, return false
20    // Append the tooltip
21    $('body').append('<div id="tooltip" class="tooltip">' + html + '</div>');
22    var tt = $('#tooltip')
23    tt.css('max-width',defaults.maxwidth +'px').css('position','absolute')
24        .css('width', defaults.width + 'px')
25    // Set the coordinates of the tooltip
26    var top = offset.top + defaults.top_offset,
27    left = offset.left + defaults.left_offset + $(trigger).width()/2 - tt.width()/2;
28    scrollpoint_x = $(window).width() + $(window).scrollLeft();
29    //fix tooltip overlapping outside the page on the right side
30    if(left+tt.width() > scrollpoint_x) left = scrollpoint_x - tt.width();
31    //fix tooltip overlapping outside the page on the left side
32    if(left < $(window).scrollLeft()) left = $(window).scrollLeft();
33
34    tt.css('top', top);
35    tt.css('left', left);
36
37    //Tooltip arrow
38    if(defaults.arrow) {
39        var pos = defaults.arrow.split('-');
40        if(pos[0]=='top'||pos[0]=='bottom')var adjust_pos = 'left';
41        else var adjust_pos = 'top';
42        var adjust = (pos[1]) ? pos[1] :
43            adjust_pos == 'left' ? $('#tooltip').width()/2 - 10 : ($('#tooltip').height()+9)/2-10;
44        var style = ' style="'+adjust_pos+':'+parseInt(adjust)+'px"';
45        var arrow = '<div class="arrow '+pos[0]+'"'+style+'></div>';
46        $('#tooltip').append(arrow);
47    }
48
49    // Set the z-index so it's pretty much the upper most layer
50    tt.css('z-index',10000)
51    $(trigger).mouseleave(function(){
52        window.setTimeout(function(){
53            if(!ttThis.isHovered || defaults.purgatory == 0){
54                if (defaults.deleteCallback){
55                    defaults.deleteCallback(ttThis,tt)
56                }
57                $(tt).remove()
58            }
59        },defaults.purgatory)
60    })
61    $(tt).hover(
62        function(){
63            ttThis.isHovered = true;
64        },
65        function(){
66            if (defaults.deleteCallback ){
67                defaults.deleteCallback(this,tt)
68            }
69            $(this).remove()
70        }
71    )
72}

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.