1jQuery( document ).ready( function( $ ) { 2 3 $(".generate_sku_array").click(function () { 4 $('.sku-count').text("Ä¢enerÄ produktu sarakstu..."); 5 $.ajax({ 6 type: "POST", 7 url: "/wp-admin/admin-ajax.php", 8 data: { 9 action: 'getAllProductsSku', 10 }, 11 success:function(response) 12 { 13 const skuArray = []; 14 15 skuArray.push(response['data']); 16 recursiveData(response['data']) 17 $("#myBar").attr("max-val", response['data'].length); 18 $('.sku-count').text("Izveido XLS failu..."); 19 20 } 21 }); 22 }); 23 24 $(".mark_all_products").click(function () { 25 console.log('button pressed'); 26 $('.loader').css('display', 'block'); 27 // $('.sku-count').text("Ä¢enerÄ produktu sarakstu..."); 28 $.ajax({ 29 type: "POST", 30 url: "/wp-admin/admin-ajax.php", 31 data: { 32 action: 'markAllProducts', 33 }, 34 success:function(response) 35 { 36 // console.log(response) 37 $('.loader').css('display', 'none'); 38 alert(`${response.data} produktiem uzlikta atlikumu pÄrvaldÄ«ba`) 39 // const skuArray = []; 40 // 41 // skuArray.push(response['data']); 42 // recursiveData(response['data']) 43 // $("#myBar").attr("max-val", response['data'].length); 44 // $('.sku-count').text("Izveido XLS failu..."); 45 46 } 47 }); 48 }); 49 50 51 $(".update_all_products").click(function () { 52 console.log('update button pressed'); 53 $('.loader').css('display', 'block'); 54 // $('.sku-count').text("Ä¢enerÄ produktu sarakstu..."); 55 $.ajax({
56 type: "POST", 57 url: "/wp-admin/admin-ajax.php", 58 data: { 59 action: 'updateProducts', 60 }, 61 success:function(response) 62 { 63 console.log(response) 64 $('.loader').css('display', 'none'); 65 alert('Visi produkti atjaunoti.') 66 // const skuArray = []; 67 // 68 // skuArray.push(response['data']); 69 // recursiveData(response['data']) 70 // $("#myBar").attr("max-val", response['data'].length); 71 // $('.sku-count').text("Izveido XLS failu..."); 72 73 } 74 }); 75 }); 76 77 var i = 1; 78 var z = 1; 79 var line = 2; 80 81 82 function recursiveData(data){ 83 $("#myBar").attr("startval", i++); 84 var maxval = $("#myBar").attr("max-val"); 85 var result = i * 100 / maxval; 86 // console.log(result) 87 88 const skuArray = data 89 const remove_Item = data[0] 90 $.ajax({
91 type: "POST", 92 url: "/wp-admin/admin-ajax.php", 93 data: { 94 xlsLine: line, 95 skuArray: remove_Item, 96 entry: skuArray.length, 97 action: 'generateXLS', 98 }, 99 success:function(response) 100 { 101 console.log(response) 102 $('.sku-count').text("Raksta informÄciju XLS failÄ..."); 103 const newSkuArray = $.grep(skuArray, function(value) { 104 return value != remove_Item; 105 }); 106 if (typeof newSkuArray !== 'undefined' && newSkuArray.length > 0) { 107 line++; 108 $("#myBar").css("width", result+'%') 109 recursiveData(newSkuArray); 110 }else { 111 $('.sku-count').text("Pabeigts."); 112 $("#myBar").css("width", 0) 113 i = 1; 114 line = 2; 115 } 116 }, 117 }); 118 } 119 $(".update_product_stock").click(function () { 120 $('.product-count').text("Ä¢enerÄ produktu sarakstu..."); 121 $.ajax({
122 type: "POST", 123 url: "/wp-admin/admin-ajax.php", 124 data: { 125 action: 'getAllProductsSku', 126 }, 127 success:function(response) 128 { 129 const skuArray = []; 130 // skuArray.push(response['data']); 131 $("#myBar2").attr("max-val", response['data'].length); 132 recursiveProductUpdateData(response['data']) 133 // $('.sku-count').text("Izveido XLS failu..."); 134 } 135 }); 136 }); 137 var counter = 0; 138 function recursiveProductUpdateData(data){ 139 140 $("#myBar2").attr("startval", z++); 141 var maxval = $("#myBar2").attr("max-val"); 142 var result = z * 100 / maxval; 143 144 const skuArray = data 145 const remove_Item = data[0] 146 $.ajax({ 147 type: "POST", 148 url: "/wp-admin/admin-ajax.php", 149 data: { 150 skuArray: remove_Item, 151 entry: skuArray.length, 152 counter: counter, 153 action: 'updateProductStock', 154 }, 155 success:function(response) 156 { 157 // console.log(response) 158 if (response['data']['productUpdate']==true){ 159 counter++; 160 } 161 console.log(counter) 162 163 $('.product-count').text("Atjauno produktu atlikumus..."); 164 const newSkuArray = $.grep(skuArray, function(value) { 165 return value != remove_Item; 166 }); 167 if (typeof newSkuArray !== 'undefined' && newSkuArray.length > 0) { 168 $("#myBar2").css("width", result+'%') 169 recursiveProductUpdateData(newSkuArray); 170 }else { 171 $('.product-count').text("Pabeigts."); 172 $("#myBar2").css("width", 0) 173 z = 1; 174 counter = 0; 175 } 176 }, 177 }); 178 } 179 180 181} );
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.