1(function( $ ){ 2 3 $.fn.inputDefault = function( options ) { 4 5 var settings = { 6 'text' : 'B\xfasqueda...', 7 'default-color' : '#666666', 8 'writing-color' : '#000000', 9 'password' : false 10 }; 11 12 13 14 return this.each(function() { 15 // If options exist, lets merge them 16 // with our default settings 17 if ( options ) { 18 $.extend( settings, options ); 19 } 20 21 function getVal(){ alert('ea'); } 22 23 settings['text']=unescape(settings['text']); 24 25 var $this = $(this); 26 27 $this.attr('default', settings['text']); 28 29 if($this.val()==''){ 30 $this.val(settings['text']); 31 $this.css('color', settings['default-color']); 32 } 33 34 if(settings['password']){ 35 var id=$this.attr('id'); 36 37 if($this.is('input')) $('#'+settings['password']).append('<input type="text" id="'+id+'_clone" />'); 38 else $('#'+settings['password']).append('<textarea id="'+id+'_clone"></textarea>'); 39 40 var $clone=$('#'+id+'_clone'); 41 $this.hide(); 42 43 $clone.val(settings['text']); 44 $clone.css('color', settings['default-color']); 45 46 $clone.focus(function(){ 47 $this.show(); 48 $clone.hide(); 49 $this.val(""); 50 $this.focus(); 51 }); 52 } 53 54 $this.focus(function(){ 55 if($this.val()==settings['text']){ 56 $this.val(""); 57 $this.css('color', settings['writing-color']); 58 } 59 }); 60 61 $this.blur(function(){ 62 if($this.val().replace(' ','')==""){ 63 $this.val(settings['text']); 64 $this.css('color', settings['default-color']); 65 if(settings['password']){ 66 $this.hide(); 67 $clone.show(); 68 } 69 } 70 }); 71 72 }); 73 74 }; 75 76 $.fn.getVal = function( options ) { 77 var val=this.val(); 78 var def=this.attr('default'); 79 80 if(val!=def) return val; 81 return ''; 82 }; 83 84 $.fn.isDefault = function( options ) { 85 var val=this.getVal(); 86 if(val=='') return true; 87 return false; 88 }; 89 90})( 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.