diff options
author | Thomas Park <thomas@thomaspark.me> | 2012-05-03 13:48:57 -0400 |
---|---|---|
committer | Thomas Park <thomas@thomaspark.me> | 2012-05-03 13:48:57 -0400 |
commit | 0f0a0f9f8a57dc9e22839b2706ced578755518ef (patch) | |
tree | 9f6f2a702f46602a438a280ace67b268a0ed1911 /assets/js/bootstrap-button.js | |
parent | 1e104e46ac4ac608705cc4b81fa092d178de3b91 (diff) |
index: updated site itself to 2.0.3
Diffstat (limited to 'assets/js/bootstrap-button.js')
-rwxr-xr-x | assets/js/bootstrap-button.js | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/assets/js/bootstrap-button.js b/assets/js/bootstrap-button.js index 6b36753d..a9e6ba7b 100755 --- a/assets/js/bootstrap-button.js +++ b/assets/js/bootstrap-button.js @@ -1,5 +1,5 @@ /* ============================================================ - * bootstrap-button.js v2.0.2 + * bootstrap-button.js v2.0.3 * http://twitter.github.com/bootstrap/javascript.html#buttons * ============================================================ * Copyright 2012 Twitter, Inc. @@ -17,58 +17,54 @@ * limitations under the License. * ============================================================ */ -!function( $ ){ - "use strict" +!function ($) { + + "use strict"; // jshint ;_; + /* BUTTON PUBLIC CLASS DEFINITION * ============================== */ - var Button = function ( element, options ) { + var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.button.defaults, options) } - Button.prototype = { - - constructor: Button + Button.prototype.setState = function (state) { + var d = 'disabled' + , $el = this.$element + , data = $el.data() + , val = $el.is('input') ? 'val' : 'html' - , setState: function ( state ) { - var d = 'disabled' - , $el = this.$element - , data = $el.data() - , val = $el.is('input') ? 'val' : 'html' + state = state + 'Text' + data.resetText || $el.data('resetText', $el[val]()) - state = state + 'Text' - data.resetText || $el.data('resetText', $el[val]()) + $el[val](data[state] || this.options[state]) - $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) - } - - , toggle: function () { - var $parent = this.$element.parent('[data-toggle="buttons-radio"]') + // 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) + } - $parent && $parent - .find('.active') - .removeClass('active') + Button.prototype.toggle = function () { + var $parent = this.$element.parent('[data-toggle="buttons-radio"]') - this.$element.toggleClass('active') - } + $parent && $parent + .find('.active') + .removeClass('active') + this.$element.toggleClass('active') } /* BUTTON PLUGIN DEFINITION * ======================== */ - $.fn.button = function ( option ) { + $.fn.button = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('button') @@ -97,4 +93,4 @@ }) }) -}( window.jQuery );
\ No newline at end of file +}(window.jQuery);
\ No newline at end of file |