1jQuery(document).ready(function($){ 2 3 setTimeout(function() { 4 // Get the current URL 5 var currentUrl = window.location.href; 6 7 // Check if 'checkout' is in the URL 8 if (currentUrl.indexOf('checkout') !== -1) { 9 // Check if '?add-to-cart=' is present in the URL 10 if (currentUrl.indexOf('?add-to-cart=') !== -1) { 11 // Remove the '?add-to-cart=<number>' from the URL, with or without a trailing slash 12 var newUrl = currentUrl.replace(/\?add-to-cart=\d+\/?/, ''); 13 14 // Update the URL without reloading the page 15 window.history.replaceState(null, '', newUrl); 16 } 17 } 18 }, 1000); // 1 second delay 19 20 21 22 var af_dgc_billing_city=af_dgc_checkout.af_dgc_billing_city; 23 var af_dgc_billing_address_2_placholder=af_dgc_checkout.af_dgc_billing_address_2_placholder; 24 var af_dgc_billing_address_2=af_dgc_checkout.af_dgc_billing_address_2; 25 var af_dgc_billing_address_1_placholder=af_dgc_checkout.af_dgc_billing_address_1_placholder; 26 var af_dgc_billing_address_1 = af_dgc_billing_address_2.af_dgc_billing_address_2; 27 var af_dgc_hide_additional_info_display=af_dgc_checkout.af_dgc_hide_additional_info; 28 29 setTimeout(() => { 30 31 // if (af_dgc_checkout.af_dgc_digital_goods_block_validation=='not_valid') { 32 // jQuery('<div class="wc-block-components-notice-banner is-error" role="alert">'+af_dgc_checkout.af_dgc_block_prevent_mixing_message+'</div>').insertBefore('.wp-block-woocommerce-checkout'); 33 // } 34 35 36 if ('yes'==af_dgc_hide_additional_info_display) {
37 jQuery('.woocommerce-additional-fields').hide(); 38 jQuery('.wp-block-woocommerce-checkout-order-note-block').hide(); 39 } 40 }, 2000); 41 42 43 jQuery('.variable_download_able_check').hide(); 44 45 jQuery('.variable_download_able_check_get_by').hide(); 46 47 48 jQuery('.quick_add_to_cart_button').click(function(e){ 49 50 e.preventDefault(); 51 var checkoutUrl = af_dgc_checkout.checkout_url_redirect; 52 53 }); 54 55 jQuery(document).on('click','.af-variable-product-download-able',function(e){ 56 e.preventDefault(); 57 $.ajax({ 58 type: 'POST', 59 url: af_dgc_checkout.ajax_url, 60 data: { 61 action: 'add_avariable_product', 62 form: $(this).closest('form').serialize(), 63 nonce: af_dgc_checkout.nonce 64 }, 65 success: function(response) { 66 if (response.data.redirect_url) { 67 window.location.href = response.data.redirect_url; 68 } 69 } 70 }); 71 }); 72 73 $('.variation_id').on('change', function() { 74 75 // Check if the .variable_download_able_check element exists 76 // if ($('.variable_download_able_check').length > 0) { 77 78 // Hide the download button initially 79 jQuery('.variable_download_able_check').hide(); 80 jQuery('.variable_download_able_check_get_by').hide(); 81 var newValue = $(this).val(); 82 83 if (newValue != 0 && newValue != '') { 84 85 if ($('.variable_download_able_check').length > 0) { 86 $.ajax({ 87 type: 'POST', 88 url: af_dgc_checkout.ajax_url, 89 data: { 90 action: 'check_variation_downloadable', 91 variation_id: newValue, 92 nonce: af_dgc_checkout.nonce 93 }, 94 success: function(response) { 95 if (response.success) { 96 if (response.data.downloadable) { 97 jQuery('.variable_download_able_check').show(); 98 var $button = jQuery('.variable_download_able_check'); 99 var currentHref = $button.attr('href'); 100 var updatedHref = currentHref.replace(/add-to-cart=\d+/, 'add-to-cart=' + newValue); 101 $button.attr('href', updatedHref); 102 $button.attr('data-product_id', newValue); 103 $button.attr('data-product_sku', response.data.variation_sku); 104 105 } else { 106 jQuery('.variable_download_able_check').hide(); 107 } 108 } 109 } 110 }); 111 112 113 } 114 115 if ($('.variable_download_able_check_get_by').length > 0) { 116 117 $.ajax({ 118 type: 'POST', 119 url: af_dgc_checkout.ajax_url, 120 data: { 121 action: 'check_variation_downloadable_get_by', 122 variation_id: newValue, 123 nonce: af_dgc_checkout.nonce 124 }, 125 success: function(response) { 126 if (response.success) { 127 if (response.data.downloadable) { 128 jQuery('.variable_download_able_check_get_by').show(); 129 var $button = jQuery('.variable_download_able_check_get_by'); 130 var currentHref = $button.attr('href'); 131 var updatedHref = currentHref.replace(/add-to-cart=\d+/, 'add-to-cart=' + newValue); 132 $button.attr('href', updatedHref); 133 $button.attr('data-product_id', newValue); 134 $button.attr('data-product_sku', response.data.variation_sku); 135 } else { 136 jQuery('.variable_download_able_check_get_by').hide(); 137 } 138 } 139 } 140 }); 141 } 142 } 143 144 145 // } 146 147 148 }); 149 150 151 152 153 154 155}); 156// jQuery(document).ready(function() { 157// jQuery('.dgc_shop_page').on('click', function(e) { 158// var checkoutUrl = af_dgc_checkout.checkout_url_redirect; 159// e.preventDefault(); // Prevent any default action 160 161// // Trigger the default "Add to Cart" button 162// // jQuery('button[name="add-to-cart"]').click(); 163 164// // Delay for a few seconds and then redirect to the checkout page 165// setTimeout(function() { 166// window.location.href = checkoutUrl; // Replace with your checkout page URL 167// }, 3000); // 3000 milliseconds = 3 seconds 168// }); 169// }); 170// jQuery(document).ready(function() { 171// jQuery('.dgc_shop_detail_page').on('click', function(e) { 172// var checkoutUrl = af_dgc_checkout.checkout_url_redirect; 173// e.preventDefault(); // Prevent any default action 174// // Delay for a few seconds and then redirect to the checkout page 175// setTimeout(function() { 176// window.location.href = checkoutUrl; // Replace with your checkout page URL 177// }, 5000); // 3000 milliseconds = 3 seconds 178// }); 179// }); 180 181 182jQuery(document).ready(function() { 183 // Variables declaration 184 var af_dgc_enable_goods_setting=af_dgc_checkout.af_dgc_enable_goods_setting; 185 186 if ('yes'==af_dgc_enable_goods_setting) { 187 188 var af_dgc_billing_city = af_dgc_checkout.af_dgc_billing_city; 189 var af_dgc_billing_address_2_placholder = af_dgc_checkout.af_dgc_billing_address_2_placholder; 190 var af_dgc_billing_address_2 = af_dgc_checkout.af_dgc_billing_address_2; 191 var af_dgc_billing_address_1_placholder = af_dgc_checkout.af_dgc_billing_address_1_placholder; 192 var af_dgc_billing_address_1 = af_dgc_checkout.af_dgc_billing_address_1; 193 var af_dgc_billing_state =af_dgc_checkout.af_dgc_billing_state; 194 var af_dgc_billing_postcode=af_dgc_checkout.af_dgc_billing_postcode; 195 setTimeout(function() { 196 // Label for billing_city 197 if (af_dgc_billing_city) { 198 jQuery('label[for="billing_city"]').text(af_dgc_billing_city); 199 console.log("billing_city label changed"); 200 } 201 202 // Placeholder and text for billing_address_2 203 if (af_dgc_billing_address_2_placholder) { 204 jQuery('input[name="billing_address_2"]').attr('placeholder', af_dgc_billing_address_2_placholder); 205 } 206 if (af_dgc_billing_address_2) { 207 jQuery('label[for="billing_address_2"]').text(af_dgc_billing_address_2); 208 } 209 210 // Placeholder and text for billing_address_1 211 if (af_dgc_billing_address_1_placholder) { 212 jQuery('input[name="billing_address_1"]').attr('placeholder', af_dgc_billing_address_1_placholder); 213 } 214 if (af_dgc_billing_address_1) { 215 jQuery('label[for="billing_address_1"]').text(af_dgc_billing_address_1); 216 } 217 if (af_dgc_billing_state) { 218 jQuery('label[for="billing_state"]').text(af_dgc_billing_state); 219 } 220 221 // Label for Postcode / ZIP 222 if (af_dgc_billing_postcode) { 223 jQuery('label[for="billing_postcode"]').text(af_dgc_billing_postcode); 224 } 225 226 }, 2000); // 2000 milliseconds = 2 seconds 227 } 228}); 229
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.