diff --git a/README.md b/README.md index dbd9d70..f468399 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Several quick start options are available: -* [Download the latest release](https://github.com/vsn4ik/bootstrap-checkbox/archive/v1.3.1.zip "Download Bootstrap-checkbox"). +* [Download the latest release](https://github.com/vsn4ik/bootstrap-checkbox/archive/v1.3.2.zip "Download Bootstrap-checkbox"). * Clone the repo: `git clone https://github.com/vsn4ik/bootstrap-checkbox.git`. * Install with [Bower](http://bower.io): `bower install bootstrap-checkbox`. * Install with [npm](https://www.npmjs.com): `npm install bootstrap-checkbox`. diff --git a/dist/js/bootstrap-checkbox.js b/dist/js/bootstrap-checkbox.js index a4e8f3d..d4a75d3 100644 --- a/dist/js/bootstrap-checkbox.js +++ b/dist/js/bootstrap-checkbox.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ @@ -185,7 +185,8 @@ this.$group.trigger('focus'); }, click: function(event) { - var $button = $(event.target); + // Strictly event.currentTarget. Fix #19 + var $button = $(event.currentTarget); if (!$button.hasClass('active') || this.options.switchAlways) { this.change(); diff --git a/dist/js/bootstrap-checkbox.min.js b/dist/js/bootstrap-checkbox.min.js index 1b2ae9c..46c823a 100644 --- a/dist/js/bootstrap-checkbox.min.js +++ b/dist/js/bootstrap-checkbox.min.js @@ -1,7 +1,7 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ -"use strict";!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function b(b,c){this.element=b,this.$element=a(b);var d=this.$element.data();return""===d.reverse&&(d.reverse=!0),""===d.switchAlways&&(d.switchAlways=!0),""===d.html&&(d.html=!0),this.options=a.extend({},a.fn.checkboxpicker.defaults,c,d),this.$element.closest("label").length?void console.warn(this.options.warningMessage):(this.$group=a.create("div").addClass("btn-group"),this.$buttons=a.create("a","a").addClass("btn"),this.$off=this.$buttons.eq(this.options.reverse?1:0),this.$on=this.$buttons.eq(this.options.reverse?0:1),void this.init())}a.create=function(){return a(a.map(arguments,a.proxy(document,"createElement")))},b.prototype={init:function(){var b=this.options.html?"html":"text";this.$element.addClass("hidden"),this.options.offLabel&&this.$off[b](this.options.offLabel),this.options.onLabel&&this.$on[b](this.options.onLabel),this.options.offIconClass&&(this.options.offLabel&&this.$off.prepend(" "),a.create("span").addClass(this.options.offIconClass).prependTo(this.$off)),this.options.onIconClass&&(this.options.onLabel&&this.$on.prepend(" "),a.create("span").addClass(this.options.onIconClass).prependTo(this.$on)),this.element.checked?(this.$on.addClass("active "+this.options.onClass),this.$off.addClass(this.options.defaultClass)):(this.$off.addClass("active "+this.options.offClass),this.$on.addClass(this.options.defaultClass)),this.options.style&&this.$group.addClass(this.options.style),this.element.title?this.$group.attr("title",this.element.title):(this.options.offTitle&&this.$off.attr("title",this.options.offTitle),this.options.onTitle&&this.$on.attr("title",this.options.onTitle)),this.$group.on("keydown",a.proxy(this,"keydown")),this.$buttons.on("click",a.proxy(this,"click")),this.$element.on("change",a.proxy(this,"toggleChecked")),a(this.element.labels).on("click",a.proxy(this,"focus")),a(this.element.form).on("reset",a.proxy(this,"reset")),this.$group.append(this.$buttons).insertAfter(this.element),this.element.disabled?(this.$buttons.addClass("disabled"),this.options.disabledCursor&&this.$group.css("cursor",this.options.disabledCursor)):(this.$group.attr("tabindex",this.element.tabIndex),this.element.autofocus&&this.focus())},toggleChecked:function(){this.$buttons.toggleClass("active "+this.options.defaultClass),this.$off.toggleClass(this.options.offClass),this.$on.toggleClass(this.options.onClass)},toggleDisabled:function(){this.$buttons.toggleClass("disabled"),this.element.disabled?(this.$group.attr("tabindex",this.element.tabIndex),this.$group.css("cursor","")):(this.$group.removeAttr("tabindex"),this.options.disabledCursor&&this.$group.css("cursor",this.options.disabledCursor))},focus:function(){this.$group.trigger("focus")},click:function(b){var c=a(b.target);(!c.hasClass("active")||this.options.switchAlways)&&this.change()},change:function(){this.set(!this.element.checked)},set:function(a){this.element.checked=a,this.$element.trigger("change")},keydown:function(b){-1!=a.inArray(b.keyCode,this.options.toggleKeyCodes)?(b.preventDefault(),this.change()):13==b.keyCode&&a(this.element.form).trigger("submit")},reset:function(){(this.element.defaultChecked&&this.$off.hasClass("active")||!this.element.defaultChecked&&this.$on.hasClass("active"))&&this.set(this.element.defaultChecked)}};var c=a.extend({},a.propHooks);return a.extend(a.propHooks,{checked:{set:function(b,d){var e=a.data(b,"bs.checkbox");e&&b.checked!=d&&e.change(d),c.checked&&c.checked.set&&c.checked.set(b,d)}},disabled:{set:function(b,d){var e=a.data(b,"bs.checkbox");e&&b.disabled!=d&&e.toggleDisabled(),c.disabled&&c.disabled.set&&c.disabled.set(b,d)}}}),a.fn.checkboxpicker=function(c,d){var e;return e=this instanceof a?this:a("string"==typeof c?c:d),e.each(function(){var d=a.data(this,"bs.checkbox");d||(d=new b(this,c),a.data(this,"bs.checkbox",d))})},a.fn.checkboxpicker.defaults={style:!1,defaultClass:"btn-default",disabledCursor:"not-allowed",offClass:"btn-danger",onClass:"btn-success",offLabel:"No",onLabel:"Yes",offTitle:!1,onTitle:!1,toggleKeyCodes:[13,32],warningMessage:"Please do not use Bootstrap-checkbox element in label element."},a.fn.checkboxpicker}); \ No newline at end of file +"use strict";!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function b(b,c){this.element=b,this.$element=a(b);var d=this.$element.data();return""===d.reverse&&(d.reverse=!0),""===d.switchAlways&&(d.switchAlways=!0),""===d.html&&(d.html=!0),this.options=a.extend({},a.fn.checkboxpicker.defaults,c,d),this.$element.closest("label").length?void console.warn(this.options.warningMessage):(this.$group=a.create("div").addClass("btn-group"),this.$buttons=a.create("a","a").addClass("btn"),this.$off=this.$buttons.eq(this.options.reverse?1:0),this.$on=this.$buttons.eq(this.options.reverse?0:1),void this.init())}a.create=function(){return a(a.map(arguments,a.proxy(document,"createElement")))},b.prototype={init:function(){var b=this.options.html?"html":"text";this.$element.addClass("hidden"),this.options.offLabel&&this.$off[b](this.options.offLabel),this.options.onLabel&&this.$on[b](this.options.onLabel),this.options.offIconClass&&(this.options.offLabel&&this.$off.prepend(" "),a.create("span").addClass(this.options.offIconClass).prependTo(this.$off)),this.options.onIconClass&&(this.options.onLabel&&this.$on.prepend(" "),a.create("span").addClass(this.options.onIconClass).prependTo(this.$on)),this.element.checked?(this.$on.addClass("active "+this.options.onClass),this.$off.addClass(this.options.defaultClass)):(this.$off.addClass("active "+this.options.offClass),this.$on.addClass(this.options.defaultClass)),this.options.style&&this.$group.addClass(this.options.style),this.element.title?this.$group.attr("title",this.element.title):(this.options.offTitle&&this.$off.attr("title",this.options.offTitle),this.options.onTitle&&this.$on.attr("title",this.options.onTitle)),this.$group.on("keydown",a.proxy(this,"keydown")),this.$buttons.on("click",a.proxy(this,"click")),this.$element.on("change",a.proxy(this,"toggleChecked")),a(this.element.labels).on("click",a.proxy(this,"focus")),a(this.element.form).on("reset",a.proxy(this,"reset")),this.$group.append(this.$buttons).insertAfter(this.element),this.element.disabled?(this.$buttons.addClass("disabled"),this.options.disabledCursor&&this.$group.css("cursor",this.options.disabledCursor)):(this.$group.attr("tabindex",this.element.tabIndex),this.element.autofocus&&this.focus())},toggleChecked:function(){this.$buttons.toggleClass("active "+this.options.defaultClass),this.$off.toggleClass(this.options.offClass),this.$on.toggleClass(this.options.onClass)},toggleDisabled:function(){this.$buttons.toggleClass("disabled"),this.element.disabled?(this.$group.attr("tabindex",this.element.tabIndex),this.$group.css("cursor","")):(this.$group.removeAttr("tabindex"),this.options.disabledCursor&&this.$group.css("cursor",this.options.disabledCursor))},focus:function(){this.$group.trigger("focus")},click:function(b){var c=a(b.currentTarget);(!c.hasClass("active")||this.options.switchAlways)&&this.change()},change:function(){this.set(!this.element.checked)},set:function(a){this.element.checked=a,this.$element.trigger("change")},keydown:function(b){-1!=a.inArray(b.keyCode,this.options.toggleKeyCodes)?(b.preventDefault(),this.change()):13==b.keyCode&&a(this.element.form).trigger("submit")},reset:function(){(this.element.defaultChecked&&this.$off.hasClass("active")||!this.element.defaultChecked&&this.$on.hasClass("active"))&&this.set(this.element.defaultChecked)}};var c=a.extend({},a.propHooks);return a.extend(a.propHooks,{checked:{set:function(b,d){var e=a.data(b,"bs.checkbox");e&&b.checked!=d&&e.change(d),c.checked&&c.checked.set&&c.checked.set(b,d)}},disabled:{set:function(b,d){var e=a.data(b,"bs.checkbox");e&&b.disabled!=d&&e.toggleDisabled(),c.disabled&&c.disabled.set&&c.disabled.set(b,d)}}}),a.fn.checkboxpicker=function(c,d){var e;return e=this instanceof a?this:a("string"==typeof c?c:d),e.each(function(){var d=a.data(this,"bs.checkbox");d||(d=new b(this,c),a.data(this,"bs.checkbox",d))})},a.fn.checkboxpicker.defaults={style:!1,defaultClass:"btn-default",disabledCursor:"not-allowed",offClass:"btn-danger",onClass:"btn-success",offLabel:"No",onLabel:"Yes",offTitle:!1,onTitle:!1,toggleKeyCodes:[13,32],warningMessage:"Please do not use Bootstrap-checkbox element in label element."},a.fn.checkboxpicker}); \ No newline at end of file diff --git a/dist/js/i18n/es.js b/dist/js/i18n/es.js index 4d56894..e53dc9e 100644 --- a/dist/js/i18n/es.js +++ b/dist/js/i18n/es.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/dist/js/i18n/es.min.js b/dist/js/i18n/es.min.js index d939b57..8a21ea0 100644 --- a/dist/js/i18n/es.min.js +++ b/dist/js/i18n/es.min.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/dist/js/i18n/pt.js b/dist/js/i18n/pt.js index a94bce8..70327e9 100644 --- a/dist/js/i18n/pt.js +++ b/dist/js/i18n/pt.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/dist/js/i18n/pt.min.js b/dist/js/i18n/pt.min.js index 63ac99d..032ac60 100644 --- a/dist/js/i18n/pt.min.js +++ b/dist/js/i18n/pt.min.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/dist/js/i18n/ru.js b/dist/js/i18n/ru.js index 4344d46..77fc294 100644 --- a/dist/js/i18n/ru.js +++ b/dist/js/i18n/ru.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/dist/js/i18n/ru.min.js b/dist/js/i18n/ru.min.js index 1865cee..2e369ee 100644 --- a/dist/js/i18n/ru.min.js +++ b/dist/js/i18n/ru.min.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/dist/js/i18n/tr.js b/dist/js/i18n/tr.js index 63c734e..d597a49 100644 --- a/dist/js/i18n/tr.js +++ b/dist/js/i18n/tr.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/dist/js/i18n/tr.min.js b/dist/js/i18n/tr.min.js index efeffb7..c9e3df3 100644 --- a/dist/js/i18n/tr.min.js +++ b/dist/js/i18n/tr.min.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-checkbox v1.3.1 (https://vsn4ik.github.io/bootstrap-checkbox/) + * Bootstrap-checkbox v1.3.2 (https://vsn4ik.github.io/bootstrap-checkbox/) * Copyright 2013-2016 Vasily A. (https://github.com/vsn4ik) * Licensed under the MIT license */ diff --git a/package.json b/package.json index 1815549..face746 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-checkbox", - "version": "1.3.1", + "version": "1.3.2", "description": "A checkbox component based on Bootstrap framework", "keywords": [ "bootstrap", @@ -31,14 +31,14 @@ "grunt-contrib-clean": "~0.7.0", "grunt-contrib-compress": "~0.14.0", "grunt-contrib-copy": "~0.8.2", - "grunt-contrib-jshint": "~0.11.3", - "grunt-contrib-uglify": "~0.11.0", + "grunt-contrib-jshint": "~0.12.0", + "grunt-contrib-uglify": "~0.11.1", "grunt-ejs": "~0.3.0", "grunt-jscs": "~2.5.0", "highlight.js": "~9.1.0", "jquery": "~2.2.0", "load-grunt-tasks": "~3.4.0", - "octicons": "~3.3.0" + "octicons": "~3.4.1" }, "spm": { "main": "dist/js/bootstrap-checkbox.js",