/* * fancyCheckbox v1.0.0 - change checkbox's style jQuery plug-in. * http://web.r-studio.jp/javascript/jquery/fancyCheckboxes.html * * Copyright 2010, Risa Yuguchi * licensed under the MIT License * http://www.opensource.org/licenses/mit-license.php * * Original code and Special Thanks: Aaron Weyenberg * see: http://aaronweyenberg.com/90/pretty-checkboxes-with-jquery/ * * Demo: * http://www.r-studio.jp/demo/jqueryform/fancyCheckboxes.html * */ (function(b){var a={fancyCheckbox:function(c){var d=b.extend({select:"select",cancel:"cancel"},c);this.each(function(e){if(b(":checkbox",this).length<1){return}var f=this;b(":reset",b(this).parents("form")).click(function(){b("li",f).each(function(){if(b.data(this,"defaultValue")){b(this).addClass("selected")}else{b(this).removeClass("selected")}})});b("label",this).click(function(g){g.preventDefalt()}).each(function(h){var g=b(this).attr("for");b(this).parent().attr("id","box-"+g)}).after(''+d.select+''+d.cancel+"");b("input:checked",this).parent().addClass("selected");b("li",this).click(function(g){g.preventDefault();if(b(this).hasClass("selected")){b(this).removeClass("selected");b(":checkbox",this).attr("checked",false)}else{b(this).addClass("selected");b(":checkbox",this).attr("checked",true)}}).each(function(){var g="pointer";if("msie"==b.browser){g="hand"}b(this).addClass("fancyCheckbox");b(this).css("cursor",g);b.data(this,"defaultValue",b(":checkbox",this).attr("checked"));b(":checkbox",this).css("display","none")})});return this}};b.each(a,function(c){b.fn[c]=this})}(jQuery));