1/** 2 * jQuery-Plugin "clearField" 3 * 4 * @version: 1.0, 31.07.2009 5 * 6 * @author: Stijn Van Minnebruggen 7 * [email protected] 8 * https://www.donotfold.be 9 * 10 * @example: $('selector').clearField(); 11 * @example: $('selector').clearField({ blurClass: 'myBlurredClass', activeClass: 'myActiveClass' }); 12 * 13 */ 14 15(function($) { 16 17jQuery.fn.clearField = function(settings) { 18 19 /** 20 * Settings 21 * 22 */ 23 24 settings = jQuery.extend({ 25 blurClass: 'clearFieldBlurred', 26 activeClass: 'clearFieldActive' 27 }, settings); 28 29 30 /** 31 * loop each element 32 * 33 */ 34 35 jQuery(this).each(function() { 36 37 /** 38 * Set element 39 * 40 */ 41 42 var el = jQuery(this); 43 44 45 /** 46 * Add rel attribute 47 * 48 */ 49 50 if(el.attr('rel') == undefined) { 51 el.attr('rel', el.val()).addClass(settings.blurClass); 52 } 53 54 55 /** 56 * Set focus action 57 * 58 */ 59 60 el.focus(function() { 61 62 if(el.val() == el.attr('rel')) { 63 el.val('').removeClass(settings.blurClass).addClass(settings.activeClass); 64 } 65 66 }); 67 68 69 /** 70 * Set blur action 71 * 72 */ 73 74 el.blur(function() { 75 76 if(el.val() == '') { 77 el.val(el.attr('rel')).removeClass(settings.activeClass).addClass(settings.blurClass); 78 } 79 80 }); 81 82 83 }); 84 85 return jQuery; 86 87}; 88 89})(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.