1// jQuery Hover Delay 1.1.0 (20130401) 2// By John Terenzio | http://terenz.io/ | MIT License 3(function($) { 4 5 'use strict'; 6 7 // original hover method 8 var oldHover = $.fn.hover, 9 10 // enhanced hover method 11 newHover = function(handlerIn, handlerOut, delay) { 12 13 return this.each(function() { 14 15 var timeout, 16 17 handler = function(el, fn, e) { 18 if (timeout) { 19 timeout = window.clearTimeout(timeout); // also set timeout to undefined 20 } else { 21 timeout = window.setTimeout(function() { 22 timeout = undefined; 23 fn.call(el, e); 24 }, delay); 25 } 26 }; 27 28 $(this).on('mouseenter mouseleave', function(e) { 29 handler(this, e.type === 'mouseenter' ? handlerIn : handlerOut, e); 30 }); 31 32 }); 33 34 }; 35 36 // call either original hover method or new hover method depending on 37 // whether a delay argurment was passed, can take one or two handlers 38 $.fn.hover = function(/* arguments */) { 39 40 var args = Array.prototype.slice.call(arguments); 41 42 if (args.length === 3 && typeof args[2] === 'number') { 43 return newHover.apply(this, args); 44 } else if (args.length === 2 && typeof args[1] === 'number') { 45 return newHover.call(this, args[0], args[0], args[1]); 46 } 47 return oldHover.apply(this, args); 48 49 }; 50 51})(window.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.