1(function( $ ){ 2 3 //// ---> Check issue element 4 jQuery.fn.exists = function() 5 { 6 return jQuery(this).length; 7 } 8 9 $(function() 10 { 11 12 // if(!is_mobile()) 13 // { 14 15 if( $('.order_phonefield').exists()) 16 { 17 $('.order_phonefield').mask('+7 (999) 999-99-99?9'); 18 } 19 20 if( $('.order_form_check').exists()) 21 { 22 $('.order_form_check').each(function(){ 23 24 25 var form = $(this), 26 btn = form.find('.btnsubmit'); 27 28 form.find('.rfield').addClass('empty_field').parents('.rline').append('<span class="rfield_error">Çàïîëíèòå ýòî ïîëå</span>'); 29 btn.addClass('disabled'); 30 31 // Ôóíêöèÿ ïðîâåðêè ïîëåé ôîðìû 32 function checkInput(){ 33 34 form.find('.rfield').each(function(){ 35 36 37 38 if($(this).hasClass('order_phonefield')){ 39 40 var pmc = $(this); 41 if ( (pmc.val().indexOf("_") != -1) || pmc.val() == '' ) { 42 pmc.addClass('empty_field'); 43 } else { 44 pmc.removeClass('empty_field'); 45 } 46 47 } else if($(this).hasClass('mailfield')) { 48 49 var mailfield = $(this); 50 var pattern = /^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$/i; 51 if(pattern.test(mailfield.val())){ 52 mailfield.removeClass('empty_field'); 53 } else { 54 mailfield.addClass('empty_field'); 55 } 56 } else if($(this).val() != '') { 57 58 $(this).removeClass('empty_field'); 59 60 } else { 61 62 $(this).addClass('empty_field'); 63 } 64 65 }); 66 67 68 // Ïðîâåðêà ïîëåé Input radio îðãàíèçàöèÿ/÷àñòíîå ëèöî 69 radio = form.find('input:radio:first'); 70 radio1 = form.find('input:radio:last'); 71 72 if(radio.is(':checked')){ 73 radio.removeClass('empty_field') 74 var sizeOrg = form.find('#org_name').length; 75 $("#org").show("slow"); 76 if(sizeOrg != 1){ 77 $("#org").html('<label for="org_name">Íàèìåíîâàíèå îðãàíèçàöèè:</label><span class="rfield_error">Çàïîëíèòå ýòî ïîëå</span>
77<input type="text" class="rfield empty_field" id="org_name" name="org_name" placeholder="Íàèìåíîâàíèå îðãàíèçàöèè"/>'); 78 } 79 80 } 81 else if(radio1.is(':checked')){ 82 radio1.removeClass('empty_field') 83 $("#org").html(''); 84 $("#org").hide("slow"); 85 } 86 else 87 { 88 radio.addClass('empty_field') 89 radio1.addClass('empty_field') 90 } 91 92 93 // Ïðîâåðêà ïîëåé Input radio îðãàíèçàöèÿ/÷àñòíîå ëèöî 94 95 96 97 } 98 99 // Ôóíêöèÿ ïîäñâåòêè íåçàïîëíåííûõ ïîëåé 100 function lightEmpty(){ 101 form.find('.empty_field').addClass('rf_error'); 102 form.find('.empty_field').parents('.rline').find('.rfield_error').css({'visibility':'visible'}); 103 104 setTimeout(function(){ 105 form.find('.empty_field').removeClass('rf_error'); 106 form.find('.empty_field').parents('.rline').find('.rfield_error').css({'visibility':'hidden'}); 107 },2000); 108 } 109 110 // Ïîëñåêóíäíàÿ ïðîâåðêà 111 setInterval(function(){ 112 checkInput(); 113 var sizeEmpty = form.find('.empty_field').length; 114 if(sizeEmpty > 0){ 115 if(btn.hasClass('disabled')){ 116 return false 117 } else { 118 btn.addClass('disabled') 119 } 120 } else { 121 btn.removeClass('disabled') 122 } 123 },500); 124 125 // Êëèê ïî êíîïêå 126 btn.click(function(){ 127 if($(this).hasClass('disabled')){ 128 lightEmpty(); 129 return false 130 } else { 131 132 AjaxFormSendOrder('order_mail', 'order_send_mail', '/mag/check.php'); 133 134 } 135 }); 136 137 }); 138 139 } 140 // } 141 142 }); 143 144})( jQuery ); 145
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.