Sha256: 1facbc8f38c95a2cc9ec025d8570dc165d60132eb3322f940b86a5793db62d14

Contents?: true

Size: 1.67 KB

Versions: 32

Compression:

Stored size: 1.67 KB

Contents

{I"
class:ETI"BundledAsset;FI"logical_path;TI"spina/switch.js;FI"
pathname;TI"R/Users/bram/apps/Spina-template/app/assets/javascripts/spina/switch.js.coffee;FI"content_type;TI"application/javascript;TI"
mtime;Tl+>÷TI"length;TiáI"digest;TI"%aa162b456a3e0ea812ce9c2838666081;FI"source;TI"á(function() {
  var toggleSwitch;

  $.fn.spinaSwitch = function() {
    return this.each(function() {
      var input, klass;
      if (!$(this).attr('data-plugin-switch')) {
        input = $(this);
        input.attr('data-plugin-switch', true);
        input.hide();
        if (input.is(':checked')) {
          klass = "switch active";
        } else {
          klass = "switch";
        }
        return input.after('<a href="#' + input.attr("id") + '" class="' + klass + '"> <span class="knob"></span> </a>');
      }
    });
  };

  $(document).on('click', 'a.switch', function(e) {
    return toggleSwitch(e);
  });

  $(document).on('touchend', 'a.switch', function(e) {
    return toggleSwitch(e);
  });

  toggleSwitch = function(e) {
    var checkbox, input;
    checkbox = $(e.currentTarget);
    input = $(checkbox.attr("href"));
    if (checkbox.hasClass('activated') || checkbox.hasClass('active')) {
      checkbox.removeClass('active');
      checkbox.removeClass('activated');
      checkbox.addClass('deactivated');
      input.prop("checked", false);
    } else {
      checkbox.addClass('activated');
      checkbox.removeClass('deactivated');
      input.prop("checked", true);
    }
    return false;
  };

}).call(this);
;TI"required_assets_digest;TI"%feb4e3aa1c7411463a27a6a18201a859;FI"
_version;TI"%64e62ddc273c2f5847f30d698ca14b67;F

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
spina-0.6.29 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.29 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.28 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.28 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.27 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.27 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.26 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.26 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.25 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.25 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.24 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.24 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.23 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.23 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.22 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.22 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.21 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.21 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d
spina-0.6.20 test/dummy/tmp/cache/assets/development/sprockets/d19ea44a69d7a3a13b31a99600e1179e
spina-0.6.20 test/dummy/tmp/cache/assets/development/sprockets/154ac4266df4dd6242185e06b072c00d