diff options
| author | Mark Otto <[email protected]> | 2013-12-26 21:40:15 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-12-26 21:40:15 -0800 |
| commit | 5b02dbd97a0a480b0f800cb1011089dab9980300 (patch) | |
| tree | 7eb7ffdc3bf67d303b95ab2ab05bfbf3f76503d1 /js/button.js | |
| parent | 12980e7ea47057d7e17c3606604c79c6450b272e (diff) | |
| parent | 201088cb5f9ab4af062b62ac3a10a2e8f07a6ec5 (diff) | |
| download | bootstrap-5b02dbd97a0a480b0f800cb1011089dab9980300.tar.xz bootstrap-5b02dbd97a0a480b0f800cb1011089dab9980300.zip | |
Merge branch 'master' into docs_derp
Conflicts:
_config.yml
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/js/button.js b/js/button.js index 2cf67f6ad..34a61f58a 100644 --- a/js/button.js +++ b/js/button.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: button.js v3.1.0 + * Bootstrap: button.js v3.0.3 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2013 Twitter, Inc. @@ -13,8 +13,9 @@ // ============================== var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Button.DEFAULTS, options) + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false } Button.DEFAULTS = { @@ -34,25 +35,26 @@ $el[val](data[state] || this.options[state]) // push to event loop to allow forms to submit - setTimeout(function () { - state == 'loadingText' ? - $el.addClass(d).attr(d, d) : - $el.removeClass(d).removeAttr(d); - }, 0) + setTimeout($.proxy(function () { + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) } Button.prototype.toggle = function () { - var $parent = this.$element.closest('[data-toggle="buttons"]') var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { var $input = this.$element.find('input') - if ($input.prop('type') === 'radio') { - // see if clicking on current one - if ($input.prop('checked') && this.$element.hasClass('active')) - changed = false - else - $parent.find('.active').removeClass('active') + if ($input.prop('type') == 'radio') { + if ($input.prop('checked') && this.$element.hasClass('active')) changed = false + else $parent.find('.active').removeClass('active') } if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') } |
