aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.spinner.js
diff options
context:
space:
mode:
authorChi Cheng <cloudream@gmail.com>2008-08-16 05:55:17 +0000
committerChi Cheng <cloudream@gmail.com>2008-08-16 05:55:17 +0000
commitd31077469f6380c01308ccbbcc7580f9fadf82af (patch)
treeb092337c87aafc443e3b90f8f706354358fb6c8d /ui/ui.spinner.js
parent44140343f489842ec9ca92b072601bf7de7b4abe (diff)
downloadjquery-ui-d31077469f6380c01308ccbbcc7580f9fadf82af.tar.gz
jquery-ui-d31077469f6380c01308ccbbcc7580f9fadf82af.zip
Spinner: make internal methods internal, fixs #3207
functional demo fix(not associate with internal change)
Diffstat (limited to 'ui/ui.spinner.js')
-rw-r--r--ui/ui.spinner.js50
1 files changed, 25 insertions, 25 deletions
diff --git a/ui/ui.spinner.js b/ui/ui.spinner.js
index 8486f3ecf..536d3001c 100644
--- a/ui/ui.spinner.js
+++ b/ui/ui.spinner.js
@@ -34,14 +34,14 @@ $.widget("ui.spinner", {
.css("float", this.element.css("float"))
.prepend('<div class="ui-spinner-up"></div>')
.find("div.ui-spinner-up")
- .bind("mousedown", function() { if(!self.counter) self.counter = 1; self.mousedown(100, "up"); })
- .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self.propagate("change", e); })
+ .bind("mousedown", function() { if(!self.counter) self.counter = 1; self._mousedown(100, "_up"); })
+ .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self._propagate("change", e); })
.css({ height: pickerHeight, top: parseInt(this.element.css("borderTopWidth"),10)+1, right: parseInt(this.element.css("borderRightWidth"),10)+1 })
.end()
.append('<div class="ui-spinner-down"></div>')
.find("div.ui-spinner-down")
- .bind("mousedown", function() { if(!self.counter) self.counter = 1; self.mousedown(100, "down"); })
- .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self.propagate("change", e); })
+ .bind("mousedown", function() { if(!self.counter) self.counter = 1; self._mousedown(100, "_down"); })
+ .bind("mouseup", function(e) { self.counter = 0; if(self.timer) window.clearInterval(self.timer); self.element[0].focus(); self._propagate("change", e); })
.css({ height: pickerHeight, bottom: parseInt(this.element.css("borderBottomWidth"),10)+1, right: parseInt(this.element.css("borderRightWidth"),10)+1 })
.end()
;
@@ -49,60 +49,60 @@ $.widget("ui.spinner", {
this.element
.bind("keydown.spinner", function(e) {
if(!self.counter) self.counter = 1;
- self.keydown.call(self, e);
+ self._keydown.call(self, e);
})
.bind("keyup.spinner", function(e) {
self.counter = 0;
- self.cleanUp();
- self.propagate("change", e);
+ self._cleanUp();
+ self._propagate("change", e);
})
;
if ($.fn.mousewheel) {
- this.element.mousewheel(function(e, delta) { self.mousewheel(e, delta); });
+ this.element.mousewheel(function(e, delta) { self._mousewheel(e, delta); });
}
},
plugins: {},
- constrain: function() {
+ _constrain: function() {
if(this.options.min != undefined && this.element[0].value < this.options.min) this.element[0].value = this.options.min;
if(this.options.max != undefined && this.element[0].value > this.options.max) this.element[0].value = this.options.max;
},
- cleanUp: function() {
+ _cleanUp: function() {
this.element[0].value = this.element[0].value.replace(/[^0-9\-]/g, '');
- this.constrain();
+ this._constrain();
},
- down: function(e) {
+ _down: function(e) {
if(isNaN(parseInt(this.element[0].value,10))) this.element[0].value = this.options.start;
this.element[0].value -= (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping;
- this.constrain();
+ this._constrain();
if(this.counter) this.counter++;
- this.propagate("spin", e);
+ this._propagate("spin", e);
},
- up: function(e) {
+ _up: function(e) {
if(isNaN(parseInt(this.element[0].value,10))) this.element[0].value = this.options.start;
this.element[0].value = parseFloat(this.element[0].value) + (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping;
- this.constrain();
+ this._constrain();
if(this.counter) this.counter++;
- this.propagate("spin", e);
+ this._propagate("spin", e);
},
- mousedown: function(i, d) {
+ _mousedown: function(i, d) {
var self = this;
i = i || 100;
if(this.timer) window.clearInterval(this.timer);
this.timer = window.setInterval(function() {
self[d]();
- if(self.counter > 20) self.mousedown(20, d);
+ if(self.counter > 20) self._mousedown(20, d);
}, i);
},
- keydown: function(e) {
- if(e.keyCode == 38 || e.keyCode == 39) this.up(e);
- if(e.keyCode == 40 || e.keyCode == 37) this.down(e);
+ _keydown: function(e) {
+ if(e.keyCode == 38 || e.keyCode == 39) this._up(e);
+ if(e.keyCode == 40 || e.keyCode == 37) this._down(e);
if(e.keyCode == 36) this.element[0].value = this.options.min || this.options.start; //Home key goes to min, if defined, else to start
if(e.keyCode == 35 && this.options.max != undefined) this.element[0].value = this.options.max; //End key goes to maximum
},
- mousewheel: function(e, delta) {
+ _mousewheel: function(e, delta) {
delta = ($.browser.opera ? -delta / Math.abs(delta) : delta);
- delta > 0 ? this.up(e) : this.down(e);
+ delta > 0 ? this._up(e) : this._down(e);
e.preventDefault();
},
ui: function(e) {
@@ -112,7 +112,7 @@ $.widget("ui.spinner", {
element: this.element
};
},
- propagate: function(n,e) {
+ _propagate: function(n,e) {
$.ui.plugin.call(this, n, [e, this.ui()]);
return this.element.triggerHandler(n == "spin" ? n : "spin"+n, [e, this.ui()], this.options[n]);
},