1/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net) 2 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 4 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 * 7 * Version: 3.0.2 8 * 9 * Requires: 1.2.2+ 10 */ 11 12(function($) { 13 14var types = ['DOMMouseScroll', 'mousewheel']; 15 16$.event.special.mousewheel = { 17 setup: function() { 18 if ( this.addEventListener ) 19 for ( var i=types.length; i; ) 20 this.addEventListener( types[--i], handler, false ); 21 else 22 this.onmousewheel = handler; 23 }, 24 25 teardown: function() { 26 if ( this.removeEventListener ) 27 for ( var i=types.length; i; ) 28 this.removeEventListener( types[--i], handler, false ); 29 else 30 this.onmousewheel = null; 31 } 32}; 33 34$.fn.extend({ 35 mousewheel: function(fn) { 36 return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); 37 }, 38 39 unmousewheel: function(fn) { 40 return this.unbind("mousewheel", fn); 41 } 42}); 43 44 45function handler(event) { 46 var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true; 47 48 event = $.event.fix(event || window.event); 49 event.type = "mousewheel"; 50 51 if ( event.wheelDelta ) delta = event.wheelDelta/120; 52 if ( event.detail ) delta = -event.detail/3; 53 54 // Add events and delta to the front of the arguments 55 args.unshift(event, delta); 56 57 return $.event.handle.apply(this, args); 58} 59 60})(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.