Skip to content

Commit ad6da59

Browse files
committed
Bump version
1 parent 9eb69e1 commit ad6da59

14 files changed

+51
-25
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
Several quick start options are available:
1313

14-
* [Download the latest release](https://github.com/vsn4ik/bootstrap-checkbox/releases/download/v1.2.15/bootstrap-checkbox-1.2.15-dist.zip "Download Bootstrap-checkbox").
14+
* [Download the latest release](https://github.com/vsn4ik/bootstrap-checkbox/releases/download/v1.3.0/bootstrap-checkbox-1.3.0-dist.zip "Download Bootstrap-checkbox").
1515
* Clone the repo: `git clone https://github.com/vsn4ik/bootstrap-checkbox.git`.
1616
* Install with [Bower](http://bower.io): `bower install bootstrap-checkbox`.
1717
* Install with [npm](https://www.npmjs.com): `npm install bootstrap-checkbox`.

Diff for: dist/js/bootstrap-checkbox.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/
@@ -27,16 +27,26 @@
2727
}
2828
})(function($) {
2929
$.create = function() {
30-
return $($.map(arguments, function(tagName) {
31-
return document.createElement(tagName);
32-
}));
30+
return $($.map(arguments, $.proxy(document, 'createElement')));
3331
};
3432

3533
function Checkboxpicker(element, options) {
3634
this.element = element;
3735
this.$element = $(element);
3836

39-
this.options = $.extend({}, $.fn.checkboxpicker.defaults, options, this.$element.data());
37+
var data = this.$element.data();
38+
39+
// === '': <... data-reverse>
40+
if (data.reverse === '') {
41+
data.reverse = true;
42+
}
43+
44+
// === '': <... data-switch-always>
45+
if (data.switchAlways === '') {
46+
data.switchAlways = true;
47+
}
48+
49+
this.options = $.extend({}, $.fn.checkboxpicker.defaults, options, data);
4050

4151
if (this.$element.closest('label').length) {
4252
console.warn(this.options.warningMessage);
@@ -49,11 +59,8 @@
4959
// .btn-group-justified works with <a> elements as the <button> doesn't pick up the styles
5060
this.$buttons = $.create('a', 'a').addClass('btn');
5161

52-
// === '': <... data-reverse>
53-
var reverse = this.options.reverse || this.options.reverse === '';
54-
55-
this.$off = this.$buttons.eq(reverse ? 1 : 0);
56-
this.$on = this.$buttons.eq(reverse ? 0 : 1);
62+
this.$off = this.$buttons.eq(this.options.reverse ? 1 : 0);
63+
this.$on = this.$buttons.eq(this.options.reverse ? 0 : 1);
5764

5865
this.init();
5966
}
@@ -123,7 +130,7 @@
123130
this.$group.on('keydown', $.proxy(this, 'keydown'));
124131

125132
// Don't trigger if <a> element has .disabled class, fine!
126-
this.$group.on('click', 'a:not(.active)', $.proxy(this, 'click'));
133+
this.$buttons.on('click', $.proxy(this, 'click'));
127134

128135
this.$element.on('change', $.proxy(this, 'toggleChecked'));
129136
$(this.element.labels).on('click', $.proxy(this, 'focus'));
@@ -172,8 +179,12 @@
172179
// Original behavior
173180
this.$group.trigger('focus');
174181
},
175-
click: function() {
176-
this.change(!this.element.checked);
182+
click: function(event) {
183+
var $button = $(event.target);
184+
185+
if (!$button.hasClass('active') || this.options.switchAlways) {
186+
this.change(!this.element.checked);
187+
}
177188
},
178189
change: function(value) {
179190
// Fix #12

Diff for: dist/js/bootstrap-checkbox.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/js/i18n/es.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: dist/js/i18n/es.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: dist/js/i18n/pt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: dist/js/i18n/pt.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: dist/js/i18n/ru.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: dist/js/i18n/ru.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: dist/js/i18n/tr.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: dist/js/i18n/tr.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Bootstrap-checkbox v1.2.15 (https://vsn4ik.github.io/bootstrap-checkbox/)
2+
* Bootstrap-checkbox v1.3.0 (https://vsn4ik.github.io/bootstrap-checkbox/)
33
* Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik)
44
* Licensed under the MIT license
55
*/

Diff for: docs/views/section_html_examples.ejs

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
</div>
2222
</div>
2323

24+
<div class="form-group">
25+
<div class="col-sm-3">
26+
<input type="checkbox" data-switch-always>
27+
</div>
28+
29+
<div class="col-sm-9">
30+
<pre><code class="hljs xml">&lt;input type="checkbox" data-switch-always&gt;</code></pre>
31+
</div>
32+
</div>
33+
2434
<div class="form-group">
2535
<div class="col-sm-3">
2636
<input type="checkbox" disabled checked>

Diff for: docs/views/section_options.ejs

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
<td>boolean</td>
7777
<td>false</td>
7878
</tr>
79+
<tr>
80+
<td>switchAlways</td>
81+
<td>boolean</td>
82+
<td>false</td>
83+
</tr>
7984
<tr>
8085
<td>toggleKeyCodes</td>
8186
<td>array</td>

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bootstrap-checkbox",
3-
"version": "1.2.15",
3+
"version": "1.3.0",
44
"description": "A checkbox component based on Bootstrap framework",
55
"keywords": [
66
"bootstrap",

0 commit comments

Comments
 (0)