From 68ab9f57f18ab1a9127d9c7f1cfaf126cf83cf5b Mon Sep 17 00:00:00 2001 From: Rubens Mariuzzo Date: Fri, 13 Sep 2013 00:23:45 -0400 Subject: [PATCH] Version 1.0.2 --- build/jquery.checkboxes.min.js | 4 ++-- package.json | 2 +- src/jquery.checkboxes.js | 2 +- test/test.html | 11 +++++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/build/jquery.checkboxes.min.js b/build/jquery.checkboxes.min.js index d58547f..ba52848 100644 --- a/build/jquery.checkboxes.min.js +++ b/build/jquery.checkboxes.min.js @@ -1,2 +1,2 @@ -/*! checkboxes.js 1.0.1 | Rubens Mariuzzo (http://mariuzzo.com/) | 2013-09-13 | MIT */ -!function(a){var b=function(a){this.$context=a};b.prototype.check=function(){this.$context.find(":checkbox").prop("checked",!0)},b.prototype.uncheck=function(){this.$context.find(":checkbox").prop("checked",!1)},b.prototype.toggle=function(){this.$context.find(":checkbox").each(function(){var b=a(this);b.prop("checked",!b.is(":checked"))})},b.prototype.max=function(a){if(0===a)this.$context.off("click.checkboxes");else if(a>0){var b=this;this.$context.on("click.checkboxes.max",":checkbox",function(){b.$context.find(":checked").length===a?b.$context.find(":checkbox:not(:checked)").prop("disabled",!0):b.$context.find(":checkbox:not(:checked)").prop("disabled",!1)})}},b.prototype.range=function(b){if(b){var c=this;this.$context.on("click.checkboxes.range",":checkbox",function(b){var d=a(b.target);if(b.shiftKey&&c.$last){var e=c.$context.find(":checkbox"),f=e.index(c.$last),g=e.index(d),h=Math.min(f,g),i=Math.max(f,g)+1;e.slice(h,i).prop("checked",d.prop("checked"))}c.$last=d})}else this.$context.off("click.checkboxes.range")};var c=a.fn.checkboxes;a.fn.checkboxes=function(c){var d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("checkboxes");f||e.data("checkboxes",f=new b(e,"object"==typeof c&&c)),"string"==typeof c&&f[c]&&f[c].apply(f,d)})},a.fn.checkboxes.Constructor=b,a.fn.checkboxes.noConflict=function(){return a.fn.checkboxes=c,this},a(document).on("click.checkboxes.data-api","[data-toggle^=checkboxes]",function(b){var c=a(b.target),d=c.attr("href"),e=a(c.data("context")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=c.data("action");e&&f&&(b.preventDefault(),e.checkboxes(f))}),a(document).on("ready.checkboxes.data-api",function(){a("[data-toggle^=checkboxes]").each(function(){var b=a(this),c=b.data();delete c.toggle;for(var d in c)b.checkboxes(d,c[d])})})}(window.jQuery); \ No newline at end of file +/*! checkboxes.js 1.0.2 | Rubens Mariuzzo (http://mariuzzo.com/) | 2013-09-13 | MIT */ +!function(a){var b=function(a){this.$context=a};b.prototype.check=function(){this.$context.find(":checkbox").filter(":not(:disabled)").prop("checked",!0)},b.prototype.uncheck=function(){this.$context.find(":checkbox").filter(":not(:disabled)").prop("checked",!1)},b.prototype.toggle=function(){this.$context.find(":checkbox").filter(":not(:disabled)").each(function(){var b=a(this);b.prop("checked",!b.is(":checked"))})},b.prototype.max=function(a){if(0===a)this.$context.off("click.checkboxes");else if(a>0){var b=this;this.$context.on("click.checkboxes.max",":checkbox",function(){b.$context.find(":checked").length===a?b.$context.find(":checkbox:not(:checked)").prop("disabled",!0):b.$context.find(":checkbox:not(:checked)").prop("disabled",!1)})}},b.prototype.range=function(b){if(b){var c=this;this.$context.on("click.checkboxes.range",":checkbox",function(b){var d=a(b.target);if(b.shiftKey&&c.$last){var e=c.$context.find(":checkbox"),f=e.index(c.$last),g=e.index(d),h=Math.min(f,g),i=Math.max(f,g)+1;e.slice(h,i).filter(":not(:disabled)").prop("checked",d.prop("checked"))}c.$last=d})}else this.$context.off("click.checkboxes.range")};var c=a.fn.checkboxes;a.fn.checkboxes=function(c){var d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("checkboxes");f||e.data("checkboxes",f=new b(e,"object"==typeof c&&c)),"string"==typeof c&&f[c]&&f[c].apply(f,d)})},a.fn.checkboxes.Constructor=b,a.fn.checkboxes.noConflict=function(){return a.fn.checkboxes=c,this},a(document).on("click.checkboxes.data-api","[data-toggle^=checkboxes]",function(b){var c=a(b.target),d=c.attr("href"),e=a(c.data("context")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=c.data("action");e&&f&&(b.preventDefault(),e.checkboxes(f))}),a(document).on("ready.checkboxes.data-api",function(){a("[data-toggle^=checkboxes]").each(function(){var b=a(this),c=b.data();delete c.toggle;for(var d in c)b.checkboxes(d,c[d])})})}(window.jQuery); \ No newline at end of file diff --git a/package.json b/package.json index e971f62..e2bf240 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "checkboxes.js", - "version": "1.0.1", + "version": "1.0.2", "homepage": "https://github.com/rmariuzzo/checkboxes.js", "keywords": "checkbox checkboxes", "license": "MIT", diff --git a/src/jquery.checkboxes.js b/src/jquery.checkboxes.js index bd20bdd..ca3171f 100644 --- a/src/jquery.checkboxes.js +++ b/src/jquery.checkboxes.js @@ -31,7 +31,7 @@ * Toggle the state of all checkboxes in context. */ Checkboxes.prototype.toggle = function () { - this.$context.find(':checkbox').each(function () { + this.$context.find(':checkbox').filter(':not(:disabled)').each(function () { var $checkbox = $(this); $checkbox.prop('checked', !$checkbox.is(':checked')); }); diff --git a/test/test.html b/test/test.html index d31defe..320ba5b 100644 --- a/test/test.html +++ b/test/test.html @@ -7,7 +7,8 @@ -
@@ -19,7 +20,7 @@
- +
@@ -40,5 +41,11 @@
+ Check all + Uncheck all \ No newline at end of file