Takazudo
2/15/2012 - 6:02 PM

http://jsfiddle.net/Takazudo/e8Ejp/

(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);