PageSourceSearch

https://www.countryclubfitness.com/libraries/cegcore/assets/gplugins/gtooltip/gtooltip.js

js countryclubfitness.com collected 2026-10-08 21:43:28 UTC 7,047 bytes, 179 lines download raw bytes

1(function($){
2	var GTooltip = {
3		'tipclass' : 'gtooltip',
4		'awaytime': 800,
5		'ajax_cache': {},
6		'append': 'after',
7		'ajaxloading': 'Loading....',
8		'position':'top',
9		'ontime': 0,
10		'closable':0,
11	};
12	
13	$.fn.gtooltip_tipref = function(tipclass){
14		var $this = $(this);
15		if(typeof tipclass == 'undefined'){
16			var tipclass = $this.data('gtooltip_params').tipclass;
17		}
18		return tipclass.replace(/ /, '');
19	};
20	
21	$.fn.gtooltip_return = function(tipclass){
22		var $this = $(this);
23		if(typeof tipclass == 'undefined'){
24			var tipclass = $this.data('gtooltip_params').tipclass;
25		}
26		if(typeof $this.data('gtooltip-tips') != 'undefined' && typeof $this.data('gtooltip-tips')[$this.gtooltip_tipref(tipclass)] != 'undefined'){
27			return $this.data('gtooltip-tips')[$this.gtooltip_tipref(tipclass)];
28		}else{
29			return $();	
30		}
31		//return $this.next('.gtooltip');
32	};
33
34	$.fn.gtooltip = function(option, tipclass){
35		if(!$(this).length){
36			return false;	
37		}
38		$.each($(this), function(i, elem){
39			var $this = $(elem);
40			if(!$this.data('gtooltip_params')){
41				$this.data('gtooltip_params', $.extend({}, GTooltip));
42			}
43			if($.type(option) == 'string'){
44				if(option == 'show'){// && ($this.gtooltip_return().length < 1 || !($this.gtooltip_tipref() in $this.data('gtooltip-tips')))){//$this.next('.gtooltip').attr('class') != $this.data('gtooltip_params').tipclass)){
45					if($this.data('gtooltip-tips')){
46						if(!($this.gtooltip_tipref() in $this.data('gtooltip-tips'))){
47							//remove an existing tip which has a different class
48							$this.gtooltip('destroy');
49						}
50						if(($this.gtooltip_tipref() in $this.data('gtooltip-tips'))){
51							//similar tip exists, so return
52							return;
53						}
54					}
55					//check ajax data
56					if($this.data('ajax')){
57						if(GTooltip[$this.data('ajax')]){
58							$this.data('content', GTooltip[$this.data('ajax')]);
59						}else{
60							$this.data('content', $this.data('gtooltip_params').ajaxloading);
61							$.ajax({
62								"type" : "GET",
63								"url" : $this.data('ajax'),
64								"cache" : true,
65								"success" : function(res){
66									$this.data('content', res);
67									$this.gtooltip('destroy');
68									$this.gtooltip('render');
69									GTooltip[$this.data('ajax')] = res;
70								},
71							});
72						}
73					}
74					$this.gtooltip('render');
75				}
76				if(option == 'render'){
77					var tip_content = $this.prop('title');
78					if($this.data('content')){
79						tip_content = $this.data('content');
80					}else{
81						$this.data('content', $this.prop('title'));
82						$this.prop('title', '');
83					}
84					if($this.data('gtooltip_params').closable){
85						var $close_button = '<div class="gtooltip-close">x</div>';
86					}else{
87						var $close_button = '';	
88					}
89					var $tip = $('<div class="'+$this.data('gtooltip_params').tipclass+'">'+$close_button+'<div class="gtooltip-content">'+tip_content+'</div><div class="gtooltip-arrow-border gtooltip-arrow-border-'+$this.data('gtooltip_params').position+'"></div><div class="gtooltip-arrow gtooltip-arrow-'+$this.data('gtooltip_params').position+'"></div></div>');
90					var $offset = $this.offset();
91					var $position = $this.position();
92					if($this.data('gtooltip-target')){
93						var $offset = $this.data('gtooltip-target').offset();
94						var $position = $this.data('gtooltip-target').position();
95					}
96					var $location;
97					if($this.data('gtooltip_params').append == 'after'){
98						$this.after($tip);
99						$location = $position;
100					}else if($this.data('gtooltip_params').append == 'body'){
101						$('body').append($tip);
102						$location = $offset;
103					}
104					if($this.data('gtooltip_params').position == 'top'){
105						var $top = $location.top - $tip.outerHeight() - 10;//$tip.find('.gtooltip-arrow-border').outerHeight()/2;
106						var $left = $location.left + $this.outerWidth()/2 - 30 - 10;
107					}else if($this.data('gtooltip_params').position == 'bottom'){
108						var $top = $location.top + $this.outerHeight() + 10;//$tip.find('.gtooltip-arrow-border').outerHeight()/2;
109						var $left = $location.left + $this.outerWidth()/2 - 30 - 10;
110					}else if($this.data('gtooltip_params').position == 'right'){
111						var $top = $location.top + $this.outerHeight()/2 - $tip.outerHeight()/2;
112						var $left = $location.left + $this.outerWidth() + 10;//$tip.find('.gtooltip-arrow-border').outerWidth()/2;
113						$tip.find('.gtooltip-arrow-border').css('top', $tip.outerHeight()/2 - 10);
114						$tip.find('.gtooltip-arrow').css('top', $tip.outerHeight()/2 - 10);
115					}else if($this.data('gtooltip_params').position == 'left'){
116						var $top = $location.top + $this.outerHeight()/2 - $tip.outerHeight()/2;
117						var $left = $location.left - $tip.outerWidth() - 10;//$tip.find('.gtooltip-arrow-border').outerWidth()/2;
118						$tip.find('.gtooltip-arrow-border').css('top', $tip.outerHeight()/2 - 10);
119						$tip.find('.gtooltip-arrow').css('top', $tip.outerHeight()/2 - 10);
120					}
121					$tip.css('top', $top);
122					//$tip.css('left', $this.outerWidth()/2 - 30 - 10); //element width - tooltip arrow left shift - arrow's border width
123					$tip.css('left', $left);
124					
125					$tip.find('.gtooltip-close').on('click', function(){
126						$this.gtooltip('destroy');
127					});
128					
129					var tip_ref = $this.gtooltip_tipref();
130					if(!$this.data('gtooltip-tips')){
131						$this.data('gtooltip-tips', {});
132					}
133					$this.data('gtooltip-tips')[tip_ref] = $tip;
134				}
135				if(option == 'destroy'){
136					$this.gtooltip_return(tipclass).remove();
137					if(typeof $this.data('gtooltip-tips') != 'undefined' && typeof $this.data('gtooltip-tips')[$this.gtooltip_tipref(tipclass)] != 'undefined'){
138						delete $this.data('gtooltip-tips')[$this.gtooltip_tipref(tipclass)];
139					}
140				}
141				if(option == 'return'){
142					return $this.gtooltip_return();
143				}
144				if(option == 'hover'){
145					$this.on('mouseover', function(){
146						clearTimeout($this.data('gtooltip-awaytime'));
147						//$this.gtooltip('show');
148						var ontime_timeout = setTimeout(function(){
149							$this.gtooltip('show');
150							$this.gtooltip_return().on('mouseover', function(){
151								clearTimeout($this.data('gtooltip-awaytime'));
152							});
153							$this.gtooltip_return().on('mouseleave', function(){
154								var awaytime_timeout = setTimeout(function(){
155									$this.gtooltip('destroy');
156								}, $this.data('gtooltip_params').awaytime);
157								$this.data('gtooltip-awaytime', awaytime_timeout);
158							});
159						}, $this.data('gtooltip_params').ontime);
160						$this.data('gtooltip-ontime', ontime_timeout);
161					});
162					$this.on('mouseleave', function(){
163						clearTimeout($this.data('gtooltip-ontime'));
164						var awaytime_timeout = setTimeout(function(){
165							$this.gtooltip('destroy');
166						}, $this.data('gtooltip_params').awaytime);
167						$this.data('gtooltip-awaytime', awaytime_timeout);
168						//$this.gtooltip('destroy');
169					});
170				}
171			}else if($.type(option) == 'object'){
172				/*$.each(option, function(k, v){
173					$this.gtooltip_params[k] = v;
174				});*/
175				$this.data('gtooltip_params', $.extend({}, GTooltip, option));
176			}
177		});
178	}
179}(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.