PageSourceSearch

https://risen2.ru/includes/js/jquery.tooltip.js

js risen2.ru collected 2026-10-02 19:25:46 UTC 8,662 bytes, 306 lines download raw bytes

1function loadComments(numOfComments)
2{
3    var lastCom = parseInt($('#tooltiper').attr('lastComment')); // - èç äèâà/ïîëÿ ñ êîììåíòàìè áåð¸ì íîìåð ïîñëåäíåãî êîììåíòà/èõ êîë-âî. Ìîæíî äëÿ ýòîãî ôåéê-ñâîéñòâî ñîçäàòü è ìåíÿòü åãî.
4    $.post('block_comments.php', {commNumber : numOfComments, lastComment : lastCom} , function(data) {
5		$("#tooltiper").hide().fadeOut(300);
6		$("#loadericon").show();
7		$("#tooltiper").fadeIn(300).html(data);
8		$("#loadericon").hide();
9		lastCom += parseInt(numOfComments);
10        $('#tooltiper').attr('lastComment', lastCom);
11        });
12}
13/*
14 * jQuery Tooltip plugin 1.3
15 *
16 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
17 * http://docs.jquery.com/Plugins/Tooltip
18 *
19 * Copyright (c) 2006 - 2008 Jörn Zaefferer
20 *
21 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
22 * 
23 * Dual licensed under the MIT and GPL licenses:
24 *   http://www.opensource.org/licenses/mit-license.php
25 *   http://www.gnu.org/licenses/gpl.html
26 */
27 
28;(function($) {
29	
30		// the tooltip element
31	var helper = {},
32		// the current tooltipped element
33		current,
34		// the title of the current element, used for restoring
35		title,
36		// timeout id for delayed tooltips
37		tID,
38		// IE 5.5 or 6
39		IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
40		// flag for mouse tracking
41		track = false;
42	
43	$.tooltip = {
44		blocked: false,
45		defaults: {
46			delay: 200,
47			fade: false,
48			showURL: true,
49			extraClass: "",
50			top: 15,
51			left: 15,
52			id: "tooltip"
53		},
54		block: function() {
55			$.tooltip.blocked = !$.tooltip.blocked;
56		}
57	};
58	
59	$.fn.extend({
60		tooltip: function(settings) {
61			settings = $.extend({}, $.tooltip.defaults, settings);
62			createHelper(settings);
63			return this.each(function() {
64					$.data(this, "tooltip", settings);
65					this.tOpacity = helper.parent.css("opacity");
66					// copy tooltip into its own expando and remove the title
67					this.tooltipText = this.title;
68					$(this).removeAttr("title");
69					// also remove alt attribute to prevent default tooltip in IE
70					this.alt = "";
71				})
72				.mouseover(save)
73				.mouseout(hide)
74				.click(hide);
75		},
76		fixPNG: IE ? function() {
77			return this.each(function () {
78				var image = $(this).css('backgroundImage');
79				if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
80					image = RegExp.$1;
81					$(this).css({
82						'backgroundImage': 'none',
83						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
84					}).each(function () {
85						var position = $(this).css('position');
86						if (position != 'absolute' && position != 'relative')
87							$(this).css('position', 'relative');
88					});
89				}
90			});
91		} : function() { return this; },
92		unfixPNG: IE ? function() {
93			return this.each(function () {
94				$(this).css({'filter': '', backgroundImage: ''});
95			});
96		} : function() { return this; },
97		hideWhenEmpty: function() {
98			return this.each(function() {
99				$(this)[ $(this).html() ? "show" : "hide" ]();
100			});
101		},
102		url: function() {
103			return this.attr('href') || this.attr('src');
104		}
105	});
106	
107	function createHelper(settings) {
108		// there can be only one tooltip helper
109		if( helper.parent )
110			return;
111		// create the helper, h3 for title, div for url
112		helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>')
113			// add to document
114			.appendTo(document.body)
115			// hide it at first
116			.hide();
117			
118		// apply bgiframe if available
119		if ( $.fn.bgiframe )
120			helper.parent.bgiframe();
121		
122		// save references to title and url elements
123		helper.title = $('h3', helper.parent);
124		helper.body = $('div.body', helper.parent);
125		helper.url = $('div.url', helper.parent);
126	}
127	
128	function settings(element) {
129		return $.data(element, "tooltip");
130	}
131	
132	// main event handler to start showing tooltips
133	function handle(event) {
134		// show helper, either with timeout or on instant
135		if( settings(this).delay )
136			tID = setTimeout(show, settings(this).delay);
137		else
138			show();
139		
140		// if selected, update the helper position when the mouse moves
141		track = !!settings(this).track;
142		$(document.body).bind('mousemove', update);
143			
144		// update at least once
145		update(event);
146	}
147	
148	// save elements title before the tooltip is displayed
149	function save() {
150		// if this is the current source, or it has no title (occurs with click event), stop
151		if ( $.tooltip.blocked || this == current || (!this.tooltipText && !sett
151ings(this).bodyHandler) )
152			return;
153
154		// save current
155		current = this;
156		title = this.tooltipText;
157		
158		if ( settings(this).bodyHandler ) {
159			helper.title.hide();
160			var bodyContent = settings(this).bodyHandler.call(this);
161			if (bodyContent.nodeType || bodyContent.jquery) {
162				helper.body.empty().append(bodyContent)
163			} else {
164				helper.body.html( bodyContent );
165			}
166			helper.body.show();
167		} else if ( settings(this).showBody ) {
168			var parts = title.split(settings(this).showBody);
169			helper.title.html(parts.shift()).show();
170			helper.body.empty();
171			for(var i = 0, part; (part = parts[i]); i++) {
172				if(i > 0)
173					helper.body.append("<br/>");
174				helper.body.append(part);
175			}
176			helper.body.hideWhenEmpty();
177		} else {
178			helper.title.html(title).show();
179			helper.body.hide();
180		}
181		
182		// if element has href or src, add and show it, otherwise hide it
183		if( settings(this).showURL && $(this).url() )
184			helper.url.html( $(this).url().replace('http://', '') ).show();
185		else 
186			helper.url.hide();
187		
188		// add an optional class for this tip
189		helper.parent.addClass(settings(this).extraClass);
190
191		// fix PNG background for IE
192		if (settings(this).fixPNG )
193			helper.parent.fixPNG();
194			
195		handle.apply(this, arguments);
196	}
197	
198	// delete timeout and show helper
199	function show() {
200		tID = null;
201		if ((!IE || !$.fn.bgiframe) && settings(current).fade) {
202			if (helper.parent.is(":animated"))
203				helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity);
204			else
205				helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade);
206		} else {
207			helper.parent.show();
208		}
209		update();
210	}
211	
212	/**
213	 * callback for mousemove
214	 * updates the helper position
215	 * removes itself when no current element
216	 */
217	function update(event)	{
218		if($.tooltip.blocked)
219			return;
220		
221		if (event && event.target.tagName == "OPTION") {
222			return;
223		}
224		
225		// stop updating when tracking is disabled and the tooltip is visible
226		if ( !track && helper.parent.is(":visible")) {
227			$(document.body).unbind('mousemove', update)
228		}
229		
230		// if no current element is available, remove this listener
231		if( current == null ) {
232			$(document.body).unbind('mousemove', update);
233			return;	
234		}
235		
236		// remove position helper classes
237		helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
238		
239		var left = helper.parent[0].offsetLeft;
240		var top = helper.parent[0].offsetTop;
241		if (event) {
242			// position the helper 15 pixel to bottom right, starting from mouse position
243			left = event.pageX + settings(current).left;
244			top = event.pageY + settings(current).top;
245			var right='auto';
246			if (settings(current).positionLeft) {
247				right = $(window).width() - left;
248				left = 'auto';
249			}
250			helper.parent.css({
251				left: left,
252				right: right,
253				top: top
254			});
255		}
256		
257		var v = viewport(),
258			h = helper.parent[0];
259		// check horizontal position
260		if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
261			left -= h.offsetWidth + 20 + settings(current).left;
262			helper.parent.css({left: left + 'px'}).addClass("viewport-right");
263		}
264		// check vertical position
265		if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
266			top -= h.offsetHeight + 20 + settings(current).top;
267			helper.parent.css({top: top + 'px'}).addClass("viewport-bottom");
268		}
269	}
270	
271	function viewport() {
272		return {
273			x: $(window).scrollLeft(),
274			y: $(window).scrollTop(),
275			cx: $(window).width(),
276			cy: $(window).height()
277		};
278	}
279	
280	// hide helper and restore added classes and the title
281	function hide(event) {
282		if($.tooltip.blocked)
283			return;
284		// clear timeout if possible
285		if(tID)
286			clearTimeout(tID);
287		// no more current element
288		current = null;
289		
290		var tsettings = settings(this);
291		function complete() {
292			helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", "");
293		}
294		if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
295			if (helper.parent.is(':animated'))
296				helper.parent.stop().fadeTo(tsettings.fade, 0, complete);
297			else
298				helper.parent.stop().fadeOut(tsettings.fade, complete);
299		} else
300			complete();
301		
302		if( settings(this).fixPNG )
303			helper.parent.unfixPNG();
304	}
305	
306})(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.