PageSourceSearch

https://www.lacorteditore.it/wp-content/plugins/advanced-dynamic-p…/assets/js/frontend.js?ver=4.10.3

js lacorteditore.it collected 2026-09-24 22:16:22 UTC 3,768 bytes, 143 lines download raw bytes

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())
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        DynamicPrice.prototype.clickableBulkRows()
62			},
63			error: function (response) {
64				get_table(variable_id);
65			}
66		});
67	}
68
69	function init_custom_event() {
70		jQuery('.wdp_bulk_table_content').on('get_table', function (e, $obj_id) {
71			if (typeof $obj_id === 'undefined' || !$obj_id) {
72				get_table(variable_id);
73			} else {
74				get_table($obj_id);
75			}
76		});
77	}
78
79	function init_events() {
80		if (jQuery('.wdp_bulk_table_content').length > 0) {
81			jQuery('.variations_form').on('found_variation', { variationForm: this },
82				function (event, variation) {
83					if (typeof variation === 'undefined') {
84						get_table(variable_id);
85						return true;
86					}
87					get_table(variation.variation_id);
88					return true;
89				})
90				.on('click', '.reset_variations',
91					{ variationForm: this },
92					function (event, variation) {
93						get_table(variable_id);
94						return true;
95					})
96				.on('reset_data',
97					function (event) {
98						get_table(variable_id);
99						return true;
100					});
101
102			jQuery('form.cart').on('adp_found_variation', function (e, { product_id, variation_id}) {
103				get_table(variation_id || product_id, true);
104				return true;
105			});
106
107			init_custom_event();
108		}
109
110	}
111
112	if (script_data.js_init_trigger) {
113		$(document).on(script_data.js_init_trigger, function () {
114			init_events();
115		});
116	}
117
118	jQuery('form.cart').on('adp_variations_form', function() {
119		init_events();
120	});
121
122	setTimeout(function () {
123		jQuery('.variations_form').on("wc_variation_form", function () {
124			init_events();
125		})
126	}, 0);
127
128  function watchForQuickView() {
129    let observer = new MutationObserver(function (mutations) {
130      mutations.forEach(function (mutation) {
131        mutation.addedNodes.forEach(function (node) {
132          if ($(node).hasClass('product-lightbox-inner') || $(node).find('.product-lightbox-inner').length) {
133            init_events();
134          }
135        });
136      });
137    });
138    observer.observe(document.body, { childList: true, subtree: true });
139  }
140
141  watchForQuickView();
142
143});

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.