# HG changeset patch # User Atul Varma # Date 1211179084 25200 # Node ID 65a960c019bbd9332a55d3710e5eb3dfb2dcc873 # Parent 16a460235f575f3863f24bf235b8b7bf95c60285 Added support for mousewheel scrolling. diff -r 16a460235f57 -r 65a960c019bb gnusto.html --- a/gnusto.html Sun May 18 23:21:28 2008 -0700 +++ b/gnusto.html Sun May 18 23:38:04 2008 -0700 @@ -13,6 +13,7 @@
+ diff -r 16a460235f57 -r 65a960c019bb jquery.mousewheel.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jquery.mousewheel.min.js Sun May 18 23:38:04 2008 -0700 @@ -0,0 +1,16 @@ +/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * + * $LastChangedDate: 2007-12-14 23:57:10 -0600 (Fri, 14 Dec 2007) $ + * $Rev: 4163 $ + * + * Version: 3.0 + * + * Requires: $ 1.2.2+ + */ +(function($){$.event.special.mousewheel={setup:function(){var handler=$.event.special.mousewheel.handler;if($.browser.mozilla)$(this).bind('mousemove.mousewheel',function(event){$.data(this,'mwcursorposdata',{pageX:event.pageX,pageY:event.pageY,clientX:event.clientX,clientY:event.clientY});});if(this.addEventListener)this.addEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else +this.onmousewheel=handler;},teardown:function(){var handler=$.event.special.mousewheel.handler;$(this).unbind('mousemove.mousewheel');if(this.removeEventListener)this.removeEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else +this.onmousewheel=function(){};$.removeData(this,'mwcursorposdata');},handler:function(event){var args=Array.prototype.slice.call(arguments,1);event=$.event.fix(event||window.event);$.extend(event,$.data(this,'mwcursorposdata')||{});var delta=0,returnValue=true;if(event.wheelDelta)delta=event.wheelDelta/120;if(event.detail)delta=-event.detail/3;if($.browser.opera)delta=-event.wheelDelta;event.data=event.data||{};event.type="mousewheel";args.unshift(delta);args.unshift(event);return $.event.handle.apply(this,args);}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel");},unmousewheel:function(fn){return this.unbind("mousewheel",fn);}});})(jQuery); \ No newline at end of file diff -r 16a460235f57 -r 65a960c019bb web-zui.js --- a/web-zui.js Sun May 18 23:21:28 2008 -0700 +++ b/web-zui.js Sun May 18 23:38:04 2008 -0700 @@ -41,14 +41,20 @@ $(window).keypress(self._windowKeypress) .resize(self._windowResize) .keyup(self._windowKeyup) - .keydown(self._windowKeydown); + .keydown(self._windowKeydown) + .mousewheel(self._windowMousewheel); }, _unbindEventHandlers: function() { $(window).unbind("keypress", self._windowKeypress) .unbind("resize", self._windowResize) .unbind("keyup", self._windowKeyup) - .unbind("keydown", self._windowKeydown); + .unbind("keydown", self._windowKeydown) + .unbind("mousewheel", self._windowMousewheel); + }, + + _windowMousewheel: function(event, delta) { + window.scrollBy(0, -delta * 5); }, // We want to make sure that all key events don't bubble up, so