Permalink
Browse files

Replaced all bindWithEvent calls with an inline function that binds this

and then calls methods manually with event object as parameter
  • Loading branch information...
1 parent 24d6f16 commit 36b54960a8ebc4fc7a00ce15917057b8501a5262 @tatai committed Oct 14, 2011
Showing with 31 additions and 23 deletions.
  1. +31 −23 Source/mooRainbow.js
View
@@ -1,19 +1,19 @@
-/*
----
-
-script: mooRainbow.js
-version: 1.3
-description: MooRainbow is a ColorPicker for MooTools 1.3
-license: MIT-Style
-authors:
- - Djamil Legato (w00fz)
- - Christopher Beloch
-
-requires: [Core/*, More/Slider, More/Drag, More/Color]
-
-provides: [mooRainbow]
-
-...
+/*
+---
+
+script: mooRainbow.js
+version: 1.3
+description: MooRainbow is a ColorPicker for MooTools 1.3
+license: MIT-Style
+authors:
+ - Djamil Legato (w00fz)
+ - Christopher Beloch
+
+requires: [Core/*, More/Slider, More/Drag, More/Color]
+
+provides: [mooRainbow]
+
+...
*/
var MooRainbow = new Class({
@@ -270,15 +270,23 @@ var MooRainbow = new Class({
arrColors.each(function(el) {
el.addEvents({
- 'mousewheel': this.eventKeys.bindWithEvent(this, el),
- 'keydown': this.eventKeys.bindWithEvent(this, el)
+ 'mousewheel': function(e) {
+ this.eventKeys(e, el);
+ }.bind(this),
+ 'keydown': function(e) {
+ this.eventKeys(e, el);
+ }.bind(this),
});
}, this);
[this.layout.arrows, this.layout.slider].each(function(el) {
el.addEvents({
- 'mousewheel': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider']),
- 'keydown': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider'])
+ 'mousewheel': function(e) {
+ this.eventKeys(e, this.arrHSB[0], 'slider');
+ }.bind(this),
+ 'keydown': function(e) {
+ this.eventKeys(e, this.arrHSB[0], 'slider');
+ }.bind(this)
});
}, this);
},
@@ -502,7 +510,7 @@ var MooRainbow = new Class({
var overlays = $$('#' + idPrefix + 'overlay');
this.layout.overlay = overlays[0];
this.layout.overlay2 = overlays[1];
- this.layout.cursor = Slick.find(document, '#' + idPrefix + 'cursor');
+ this.layout.cursor = Slick.find(document, '#' + idPrefix + 'cursor');
this.layout.arrows = Slick.find(document, '#' + idPrefix + 'arrows');
this.chooseColor = Slick.find(document, '#' + idPrefix + 'chooseColor');
this.layout.backup = Slick.find(document, '#' + idPrefix + 'currentColor');
@@ -517,8 +525,8 @@ var MooRainbow = new Class({
this.arrRGB = [this.RedInput, this.GreenInput, this.BlueInput];
this.arrHSB = [this.HueInput, this.SatuInput, this.BrighInput];
this.okButton = Slick.find(document, '#' + idPrefix + 'okButton');
-
- this.layout.cursor.setStyle('background-image', 'url(' + this.options.imgPath + 'moor_cursor.gif)');
+
+ this.layout.cursor.setStyle('background-image', 'url(' + this.options.imgPath + 'moor_cursor.gif)');
if (!window.khtml) this.hide();
},

0 comments on commit 36b5496

Please sign in to comment.