Sha256: 289778f7dc6019fd82844746eca4a9058e0a381dd12f152a59ccd29b382b90b9

Contents?: true

Size: 1.35 KB

Versions: 43

Compression:

Stored size: 1.35 KB

Contents

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 = $("<div class='character-count-wrap'> <span class='count'></span> </div>");
      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

Version data entries

43 entries across 36 versions & 1 rubygems

Version Path
virgo-0.3.17 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.17 spec/dummy/tmp/cache/assets/sprockets/v3.0/dS9fUtoh6LyphTRE5ja255LwegtRognd_hjcDukmVqs.cache
virgo-0.3.16 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.16 spec/dummy/tmp/cache/assets/sprockets/v3.0/dS9fUtoh6LyphTRE5ja255LwegtRognd_hjcDukmVqs.cache
virgo-0.3.15 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.15 spec/dummy/tmp/cache/assets/sprockets/v3.0/dS9fUtoh6LyphTRE5ja255LwegtRognd_hjcDukmVqs.cache
virgo-0.3.14 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.13 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.12 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.12 spec/dummy/tmp/cache/assets/test/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.11 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.10 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.9 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.8 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.7 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.6 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.4 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.3 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.2 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache
virgo-0.3.1 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9Xy3D1WOrJOMhVpjKhZCUg7dFxf-wZ5ow-bMT6K4BRk.cache