1(function ($) { 2 /** 3 * refresh cart when payment method changed 4 */ 5 if (awdr_params.refresh_order_review == '1') { 6 $(document).on('change', 'input[name="payment_method"],input[name="billing_city"],input[name="billing_postcode"]', function () { 7 refreshCart(); 8 }); 9 10 /** 11 * refresh cart when Email changed 12 */ 13 $(document).on('blur', 'input[name="billing_email"], select#billing_state', function () { 14 refreshCart(); 15 }); 16 } 17 18 function refreshCart() { 19 $('body').trigger('update_checkout'); 20 } 21 22 $(document).ready(function ($) { 23 function init_events() { 24 if (awdr_params.enable_update_price_with_qty == 'show_dynamically') { 25 function getWDRDPTarget(form, target, is_variable){ 26 let $price_place = ''; 27 if (form.find(target).length) { 28 $price_place = form.find(target).first(); 29 if(is_variable === true){ 30 if (!form.find(target+' .price').length) { 31 $price_place.html("<div class='price'></div>"); 32 } 33 $price_place = form.find(target+' .price').first(); 34 } 35 } else { 36 $price_place = $(target).first(); 37 if(is_variable === true){ 38 if (!$(target+' .price').length) { 39 $price_place.html("<div class='price'></div>"); 40 } 41 $price_place = $(target+' .price').first(); 42 } 43 } 44 return $price_place; 45 } 46 $(document).on('change', '[name="quantity"]', function (){ 47 var awdr_qty_object = $(this); 48 setTimeout(function(){ 49 var $qty = awdr_qty_object.val(); 50 var $product_id = 0; 51 var $price_place = ""; 52 var form = awdr_qty_object.closest("form"); 53 if (form.find('button[name="add-to-cart"]').length) { 54 $product_id = form.find('button[name="add-to-cart"]').first().val(); 55 var target = 'div.product p.price'; 56 if(awdr_params.custom_target_simple_product != undefined){ 57 if(awdr_params.custom_target_simple_product != ""){ 58 target = awdr_params.custom_target_simple_product; 59 } 60 } 61 $price_place = getWDRDPTarget(form, target, false); 62 } else if (form.find('input[name="variation_id"]').length) { 63 $product_id = form.find('input[name="variation_id"]').val(); 64 var target = 'div.product .woocommerce-variation-price'; 65 if(awdr_params.custom_target_variable_product != undefined){ 66 if(awdr_params.custom_target_variable_product != ""){ 67 target = awdr_params.custom_target_variable_product; 68 } 69 } 70 $price_place = getWDRDPTarget(form, target, true); 71 } else if (form.find('input[name="add-to-cart"]').length) { 72 $product_id = form.find('input[name="add-to-cart"]').first().val(); 73 var target = 'div.product p.price'; 74 if(awdr_params.custom_target_simple_product != undefined){ 75 if(awdr_params.custom_target_simple_product != ""){ 76 target = awdr_params.custom_target_simple_product; 77 } 78 } 79 $price_place = getWDRDPTarget(form, target, false); 80 } 81 if(!$product_id || $product_id == 0){ 82 if(awdr_params.custom_simple_product_id_selector != undefined){ 83 if(awdr_params.custom_simple_product_id_selector != ""){ 84 let simple_product_id_selector = awdr_params.custom_simple_product_id_selector; 85 $product_id = $(simple_product_id_selector).val(); 86 let target = 'div.product p.price'; 87 if(awdr_params.custom_target_simple_product != undefined){ 88 if(awdr_params.custom_target_simple_product != ""){ 89 target = awdr_params.custom_target_simple_product; 90 } 91 } 92 $price_place = getWDRDPTarget(form, target, false); 93 } 94 } 95 96 if(awdr_params.custom_variable_product_id_selector != undefined){ 97 if(awdr_params.custom_variable_product_id_selector != ""){ 98 let variable_product_id_selector = awdr_params.custom_variable_product_id_selector; 99 $product_id = $(variable_product_id_selector).val(); 100 let target = 'div.product .woocommerce-variation-
100price'; 101 if(awdr_params.custom_target_variable_product != undefined){ 102 if(awdr_params.custom_target_variable_product != ""){ 103 target = awdr_params.custom_target_variable_product; 104 } 105 } 106 $price_place = getWDRDPTarget(form, target, true); 107 } 108 } 109 } 110 111 if (!$product_id || !$price_place || $product_id == 0) { 112 return; 113 } 114 115 var data = { 116 action: 'wdr_ajax', 117 method: 'get_price_html', 118 product_id: $product_id, 119 qty: $qty, 120 awdr_nonce: awdr_params.nonce, 121 }; 122 $.ajax({ 123 url: awdr_params.ajaxurl, 124 data: data, 125 type: 'POST', 126 success: function (response) { 127 if (response.price_html) { 128 $price_place.html(response.price_html) 129 } else { 130 if(response.original_price_html != undefined){ 131 $price_place.html(response.original_price_html) 132 } 133 } 134 }, 135 error: function (response) { 136 $price_place.html("") 137 } 138 }); 139 }, 0); 140 }); 141 } 142 } 143 144 if (awdr_params.js_init_trigger) { 145 $(document).on(awdr_params.js_init_trigger, function () { 146 init_events(); 147 }); 148 } 149 init_events(); 150 151 if (awdr_params.awdr_dynamic_bulk_table_status == "1") { 152 if(awdr_params.awdr_dynamic_bulk_table_off == "on"){ 153 function awdr_load_variation_table(variation_id){ 154 setTimeout(function(){ 155 if(variation_id != '' && variation_id != '0'){ 156 var data = { 157 action: 'wdr_ajax', 158 method: 'get_variable_product_bulk_table', 159 product_id: variation_id, 160 awdr_nonce: awdr_params.nonce, 161 }; 162 163 let awdr_opacity = 'div.awdr-bulk-customizable-table'; 164 165 if(awdr_params.awdr_opacity_to_bulk_table != undefined){ 166 if(awdr_params.awdr_opacity_to_bulk_table != ""){ 167 awdr_opacity = awdr_params.awdr_opacity_to_bulk_table; 168 } 169 } 170 171 $.ajax({ 172 url: awdr_params.ajaxurl, 173 data: data, 174 type: 'POST', 175 beforeSend: function () { 176 $(awdr_opacity).css('opacity','0.5'); 177 }, 178 complete: function () { 179 $(awdr_opacity).css('opacity','1'); 180 }, 181 success: function (response) { 182 if (response.bulk_table) { 183 $('.awdr-bulk-customizable-table').html(response.bulk_table); 184 } 185 }, 186 error: function (response) { 187 $('.awdr-bulk-customizable-table').html("") 188 } 189 }); 190 } 191 }, 100); 192 } 193 $( ".single_variation_wrap" ).on( "hide_variation", function ( event ) { 194 let variation_id = $(this).closest('form').find('input[name="product_id"]').val(); 195 awdr_load_variation_table(variation_id); 196 }); 197 $( ".single_variation_wrap" ).on( "show_variation", function ( event, variation, purchasable ) { 198 let variation_id = variation.variation_id; 199 if(variation.is_bundled != undefined){ 200 if(variation.is_bundled == true){ 201 return; 202 } 203 } 204 awdr_load_variation_table(variation_id); 205 }); 206 } 207 } 208 }); 209})(jQuery);
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.