Created
February 15, 2012 18:02
-
-
Save Takazudo/1837821 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var SomeUI; | |
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | |
SomeUI = (function() { | |
function SomeUI($el) { | |
this.$el = $el; | |
this.$content = $el.find('.content'); | |
this.$button1 = $el.find('.button1'); | |
this.$button2 = $el.find('.button2'); | |
this._eventify(); | |
} | |
SomeUI.prototype._eventify = function() { | |
this.$button1.click(__bind(function() { | |
return this.instantToggle(); | |
}, this)); | |
this.$button2.click(__bind(function() { | |
return this.delayedToggle(); | |
}, this)); | |
return this; | |
}; | |
SomeUI.prototype.instantToggle = function() { | |
this.$content.fadeToggle(); | |
return this; | |
}; | |
SomeUI.prototype.delayedToggle = function() { | |
setTimeout((__bind(function() { | |
return this.$content.fadeToggle(); | |
}, this)), 1000); | |
return this; | |
}; | |
return SomeUI; | |
})(); | |
$.fn.someUI = function() { | |
return this.each(function() { | |
return new SomeUI($(this)); | |
}); | |
}; | |
$(function() { | |
return $('.someUI').someUI(); | |
}); | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment