1 $(document).ready(function() { 2 $('#feedbackform').submit(function(e){ 3 e.preventDefault(); 4 can = true; 5 $(this).find('input, textarea, select').each(function(){ 6 if(valids($(this)) == false){ 7 can = false; 8 } 9 }); 10 if(can){ 11 formData = new FormData(); 12 if (formData) { 13 $(this).find('input:not([type=submit]), textarea').each(function(i, el) { 14 var name = $(el).attr('name'), 15 val = $(el).val(); 16 if ($(el)[0].files && $(el)[0].files.length>0) { 17 $.each($(el)[0].files, function(i1, file){ 18 formData.append(name, file); 19 }); 20 } else { 21 formData.append(name, val); 22 } 23 }); 24 } else { 25 formData = form.serialize(); 26 } 27 28 $.ajax({ 29 url: '/obratnaya-svyaz/', 30 processData: false, 31 contentType: false, 32 type: 'POST', 33 data: formData, 34 success: function(result) { 35 $('#feedbackform').find('select[name=title_prod] option:first').attr('selected','selected'); 36 $('#feedbackform').find('input[name=author]').val(''); 37 $('#feedbackform').find('input[name=phone]').val(''); 38 $('#feedbackform').find('input[name=email]').val(''); 39 $('#feedbackform').find('input[name=organization]').val(''); 40 $('#feedbackform').find('input[name=robot]').prop('checked', false); 41 $('#feedbackform').find('textarea[name=question]').val(''); 42 $('#modal_form') 43 .animate({opacity: 0, top: '45%'}, 200, 44 function(){ 45 $(this).css('display', 'none'); 46 $('#overlay').fadeOut(400); 47 } 48 ); 49 50 display_hide('.notif', 'ÐаÑе ÑообÑение ÑÑпеÑно оÑпÑавлено'); 51 } 52 }); 53 } 54 }); 55 56 $('#feedbackform input,textarea').on('blur', function(){ 57 valids($(this)); 58 }); 59 60 $('#feedbackform input, select').on('change', function(){ 61 valids($(this)); 62 }); 63 64}); 65 66 function display_hide(blockId, message){ 67 if(!message) message = "ÐаÑе ÑообÑение ÑÑпеÑно оÑпÑавлено."; 68 $(blockId).html(message); 69 if ($(blockId).css('display') == 'none') 70 { $(blockId).animate({height: 'show'}, 300); 71 setTimeout(function hide_block(){ 72 $(blockId).animate({height: 'hide'}, 300) 73 }, 3000) 74 } 75 } 76 77 function valids(obj){ 78 switch ($(obj).attr('name')) { 79 case 'author': 80 if($(obj).val()){ 81 show_hide($(obj), true); return true; 82 } else { 83 show_hide($(obj), false); return false; 84 } 85 break; 86 case 'email': 87 if($(obj).val()){ 88 var r = /^[\w\.\d-_]+@[\w\.\d-_]+\.\w{2,4}$/i; 89 if (r.test($(obj).val())) { 90 show_hide($(obj), true); return true; 91 } else { 92 show_hide($(obj), false); return false; 93 } 94 } else { 95 show_hide($(obj), false); return false; 96 } 97 break; 98 case 'phone': 99 if($(obj).val()){ 100 show_hide($(obj), true); return true; 101 } else { 102 show_hide($(obj), false); return false; 103 } 104 break; 105 case 'robot': 106 if($(obj).prop('checked')){ 107 show_hide($(obj), true); return true; 108 } else { 109 show_hide($(obj), false); return false; 110 } 111 break; 112 case 'question': 113 if($(obj).val()){ 114 show_hide($(obj), true); return true; 115 } else { 116 show_hide($(obj), false); return false; 117 } 118 break; 119 } 120 } 121 122 123 function show_hide(obj, what){ 124 if($(obj).attr('type') != 'submit'){ 125 if(what == true){ 126 $(obj).css('border', '1px solid #bdbdbd'); 127 128 if($(obj).attr('name') == 'robot'){ 129 $(obj).closest('form').find('label > span').css({'color':'#000'}); 130 } 131 } else { 132 if($(obj).attr('name') == 'robot'){ 133 $(obj).closest('form').find('label > span').css({'color':'red'}); 134 } 135 $(obj).css('border', '2px solid red'); 136 137 } 138 } else { 139 if(what == true){ 140 $(obj).prev('.error_label').css('opacity', '0'); 141 } else { 142 $(obj).prev('.error_label').css('opacity', '1'); 143 } 144 } 145 return true; 146 }
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.