PageSourceSearch

https://www.archivistes.qc.ca/global/javascript/jquery.eventTimeout.js

js archivistes.qc.ca collected 2026-09-24 22:04:18 UTC 1,604 bytes, 70 lines download raw bytes

1(function($) 
2{
3    $.eventTimeout = { version: '1' };
4
5    $.fn.extend(
6		{
7			eventTimeout : 
8				function (options)
9				{
10					switch (options)
11					{
12						case 'trigger' :
13							if ($(this).data('events'))
14								$(this).trigger($(this).data('events'));
15							return;
16							break;
17					}
18
19					var defaults =	{
20						delay : 300,
21						events : typeof $.browser != 'undefined' && $.browser.msie == true && parseInt($.browser.version, 10) <= 8 ? 'change keyup focusout' : 'input',
22						each : false,
23						callback : function () {}
24					};
25
26					var opts = $.extend(defaults, options);
27
28					var last = false;
29					
30					var func = 
31						function (event)
32						{
33														
34							if (opts.each)
35								$(this).data('last', new Date().getTime());
36							else
37								last = new Date().getTime();
38						
39							var _this = $(this);
40	
41							setTimeout(function () { _this.checkElapsed(opts.delay, opts.callback, opts.each, last, event); }, opts.delay);
42						};
43					
44					$(this).data('events', opts.events).on(opts.events, func);
45					
46					if (opts.events.indexOf('input') != -1)
47					{
48						$(this).each(
49							function ()
50							{
51								if ($(this).is('select, input[type="checkbox"], input[type="radio"], input[type="file"]'))
52									$(this).change(func);
53							}
54						);
55					}
56					
57					return $(this);
58				},
59			
60			checkElapsed :
61				function (delay, callback, lastOnElem, last, event)
62				{
63					var elapsed = new Date().getTime() - (lastOnElem ? $(this).data('last') : last);
64					
65					if (elapsed >= delay)
66						callback($(this), event);
67				}
68	    }
69	);
70})(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.