From f02d017ffa2f63609db034410979f62fde328816 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 24 Mar 2012 18:59:04 -0700 Subject: return matcher value directly + cleanup first lines of files --- js/bootstrap-button.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/bootstrap-button.js') diff --git a/js/bootstrap-button.js b/js/bootstrap-button.js index 6b36753d8..77af03760 100644 --- a/js/bootstrap-button.js +++ b/js/bootstrap-button.js @@ -17,7 +17,8 @@ * limitations under the License. * ============================================================ */ -!function( $ ){ + +!function ( $ ) { "use strict" -- cgit v1.2.3 From 575f18aaf49abb0289185f6409bee031947ccf69 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 14 Apr 2012 16:29:53 -0700 Subject: add jshint support + a few minor stylistic changes --- js/bootstrap-button.js | 59 +++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 32 deletions(-) (limited to 'js/bootstrap-button.js') diff --git a/js/bootstrap-button.js b/js/bootstrap-button.js index 77af03760..49e88e49a 100644 --- a/js/bootstrap-button.js +++ b/js/bootstrap-button.js @@ -18,58 +18,53 @@ * ============================================================ */ -!function ( $ ) { +!function ($) { + + "use strict"; // jshint ;_; - "use strict" /* 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 - - , setState: function ( state ) { - var d = 'disabled' - , $el = this.$element - , data = $el.data() - , val = $el.is('input') ? 'val' : 'html' + Button.prototype.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') @@ -98,4 +93,4 @@ }) }) -}( window.jQuery ); \ No newline at end of file +}(window.jQuery); \ No newline at end of file -- cgit v1.2.3 From 839ef3a030b355d0f0c35d6c9e42ecba8b072036 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 24 Apr 2012 02:19:02 -0700 Subject: 2.0.2 -> 2.0.3 --- js/bootstrap-button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/bootstrap-button.js') diff --git a/js/bootstrap-button.js b/js/bootstrap-button.js index 49e88e49a..a9e6ba7b1 100644 --- a/js/bootstrap-button.js +++ b/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. -- cgit v1.2.3