I"W(function() { var CharacterCounter, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; CharacterCounter = (function() { function CharacterCounter(el) { this.el = el; this.inject_counter = bind(this.inject_counter, this); this.adjust_count = bind(this.adjust_count, this); this.bind_events = bind(this.bind_events, this); this.inject_counter(); this.bind_events(); this.adjust_count(); } CharacterCounter.prototype.bind_events = function() { return this.el.keyup(this.adjust_count); }; CharacterCounter.prototype.adjust_count = function() { var count, title; count = this.el.val().length; title = count === 1 ? 'character' : 'characters'; return this.counter_el.html(count + " " + title); }; CharacterCounter.prototype.inject_counter = function() { var group; group = this.el.parents(".form-group"); this.counter_wrap = $("
"); group.prepend(this.counter_wrap); return this.counter_el = this.counter_wrap.find('.count'); }; return CharacterCounter; })(); $(function() { return $("[data-toggle='character-counter']").each(function() { return new CharacterCounter($(this)); }); }); }).call(this); :ET