PageSourceSearch

https://www.xenofit.de/wp-content/plugins/lwd_xenofit/assets/js/script.js?ver=7.1.3

js xenofit.de collected 2026-10-08 16:57:35 UTC 3,580 bytes, 94 lines download raw bytes

1jQuery(document).ready(function($) {
2	console.log("Xenofit Plugin loaded");
3	
4	/* WooCommerce cart open on add-to-cart */
5    $(document).on('click', '.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button', function() {
6        // 500ms delay, until DOM is loaded.
7        setTimeout(function() {
8            // Check if all elements exsist
9            if ($('.elementor-menu-cart__toggle_button').length > 0 && $('.elementor-menu-cart__container').length > 0) {
10                console.log('Open elementor-menu-cart');
11                $('.elementor-menu-cart__toggle_button').click();
12            } else {
13                console.warn('elementor-menu-cart not found');
14            }
15        }, 500); // 500 Millisekunden Verzögerung
16    });
17
18    let currency = jQuery('.woocommerce-Price-currencySymbol').first().text();
19    function updateDuration() {
20		// Loop through all WooCommerce attribute dropdowns
21		$('select[name^="attribute_"]').each(function () {
22			const selectedValue = $(this).val();
23			const attributeName = $(this).attr('name');
24
25			//console.log(`Selected value for ${attributeName}: ${selectedValue}`);
26
27			// Proceed only if a valid selection is made
28			if (selectedValue) {
29				//console.log('Valid selection detected');
30
31				// Delay to ensure dynamic content is updated
32				setTimeout(() => {
33					const variationPriceElement = $('.woocommerce-variation-price .woocommerce-Price-amount bdi');
34					const priceContainerElement = $('.woocommerce-variation-price .price');
35
36					// Update price in Elementor widget container if variation price exists
37					if (variationPriceElement.length) {
38						const priceText = variationPriceElement.text().trim();
39						const updatedPrice = priceText.replace(currency, '').trim() + ' ' + currency;
40
41						//console.log(`Updated price: ${updatedPrice}`);
42						$('.elementor-widget-container > .price').text(updatedPrice);
43						variationPriceElement.hide();
44					} else if (priceContainerElement.length) {
45						const priceText = priceContainerElement.text().trim();
46						const updatedPrice = priceText.replace(currency, '').trim() + ' ' + currency;
47
48						//console.log(`Updated price (fallback): ${updatedPrice}`);
49						$('.elementor-widget-container > .price').text(updatedPrice);
50						variationPriceElement.hide();
51					} else {
52						//console.log('No variation price found to update.');
53					}
54				}, 250);
55			} else {
56				//console.log('No valid selection made for this attribute.');
57			}
58		});
59	}
60
61    // Call updateDuration on document ready
62    updateDuration();
63
64    // Bind updateDuration to change event for any WooCommerce attribute select field
65    $('select[name^="attribute_"]').change(updateDuration);
66	
67	lwd_updateBasePriceOnVariationChange($);
68});
69
70function lwd_updateBasePriceOnVariationChange($) {
71	const $container = $('.product-unit-price');
72    if (!$container.length) return;
73
74    const variationData = $container.data('variations');
75    const $priceEl = $container.find('.unit-price-value');
76    const $detailsEl = $container.find('.unit-price-details');
77
78    $('.single_variation_wrap').on('show_variation', function (event, variation) {
79        const id = variation.variation_id;
80        const data = variationData[id];
81
82        if (data && data.price && data.unit) {
83            $priceEl.text(data.price);
84            if ($detailsEl.length) {
85                $detailsEl.text(' / ' + data.unit);
86            }
87        }
88    });
89
90    $('.single_variation_wrap').on('hide_variation reset_data', function () {
91        $priceEl.text('');
92        $detailsEl.text('');
93    });
94}

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.