1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/* ============================================================= 11 * flatui-checkbox.js v0.0.3 12 * ============================================================ */ 13 14!function ($) { 15 16 /* CHECKBOX PUBLIC CLASS DEFINITION 17 * ============================== */ 18 19 var Checkbox = function (element, options) { 20 this.init(element, options); 21 } 22 23 Checkbox.prototype = { 24 25 constructor: Checkbox 26 27 , init: function (element, options) { 28 var $el = this.$element = $(element) 29 30 this.options = $.extend({}, $.fn.checkbox.defaults, options); 31 $el.before(this.options.template); 32 this.setState(); 33 } 34 35 , setState: function () { 36 var $el = this.$element 37 , $parent = $el.closest('.checkbox'); 38 39 $el.prop('disabled') && $parent.addClass('disabled'); 40 $el.prop('checked') && $parent.addClass('checked'); 41 } 42 43 , toggle: function () { 44 var ch = 'checked' 45 , $el = this.$element 46 , $parent = $el.closest('.checkbox') 47 , checked = $el.prop(ch) 48 , e = $.Event('toggle') 49 50 if ($el.prop('disabled') == false) { 51 $parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch); 52 $el.trigger(e).trigger('change'); 53 } 54 } 55 56 , setCheck: function (option) { 57 var d = 'disabled' 58 , ch = 'checked' 59 , $el = this.$element 60 , $parent = $el.closest('.checkbox') 61 , checkAction = option == 'check' ? true : false 62 , e = $.Event(option) 63 64 $parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch); 65 $el.trigger(e).trigger('change'); 66 } 67 68 } 69 70 71 /* CHECKBOX PLUGIN DEFINITION 72 * ======================== */ 73 74 var old = $.fn.checkbox 75 76 $.fn.checkbox = function (option) { 77 return this.each(function () { 78 var $this = $(this) 79 , data = $this.data('checkbox') 80 , options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option); 81 if (!data) $this.data('checkbox', (data = new Checkbox(this, options))); 82 if (option == 'toggle') data.toggle() 83 if (option == 'check' || option == 'uncheck') data.setCheck(option) 84 else if (option) data.setState(); 85 }); 86 } 87 88 $.fn.checkbox.defaults = { 89 template: '<span class="icons"><span class="first-icon fui-checkbox-unchecked"></span><span class="second-icon fui-checkbox-checked"></span></span>' 90 } 91 92 93 /* CHECKBOX NO CONFLICT 94 * ================== */ 95 96 $.fn.checkbox.noConflict = function () { 97 $.fn.checkbox = old; 98 return this; 99 } 100 101 102 /* CHECKBOX DATA-API 103 * =============== */ 104 105 $(document).on('click.checkbox.data-api', '[data-toggle^=checkbox], .checkbox', function (e) { 106 var $checkbox = $(e.target); 107 if (e.target.tagName != "A") { 108 e && e.preventDefault() && e.stopPropagation(); 109 if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox'); 110 $checkbox.find(':checkbox').checkbox('toggle'); 111 } 112 }); 113 114 $(function () { 115 $('[data-toggle="checkbox"]').each(function () { 116 var $checkbox = $(this); 117 $checkbox.checkbox(); 118 }); 119 }); 120 121}(window.jQuery); 122}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.