Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * jQuery mousehold plugin - fires an event while the mouse is clicked down.
- * Additionally, the function, when executed, is passed a single
- * argument representing the count of times the event has been fired during
- * this session of the mouse hold.
- *
- * @author Remy Sharp (leftlogic.com)
- * @date 2006-12-15
- * @example $("img").mousehold(200, function(i){ })
- * @desc Repeats firing the passed function while the mouse is clicked down
- *
- * @name mousehold
- * @type jQuery
- * @param Number timeout The frequency to repeat the event in milliseconds
- * @param Function fn A function to execute
- * @cat Plugin
- */
- jQuery.fn.mousehold = function(timeout, f) {
- if (timeout && typeof timeout == 'function') {
- f = timeout;
- timeout = 100;
- }
- if (f && typeof f == 'function') {
- var timer = 0;
- var fireStep = 0;
- return this.each(function() {
- jQuery(this).mousedown(function() {
- fireStep = 1;
- var ctr = 0;
- timer = setInterval(function() {
- ctr++;
- f.call(this, ctr);
- fireStep = 2;
- }, timeout);
- })
- clearMousehold = function() {
- clearInterval(timer);
- if (fireStep == 1) f.call(this, 1);
- fireStep = 0;
- }
- jQuery(this).mouseout(clearMousehold);
- jQuery(this).mouseup(clearMousehold);
- })
- }
- }
- /*
- FILE ARCHIVED ON 19:26:43 Mar 22, 2007 AND RETRIEVED FROM THE
- INTERNET ARCHIVE ON 12:09:59 Jul 12, 2019.
- JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
- ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
- SECTION 108(a)(3)).
- */
- /*
- playback timings (ms):
- LoadShardBlock: 89.01 (3)
- esindex: 0.005
- captures_list: 259.465
- CDXLines.iter: 13.582 (3)
- PetaboxLoader3.datanode: 96.816 (4)
- exclusion.robots: 129.595
- xauthn.chkprivs: 0.055
- exclusion.robots.policy: 129.58
- RedisCDXSource: 2.629
- PetaboxLoader3.resolve: 38.856
- xauthn.identify: 129.271
- load_resource: 49.372
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement