r2927 - spinner: removed _up/_down methods

r2927 - spinner: removed _up/_down methods


Author: pazu2k@gmail.com
Date: Thu Jul 16 00:47:49 2009
New Revision: 2927
Modified:
branches/dev/spinner/ui/ui.spinner.js
Log:
spinner: removed _up/_down methods
Modified: branches/dev/spinner/ui/ui.spinner.js
==============================================================================
--- branches/dev/spinner/ui/ui.spinner.js    (original)
+++ branches/dev/spinner/ui/ui.spinner.js    Thu Jul 16 00:47:49 2009
@@ -61,6 +61,7 @@
                        ? self.element.attr(option)
                        : defaultValue);
            });
+            
        options.page = parse(options.page || 1);
        
        options.readOnly = options.readOnly !== null
@@ -158,7 +159,7 @@
                if (!self.counter) {
                    self.counter = 1;
                }
-                self._mousedown(100,
$(this).hasClass('ui-spinner-up') ? '_up' : '_down', event);
+                self._mousedown(100,
$(this).hasClass('ui-spinner-up') ? 'up' : 'down', event);
                
                if (!self.disabled) {
                    $(this).addClass(active);
@@ -169,7 +170,7 @@
            })
            .bind('mouseup', function(event) {
                if (self.counter == 1) {
-                    
self[$(this).hasClass('ui-spinner-up') ? '_up' : '_down'](options.step,
event);
+                    self._spin($(this).hasClass('ui-spinner-up') ? 'up' : 'down',
options.step, event);
                }
                self._mouseup(event);
                
@@ -179,7 +180,7 @@
            .bind('dblclick', function(event) {
                if ($.browser.msie) {
                    $(this).removeClass(active);
-                    
self[$(this).hasClass('ui-spinner-up') ? '_up' : '_down'](options.step,
event);
+                    self._spin($(this).hasClass('ui-spinner-up') ? 'up' : 'down',
options.step, event);
                    self._mouseup(event);
                }
            })
@@ -262,12 +263,6 @@
        this._trigger('spin', event, { value: this.value() });
        this._trigger('stop', event, { value: this.value() });
    },
-    _down: function(step, event) {
-        this._spin('down', step, event);
-    },
-    _up: function(step, event) {
-        this._spin('up', step, event);
-    },
    _mousedown: function(i, d, event) {
        var self = this;
        i = i || 100;
@@ -276,7 +271,7 @@
            this.timer = 0;
        }
        this.timer = window.setInterval(function() {
-            self[d](self.options.step, event);
+            self._spin(d, self.options.step, event);
            if (self.options.incremental && self.counter > 20) {
                self._mousedown(20, d, event);
            }
@@ -297,16 +292,16 @@
            KEYS = $.ui.keyCode;
        if (event.keyCode == KEYS.UP) {
-            this._up(event.shiftKey ? jump : o.step, event);
+            this._spin('up', event.shiftKey ? jump : o.step, event);
        }
        if (event.keyCode == KEYS.DOWN) {
-            this._down(event.shiftKey ? jump : o.step, event);
+            this._spin('down', event.shiftKey ? jump : o.step, event);
        }
        if (event.keyCode == KEYS.PAGE_UP) {
-            this._up(jump, event);
+            this._spin('up', jump, event);
        }
        if (event.keyCode == KEYS.PAGE_DOWN) {
-            this._down(jump, event);
+            this._spin('down', jump, event);
        }
        if (event.keyCode == KEYS.HOME) {
            //Home key goes to min
@@ -328,7 +323,7 @@
        var self = $.data(this, 'spinner');
        
        delta = ($.browser.opera ? -delta / Math.abs(delta) : delta);
-        self[delta > 0 ? '_up' : '_down'](self.options.step, event);
+        self._spin(delta > 0 ? 'up' : 'down', self.options.step, event);
        if (self.timeout) {
            window.clearTimeout(self.timeout);
            self.timeout = 0;
@@ -479,11 +474,11 @@
        this._setValue(newVal);
    },
    stepUp: function(steps) {
-        this._up((steps || 1) * this.options.step, null);
+        this._spin('up', (steps || 1) * this.options.step, null);
        return this;
    },
    stepDown: function(steps) {
-        this._down((steps || 1) * this.options.step, null);    
+        this._spin('down', (steps || 1) * this.options.step, null);    
        return this;
    },
    pageUp: function(pages) {