Файл: install/tpl/js/checkbox.js
Строк: 90
<?php
!function($){var old=$.fn.checkbox;var Checkbox=function(element,options){this.$element=$(element);this.options=$.extend({},$.fn.checkbox.defaults,options);this.$label=this.$element.parent();this.$icon=this.$label.find("i");this.$chk=this.$label.find("input[type=checkbox]");this.setState(this.$chk);this.$chk.on("change",$.proxy(this.itemchecked,this))};Checkbox.prototype={constructor:Checkbox,setState:function($chk){$chk=$chk||this.$chk;var checked=$chk.is(":checked");var disabled=!!$chk.prop("disabled");this.$icon.removeClass("checked disabled");if(checked===true){this.$icon.addClass("checked")}if(disabled===true){this.$icon.addClass("disabled")}},enable:function(){this.$chk.attr("disabled",false);this.$icon.removeClass("disabled")},disable:function(){this.$chk.attr("disabled",true);this.$icon.addClass("disabled")},toggle:function(){this.$chk.click()},itemchecked:function(e){var chk=$(e.target);this.setState(chk)},check:function(){this.$chk.prop("checked",true);this.setState(this.$chk)},uncheck:function(){this.$chk.prop("checked",false);this.setState(this.$chk)},isChecked:function(){return this.$chk.is(":checked")}};$.fn.checkbox=function(option){var args=Array.prototype.slice.call(arguments,1);var methodReturn;var $set=this.each(function(){var $this=$(this);var data=$this.data("checkbox");var options=typeof option==="object"&&option;if(!data){$this.data("checkbox",(data=new Checkbox(this,options)))}if(typeof option==="string"){methodReturn=data[option].apply(data,args)}});return(methodReturn===undefined)?$set:methodReturn};$.fn.checkbox.defaults={};$.fn.checkbox.Constructor=Checkbox;$.fn.checkbox.noConflict=function(){$.fn.checkbox=old;return this};$(function(){$(window).on("load",function(){$(".checkbox-custom > input[type=checkbox]").each(function(){var $this=$(this);if($this.data("checkbox")){return}$this.checkbox($this.data())})})})}(window.jQuery);
?>