https://ressource-peintures.com/wp-content/plugins/advanced-dynami…/assets/js/frontend.js?ver=4.13.1
1jQuery(document).ready(function ($) { 2 var variable_id = jQuery('[name="product_id"]').val(); 3 var available_ids = []; 4 var variable_bulk_table = ""; 5 6 function get_table(product_id, updateBulkTable = false) { 7 8 if (typeof jQuery('.wdp_bulk_table_content').attr('data-available-ids') !== 'undefined') { 9 available_ids = JSON.parse(jQuery('.wdp_bulk_table_content').attr('data-available-ids')); 10 } 11 12 if (available_ids.indexOf(parseInt(product_id)) === -1) { 13 return; 14 } 15 16 if (product_id === variable_id && variable_bulk_table && !updateBulkTable) { 17 jQuery('.wdp_bulk_table_content').html(variable_bulk_table) 18 return true; 19 } 20 21 let attributes = {}; 22 23 jQuery('form.variations_form[data-product_id=' + variable_id + '] select').each(function (index, item) { 24 if (jQuery(item).attr("data-attribute_name")) { 25 attributes[jQuery(item).attr("data-attribute_name")] = jQuery(this).val(); 26 } 27 }); 28 29 var data = { 30 action: 'get_table_with_product_bulk_table', 31 product_id: parseInt(product_id), 32 attributes: attributes, 33 ...jQuery('form.cart').triggerHandler('wdp_get_custom_data') 34 }; 35 36 return jQuery.ajax({ 37 url: script_data.ajaxurl, 38 data: data, 39 dataType: 'json', 40 type: 'POST', 41 success: function (response) { 42 if (response.success) { 43 jQuery('.wdp_bulk_table_content').each(function (_, item) { 44 let jQItem = jQuery(item); 45 let availableIds = JSON.parse(jQItem.attr('data-available-ids')); 46 47 if (availableIds.indexOf(parseInt(product_id)) === -1) { 48 return; 49 } 50 51 jQItem.html(jQuery(response.data).children()).trigger('update'); 52 }); 53 init_custom_event(); 54 if (product_id === variable_id) { 55 variable_bulk_table = response.data; 56 } 57 } else { 58 get_table(variable_id); 59 } 60 61 }, 62 error: function (response) { 63 get_table(variable_id); 64 } 65 }); 66 } 67 68 function init_custom_event() { 69 jQuery('.wdp_bulk_table_content').on('get_table', function (e, $obj_id) { 70 if (typeof $obj_id === 'undefined' || !$obj_id) { 71 get_table(variable_id); 72 } else { 73 get_table($obj_id); 74 } 75 }); 76 } 77 78 function init_events() { 79 if (jQuery('.wdp_bulk_table_content').length > 0) { 80 jQuery('.variations_form').on('found_variation', { variationForm: this }, 81 function (event, variation) { 82 if (typeof variation === 'undefined') { 83 get_table(variable_id); 84 return true; 85 } 86 get_table(variation.variation_id); 87 return true; 88 }) 89 .on('click', '.reset_variations', 90 { variationForm: this }, 91 function (event, variation) { 92 get_table(variable_id); 93 return true; 94 }) 95 .on('reset_data', 96 function (event) { 97 get_table(variable_id); 98 return true; 99 }); 100 101 jQuery('form.cart').on('adp_found_variation', function (e, { product_id, variation_id}) { 102 get_table(variation_id || product_id, true); 103 return true; 104 }); 105 106 init_custom_event(); 107 } 108 109 } 110 111 if (script_data.js_init_trigger) { 112 $(document).on(script_data.js_init_trigger, function () { 113 init_events(); 114 }); 115 } 116 117 jQuery('form.cart').on('adp_variations_form', function() { 118 init_events(); 119 }); 120 121 setTimeout(function () { 122 jQuery('.variations_form').on("wc_variation_form", function () { 123 init_events(); 124 }) 125 }, 0); 126 127 function watchForQuickView() { 128 let observer = new MutationObserver(function (mutations) { 129 mutations.forEach(function (mutation) { 130 mutation.addedNodes.forEach(function (node) { 131 if ($(node).hasClass('product-lightbox-inner') || $(node).find('.product-lightbox-inner').length) { 132 init_events(); 133 } 134 }); 135 }); 136 }); 137 observer.observe(document.body, { childList: true, subtree: true }); 138 } 139 140 watchForQuickView(); 141 142});
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.