1(function ($, w) { 2 $(document).ready(function () { 3 4 if($('#sa_get_in_touch_form').length === 0){ 5 return; 6 } 7 8 9 10 // var timer; 11 // var successExecuted = false; 12 $('#i_am_looking_for').change(function() { 13 var selectedValue = $(this).val(); 14 if (selectedValue === 'support') { 15 $(':button[type="submit"]').prop('disabled', true); 16 } else { 17 $(':button[type="submit"]').prop('disabled', false); 18 } 19 }); 20 21 $('#plugins').change(function() { 22 sa_purchase_code_verification_ajax(); 23 }); 24 25 $('#purchased_code').on('keyup', function(event) { 26 27 // console.log('Key up event occurred'); 28 // console.log('Value entered:', $(this).val()); 29 sa_purchase_code_verification_ajax(); 30 31 32 }); 33 34 function sa_purchase_code_verification_ajax(){ 35 // AJAX request to verify token 36 var purchase_code = $('#purchased_code').val(); 37 console.log('var purchase_code'); 38 console.log(purchase_code); 39 console.log('purchase_code.length'); 40 console.log(purchase_code.length); 41 if(purchase_code.length < 36 || purchase_code.length > 36){ 42 console.log('return if'); 43 return; 44 }else{ 45 console.log('return else'); 46 } 47 $.ajax({ 48 type: 'POST', 49 url: sa_bc_localized_objects.ajax.post.url, 50 data: { 51 action: sa_bc_localized_objects.ajax.post.action, 52 purchase_code, 53 }, 54 beforeSend: function(xhr) { 55 56 // console.log('Token verification before send :', xhr); 57 xhr.setRequestHeader('X-WP-Nonce', sa_bc_localized_objects.ajax.post.security); 58 // console.log('Token verification before send :', xhr); 59 $('#purchase_code_verification_wrapper').remove(); 60 $('#purchased_code').after('<div id="purchase_code_verification_wrapper"><span class="icon"><img src="/wp-content/plugins/sleekalgo-business-customizations/assets/frontend/images/loader.gif" class="purchase_code_loader" /></span><p class="error-msg">Your Request is processing please wait...</p></div>'); 61 }, 62 success: function(response) { 63 // Handle successful response 64 console.log('Token verification success:', response.success); 65 console.log('Token success check Data:', response.data.supported); 66 console.log('Token verification data:', response.data); 67 // console.log('Token verification Plugin Name :', response.data.verification_api_response.item.name); 68 var cross_icon = '<svg width="50px" height="25px" viewBox="0 0 25 25" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"><g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-469.000000, -1041.000000)" fill="#FF0000"><path d="M487.148,1053.48 L492.813,1047.82 C494.376,1046.26 494.376,1043.72 492.813,1042.16 C491.248,1040.59 488.712,1040.59 487.148,1042.16 L481.484,1047.82 L475.82,1042.16 C474.257,1040.59 471.721,1040.59 470.156,1042.16 C468.593,1043.72 468.593,1046.26 470.156,1047.82 L475.82,1053.48 L470.156,1059.15 C468.593,1060.71 468.593,1063.25 470.156,1064.81 C471.721,1066.38 474.257,1066.38 475.82,1064.81 L481.484,1059.15 L487.148,1064.81 C488.712,1066.38 491.248,1066.38 492.813,1064.81 C494.376,1063.25 494.376,1060.71 492.813,1059.15 L487.148,1053.48" id="cross" sketch:type="MSShapeGroup"></path></g></g></svg>'; 69 var right_icon = '<svg width="50px" height="25px" viewBox="0 -3 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"><g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-518.000000, -1039.000000)" fill="#00FF00"><path d="M548.783,1040.2 C547.188,1038.57 544.603,1038.57 543.008,1040.2 L528.569,1054.92 L524.96,1051.24 C523.365,1049.62 520.779,1049.62 519.185,1051.24 C517.59,1052.87 517.59,1055.51 519.185,1057.13 L525.682,1063.76 C527.277,1065.39 529.862,1065.39 531.457,1063.76 L548.783,1046.09 C550.378,1044.46 550.378,1041.82 548.783,1040.2" id="checkmark" sketch:type="MSShapeGroup"></path></g></g></svg>'; 70 // var item_name = response.data.verification_api_response.item.name; 71 var success = response.success; 72 var supported = response.data.supported; 73 var message = ''; 74 var colorClass = ''; 75 var icon = ''; 76 // console.log('Token verification data:', icon); 77 var plugins_option = $('#plugins').val(); 78 console.log('plugins values :', plugins_option); 79 80 81 if ( supported === 'Yes' && success === true) { 82 if(plugins_option === response.data.verification_api_response.item.name){ //item_name 83 $('button[type="submit"]').prop('disabled', false); 84 colorClass = 'green'; 85 icon = right_icon; 86 message = 'Your purchase code is supported.'; 87 88 }else{ 89 $('button[type="submit"]').prop('disabled', true); 90 colorClass = 'red'; 91 icon = cross_icon; 92 message = 'Your purchase code is supported but not for the selected item.'; 93 } 94 95 } else { 96 console.log('else'); 97 $('button[type="submit"]').prop('disabled', true); 98 colorClass = 'red'; 99 icon = cross_icon; 100 // message = 'Your purchase code is not supported.'; 101 message = supported === "No" ? 'Your purchase code is not supported.' : response.data; 102 // message = response.data; 103 104 } 105 106 $('#purchase_code_verification_wrapper').remove(); 107 $('#purchased_code').after('<div id="purchase_code_verification_wrapper"><span class="icon">'+icon+'</span><p class="error-msg" style="color:'+colorClass+'">' + message + '</p></div>'); 108 109 110 111 112 // $('#purchased_code').after('<p class="error-msg">' + message + '</p>'); 113 }, 114 error: function(xhr, status, error) { 115 // Handle error 116 console.log('Token verification error:', error); 117 } 118 }); 119 } 120 121 122 }); 123})(jQuery, window);
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.