1jQuery(document).ready(function($){ 2 3 var error = true; 4 5 function addLoading( e ) 6 { 7 e.val( 'Recargar...' ).attr('disabled', true); 8 } 9 10 function removeLoading( e, value_submit ) 11 { 12 e.val(value_submit).attr('disabled', false); 13 } 14 15 function addError(msg, e, effect) 16 { 17 error = true; 18 e.removeClass('icon success'); 19 e.addClass('icon error'); 20 e.parent().find('.msg-error').text(msg); 21 if( effect !== undefined && effect == true ) 22 { 23 e.css({position:'relative'}).animate({left:-10}, 100).animate({left:10}, 100).animate({left:-5}, 100).animate({left:5}, 100).animate({left:0}, 100); 24 } 25 } 26 27 function addSuccess(e) 28 { 29 e.parents('li').addClass('icon success'); 30 } 31 32 function removeError(e) 33 { 34 error = false; 35 e.parent().find('.msg-error').text(''); 36 e.removeClass('icon error'); 37 addSuccess(e); 38 } 39 40 function checkRequired(e) { 41 var name = $(e).attr('name'); 42 jQuery.globalEval( 'var msg = error_messages.'+name ); 43 44 if( e.val() == '' ) 45 addError( msg, e ); 46 else 47 removeError(e); 48 } 49 50 function checkEmail(e) { 51 var expr = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/; 52 var name = $(e).attr('name'); 53 jQuery.globalEval( 'var msg = error_messages.'+name ); 54 55 if( ( e.val() != '' && !expr.test( e.val() ) ) || ( e.is('.required') && e.val() == '' ) ) 56 addError( msg, e ); 57 else 58 removeError(e); 59 } 60 61 $('.contact-form').each(function(){ 62 63 var form = $(this); 64 var value_submit = $('.sendmail', form).val(); 65 66 $('.required', form).each(function(){ 67 $(this).blur(function(){ 68 checkRequired( $(this) ); 69 }); 70 }); 71 72 $('.email-validate, form').each(function(){ 73 $(this).blur(function(){ 74 checkEmail( $(this) ); 75 }); 76 }); 77 78 $(form).submit(function(){ 79 addLoading( $('input:submit', form) ); 80 81 $('input, select, textarea', form).each(function(){ 82 if ( $(this).hasClass('required') ) checkRequired( $(this) ); 83 84 if ( $(this).hasClass('email-validate') ) checkEmail( $(this) ); 85 }); 86 87 $.post('sendmail.php', $(this).serialize()+'&ajax=1', function(msg) { 88 showMessage = function() { $('.usermessagea', form).css({opacity:0}).animate({opacity:1}, 500).html(msg); } 89 90 if ( form.is('#quick-form-footer') ) { 91 $('ul', form).slideUp(500, function(){ 92 showMessage(); 93 $( '<a href="#"> Close</a>' ).appendTo( $('.usermessagea', form).find('p') ).addClass('close_msg'); 94 }); 95 } else showMessage(); 96 97 removeLoading( $('.sendmail', form), value_submit ); 98 }); 99 return false; 100 }); 101 102 $('.close_msg').live( 'click', function(){ 103 $(this).parents('form').find('ul').slideDown(500); 104 $(this).parent().remove(); 105 return false; 106 }); 107 108 }); 109 110});
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.