Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Mazovetskiy <glebm@google.com>2015-05-06 23:59:22 +0300
committerGleb Mazovetskiy <glebm@google.com>2015-05-06 23:59:22 +0300
commit488c8b35ec0b84abc16f05ec7b2de21c79c9ec2c (patch)
treee6ae003c5a2893528b6604051fc826cce13ccab1 /assets/javascripts/bootstrap/button.js
parente1179d37082b6911349fff0444452352df913cc4 (diff)
rake convert
Diffstat (limited to 'assets/javascripts/bootstrap/button.js')
-rw-r--r--assets/javascripts/bootstrap/button.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/assets/javascripts/bootstrap/button.js b/assets/javascripts/bootstrap/button.js
index 3b86f35..3e2e345 100644
--- a/assets/javascripts/bootstrap/button.js
+++ b/assets/javascripts/bootstrap/button.js
@@ -31,7 +31,7 @@
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
- state = state + 'Text'
+ state += 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
@@ -57,14 +57,18 @@
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked')) changed = false
- if (!$input.prop('checked') || !this.$element.hasClass('active')) $parent.find('.active').removeClass('active')
+ $parent.find('.active').removeClass('active')
+ this.$element.addClass('active')
+ } else if ($input.prop('type') == 'checkbox') {
+ if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
+ this.$element.toggleClass('active')
}
- if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
+ $input.prop('checked', this.$element.hasClass('active'))
+ if (changed) $input.trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
+ this.$element.toggleClass('active')
}
-
- if (changed) this.$element.toggleClass('active')
}
@@ -107,7 +111,7 @@
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
- if (!$(e.target).is('input[type="radio"]')) e.preventDefault()
+ if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))