-
Notifications
You must be signed in to change notification settings - Fork 0
/
tg.js
155 lines (143 loc) · 4.96 KB
/
tg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// ORIGINAL
// titleGrabber - roXon
(function( $ ){
$.fn.tg = function() {
// **** div tG setup
$(document).mousemove(function(mTG){
$("#tG").css({
top:(mTG.pageY+12)+"px",
left:(mTG.pageX+15)+"px"
});
});
$('body').append('<div id="tG"></div>');
if ( $.browser.msie ) { $('#tG').css({background:'#000'}); }
if ( $.browser.msie && $.browser.version.substr(0,1)<7 ) { $('#tG').css({width:'150px'}); };
// **** titleGrabber
var $this = $(this);
$this.live("mouseover mouseout",function(ev){
var el = $(this);
if ( el.attr('title') ) {
if (ev.type === 'mouseover'){
el.data('tt',el.attr('title')).attr('title','');
elSrc = '';
if( el.attr('src') ){
var imgSrc = el.attr('src');
var elSrc = '<img src="'+imgSrc+'"style="height:13px;"/>';
}
$('#tG').html( elSrc +' '+ el.data('tt')).stop(true,true).slideToggle(300);
}
}
else {
$('#tG').hide().html('');
el.attr('title',el.data('tt'));
}
});
// ****
};
})( jQuery );
// DUPLICATE OF ORIGINAL IN A SEPARATE NAMESPACE TO SOLVE PROBLEM WITH SPAN WITHIN A
(function( $ ){
$.fn.tgDuplicate = function() {
// **** div tG setup
$(document).mousemove(function(mTG){
$("#tGDuplicate").css({
top:(mTG.pageY+12)+"px",
left:(mTG.pageX+15)+"px"
});
});
$('body').append('<div id="tGDuplicate"></div>');
if ( $.browser.msie ) { $('#tGDuplicate').css({background:'#000'}); }
if ( $.browser.msie && $.browser.version.substr(0,1)<7 ) { $('#tGDuplicate').css({width:'150px'}); };
// **** titleGrabber
var $this = $(this);
$this.live("mouseover mouseout",function(ev){
var el = $(this);
if ( el.attr('title') ) {
if (ev.type === 'mouseover'){
el.data('tt',el.attr('title')).attr('title','');
elSrc = '';
if( el.attr('src') ){
var imgSrc = el.attr('src');
var elSrc = '<img src="'+imgSrc+'"style="height:13px;"/>';
}
$('#tGDuplicate').html( elSrc +' '+ el.data('tt')).stop(true,true).slideToggle(300);
}
}
else {
$('#tGDuplicate').hide().html('');
el.attr('title',el.data('tt'));
}
});
// ****
};
})( jQuery );
// DUPLICATE OF ORIGINAL WITH SOME CHANGED TO MAKE TOOLTIP CLICKABLE
var gloBooTGSelected = 0, gloBooElSelected = 0,gloIntX, gloIntY, gloDivSelected;
//var t = new Date();var tStart=t.getTime();
function delayedFunc(){
if (gloBooTGSelected==0&&gloBooElSelected==0) {
//var t = new Date();console.log('['+(t.getTime()-tStart)+'] '+'delayedFunc start hide');
$('#tGClickable').hide().html('');
gloDivSelected.attr('title',gloDivSelected.data('tt'));
//var t = new Date();console.log('['+(t.getTime()-tStart)+'] '+'delayedFunc finished hide');
}
}
(function( $ ){
$.fn.tgClickable = function() {
// **** div tG setup
$(document).mousemove(function(mTG){
$("#tGClickable").css({
// top:(mTG.pageY+12)+"px",
// left:(mTG.pageX+15)+"px"
top:(gloIntY+12)+"px",
left:(gloIntX-10)+"px"
});
});
$('body').append('<div id="tGClickable"></div>');
if ( $.browser.msie ) { $('#tGClickable').css({background:'#000'}); }
if ( $.browser.msie && $.browser.version.substr(0,1)<7 ) { $('#tGClickable').css({width:'150px'}); };
// **** titleGrabber
var $this = $(this);
$this.live("mouseover mouseout",function(ev){
var el = $(this);
if (ev.type === 'mouseover'){gloBooElSelected = 1;}
if ( el.attr('title')) {
if (ev.type === 'mouseover'){
gloDivSelected = el;
el.data('tt',el.attr('title')).attr('title','');
elSrc = '';
if( el.attr('src') ){
var imgSrc = el.attr('src');
var elSrc = '<img src="'+imgSrc+'"style="height:13px;"/>';
}
//var t = new Date();console.log("["+(t.getTime()-tStart)+"] "+"el."+ev.type+" start unhide");
$('#tGClickable').html( elSrc +' '+ el.data('tt')).stop(true,true).slideToggle(300);
//var t = new Date();console.log("["+(t.getTime()-tStart)+"] "+"el."+ev.type+" finished unhide");
gloIntX = el[0].offsetLeft;
gloIntY = el[0].offsetTop;
}
}
else {
if (ev.type === 'mouseout'){
gloBooElSelected = 0;
if(gloDivSelected){setTimeout("delayedFunc();", 50);};
}
}
//var t = new Date();console.log("["+(t.getTime()-tStart)+"] "+"el."+ev.type+" gloBooTGSelected:"+gloBooTGSelected+" gloBooElSelected:"+gloBooElSelected+", tgvisible: "+$('#tGClickable').is(":visible"));
// }
});
$('#tGClickable').live("mouseover mouseout",function(ev){
if (ev.type === 'mouseover'){
gloBooTGSelected = 1;
}else{
gloBooTGSelected = 0;
if($('#tGClickable').is(":visible")){
if(gloDivSelected){setTimeout("delayedFunc();", 200);};
}
}
// }
//var t = new Date();console.log("["+(t.getTime()-tStart)+"] "+"TG."+ev.type+" gloBooTGSelected:"+gloBooTGSelected+" gloBooElSelected:"+gloBooElSelected+", tgvisible: "+$('#tGClickable').is(":visible"));
});
// ****
};
})( jQuery );