1/** 2 * ezMark - A Simple Checkbox and Radio button Styling plugin. 3 * This plugin allows you to use a custom Image for Checkbox or Radio button. Its very simple, small and easy to use. 4 * 5 * Copyright (c) Abdullah Rubiyath <http://www.itsalif.info/>. 6 * Released under MIT License 7 * 8 * Files with this plugin: 9 * - jquery.ezmark.js 10 * - ezmark.css 11 * 12 * <usage> 13 * At first, include both the css and js file at the top 14 * 15 * Then, simply use: 16 * $('selector').ezMark([options]); 17 * 18 * [options] accepts following JSON properties: 19 * checkboxCls - custom Checkbox Class 20 * checkedCls - checkbox Checked State's Class 21 * radioCls - custom radiobutton Class 22 * selectedCls - radiobutton's Selected State's Class 23 * 24 * </usage> 25 * 26 * View Documention/Demo here: 27 * http://www.itsalif.info/content/ezmark-jquery-checkbox-radiobutton-plugin 28 * 29 * @author Abdullah Rubiyath 30 * @version 1.0 31 * @date June 27, 2010 32 */ 33 34(function($) { 35 $.fn.ezMark = function(options) { 36 options = options || {}; 37 var defaultOpt = { 38 checkboxCls : options.checkboxCls || 'ez-checkbox' , radioCls : options.radioCls || 'ez-radio' , 39 checkedCls : options.checkedCls || 'ez-checked' , selectedCls : options.selectedCls || 'ez-selected' , 40 hideCls : 'ez-hide' 41 }; 42 return this.each(function() { 43 var $this = $(this); 44 var wrapTag = $this.attr('type') == 'checkbox' ? '<div class="'+defaultOpt.checkboxCls+'">' : '<div class="'+defaultOpt.radioCls+'">'; 45 // for checkbox 46 if( $this.attr('type') == 'checkbox') { 47 $this.addClass(defaultOpt.hideCls).wrap(wrapTag).change(function() { 48 if( $(this).is(':checked') ) { 49 $(this).parent().addClass(defaultOpt.checkedCls).removeClass('ezError'); 50 } 51 else { $(this).parent().removeClass(defaultOpt.checkedCls + ' ezError'); } 52 }); 53 54 if( $this.is(':checked') ) { 55 $this.parent().addClass(defaultOpt.checkedCls); 56 } 57 } 58 else if( $this.attr('type') == 'radio') { 59 60 $this.addClass(defaultOpt.hideCls).wrap(wrapTag).change(function() { 61 // radio button may contain groups! - so check for group 62 $('input[name="'+$(this).attr('name')+'"]').each(function() { 63 if( $(this).is(':checked') ) { 64 $(this).parent().addClass(defaultOpt.selectedCls); 65 } else { 66 $(this).parent().removeClass(defaultOpt.selectedCls); 67 } 68 }); 69 }); 70 71 if( $this.is(':checked') ) { 72 $this.parent().addClass(defaultOpt.selectedCls); 73 } 74 } 75 }); 76 } 77})(jQuery);
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.