PageSourceSearch

https://www.sorianomotori.com/wp-content/themes/jupiterx-child/assets/js/configurator-main.js?ver=1.0.3

js sorianomotori.com collected 2026-10-05 18:18:42 UTC 33,569 bytes, 851 lines download raw bytes

1/**!
2 * Soriano Motori Configurator JS
3 */
4jQuery.fn.reverse = [].reverse;
5(function ($) {
6 
7    'use strict';
8 
9    $(document).ready(function() {
10
11		
12    });
13 
14}(jQuery));
15
16function setCookie(cname, cvalue, exdays) {
17	var d = new Date();
18	d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
19	var expires = "expires="+d.toUTCString();
20	document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
21}
22
23const smconfigurator = (function ($) {
24
25	const singleProduct = function () {
26		// Single Product
27		console.info('Load single product');
28		let pageUrl = new URL(document.location.href); // Save the url of the page
29
30		
31		if ($(window).width() > 992) {
32			$('.jupiterx-main-content').css('padding-top', $('.jupiterx-header.jupiterx-header-custom').height()+'px'); // Spacing but only in mobile version
33			
34			// Image gallery and attributes tab background position
35			$('.jupiterx-main-content').css('overflow', 'hidden'); // Prevent overflow
36			const leftOffset = $('.configurator-product-gallery').offset().left;
37			$('.configurator-product-gallery, .configurator-product-tabs .tabs').css('--margin-left-to-cover', '-'+leftOffset+'px')
38		}
39
40		// Configurator navigation actions
41		const $tabElements = $('.woocommerce-tabs.configurator-product-tabs [role="tab"]');
42		// Back button action
43		$('.configurator-product-navigation [href="#back"]').on('click', function (e) {
44			e.preventDefault();
45			const activeTabNumber = $('.woocommerce-tabs.configurator-product-tabs [role="tab"].active').index();
46			if (activeTabNumber > 0) {
47				// Is not the first element
48				$('.woocommerce-tabs.configurator-product-tabs [role="tab"]').eq(activeTabNumber-1).find('a').click(); // Click on previous element
49			} else {
50				$('.woocommerce-tabs.configurator-product-tabs [role="tab"]').eq($tabElements.length-1).find('a').click(); // Click on last element
51			}
52		});
53		// Continue button action
54		$('.configurator-product-navigation [href="#continue"]').on('click', function (e) {
55			e.preventDefault();
56			const activeTabNumber = $('.woocommerce-tabs.configurator-product-tabs [role="tab"].active').index();
57			const $addToCartButton = $('.single_add_to_cart_button');
58
59			if (!$addToCartButton.hasClass('disabled') && pageUrl.searchParams.get('editCart') == 'true') {
60				// if variation exist and edit cart flag is active go to cart
61				$addToCartButton.click();
62			} else if (activeTabNumber < $tabElements.length-2) {
63				// Is not the last element nor the pre last element
64				$('.woocommerce-tabs.configurator-product-tabs [role="tab"]').eq(activeTabNumber+1).find('a').click(); // Click on next element
65			} else if (activeTabNumber < $tabElements.length-1) {
66				// prelast to last
67				const $addToCartButton = $('.single_add_to_cart_button');
68				const $continueButton = $('.configurator-product-navigation .button[href="#continue"]');
69				if (!$addToCartButton.hasClass('disabled')) {
70					$continueButton.text($addToCartButton.text());
71				}
72				$('.woocommerce-tabs.configurator-product-tabs [role="tab"]').eq(activeTabNumber+1).find('a').click(); // Click on next element
73
74			} else {
75				if (!$addToCartButton.hasClass('disabled')) {
76					$addToCartButton.click();
77				} else {
78					$('.woocommerce-tabs.configurator-product-tabs [role="tab"]').eq(0).find('a').click(); // Click on last element
79				}
80			}
81		});
82
83		// Add a get parameter when the user selects an option
84		$('.configurator-product-attributes input[type="radio"]').on('change', function () {
85			//console.log($(this).attr('name'), $(this).val());
86			pageUrl.searchParams.set($(this).attr('name'), $(this).val());
87			window.history.pushState({}, "", pageUrl);
88		})
89
90		// Add the functionality for the play button to work
91		$('.configurator-product-attributes-audio').on('click', function () {
92			//console.log('Play');
93			if (!$('#'+$(this).attr('for')).get(0).paused) {
94				// Its playing
95				$('#'+$(this).attr('for')).get(0).pause();
96			} else {
97				// Not playing
98				// Pause all audios
99				$('.configurator-product-attributes-audio + audio').each(function () {
100					this.pause();
101					this.currentTime = 0;
102				})
103				$('#'+$(this).attr('for')).get(0).play();
104			}
105			$(this).parent('label').click();
106		});
107		$('.configurator-product-attributes-audio + audio').on('pause', function () {
108			//console.log('E Pause', $(this).attr('id'));
109			$('.configurator-product-attributes-audio[for="'+$(this).attr('id')+'"]').removeClass('playing');
110		});
111		$('.configurator-product-attributes-audio + audio').on('play', function () {
112			//console.log('E Play', $(this).attr('id'));
113			$('.configurator-product-attributes-audio[for="'+$(this).attr('id')+'"]').addClass('playing');
114		});
115
116		// Product title like design
117		if (($('.configurator-product-summary .configurator-product-title').text()).includes('Giaguaro V1')) {
118			//console.log($('.configurator-product-summary .configurator-product-title').text(), ($('.configurator-product-summary .configurator-product-title').text()).includes('Giaguaro V1'))
119			let productName = $('.configurator-product-summary .configurator-product-title').get(0).textContent.replace('Giaguaro V1', 'Giaguaro V1<b>')+'</b>';
120			$('.configurator-product-summary .configurator-product-title').html(productName);
121		}
122
123		// Attributes menu, check if has overflowed (to apply the mobile design)
124		/*$( '.woocommerce-product-gallery' ).on('wc-product-gallery-after-init', function () {
125			console.log($('.woocommerce-product-gallery .flex-direction-nav'))
126		});*/
127		$( '.wc-tabs-wrapper, .woocommerce-tabs' ).on('init', function () {
128			// Do when is loaded
129			const $productsTabs = $('.configurator-product-tabs');
130			let tabsWidth = 0;
131			$productsTabs.find('.wc-tabs li').each(function () {
132				tabsWidth += $(this).innerWidth()
133			})
134			if (tabsWidth > $productsTabs.width() && !$productsTabs.find('.wc-tabs').hasClass('with-navigation')) {
135				// Bigger than container
136				// Prepare elements
137				$('#jupiterx-main').css('overflow', 'hidden')
138				$productsTabs.find('.wc-tabs').addClass('with-navigation');
139				let nextIcon = $('#nextText').html();
140				let prevIcon = $('#prevText').html();
141				nextIcon = nextIcon.replace('width="17"', 'width="12"'); nextIcon = nextIcon.replace('height="25"', 'height="20"');
142				prevIcon = prevIcon.replace('width="17"', 'width="12"'); prevIcon = prevIcon.replace('height="25"', 'height="20"');
143				// Add arrows
144				$('<a href="#prev" class="wc-tabs-navigation" aria-hidden="true">'+prevIcon+'</a><a href="#next" class="wc-tabs-navigation" aria-hidden="true">'+nextIcon+'</a>').insertAfter($productsTabs.find('.wc-tabs'));
145				// Set default active elements
146				$productsTabs.find('.wc-tabs li:first-child, .wc-tabs li:nth-child(2)').addClass('visible');
147				// Add actions
148				$productsTabs.find('.wc-tabs-navigation[href="#next"]').on('click', function () {
149					const $oldVisibleTabs = $productsTabs.find('.wc-tabs li.visible');
150					if ($oldVisibleTabs.eq(1).is(':last-child') && !$oldVisibleTabs.eq(0).is(':first-child')) {
151						// Will be activate the first and second childs
152						$productsTabs.find('.wc-tabs li:first-child, .wc-tabs li:nth-child(2)').addClass('visible');
153					} else if ($oldVisibleTabs.eq(1).is(':first-child')) {
154						// Will be activate the second and third childs
155						$productsTabs.find('.wc-tabs li:nth-child(2), .wc-tabs li:nth-child(2) + li').addClass('visible');
156					} else if ($productsTabs.find('.wc-tabs li.visible ~ li:not(.visible)').length >= 2) {
157						// Activate the two next elements
158						$productsTabs.find('.wc-tabs li.visible + li:not(.visible), .wc-tabs li.visible + li:not(.visible) + li:not(.visible)').addClass('visible');
159					} else {
160						// Activate the last and first elements
161						$productsTabs.find('.wc-tabs li:first-child, .wc-tabs li:last-child').addClass('visible');
162					}
163					$oldVisibleTabs.removeClass('visible');
164				})
165				$productsTabs.find('.wc-tabs-navigation[href="#prev"]').on('click', function () {
166					const $oldVisibleTabs = $productsTabs.find('.wc-tabs li.visible');
167					if ($oldVisibleTabs.eq(0).is(':first-child') && !$oldVisibleTabs.eq(1).is(':last-child')) {
168						// Will be activate the first and second last childs
169						$productsTabs.find('.wc-tabs li:last-child, .wc-tabs li:nth-last-child(2)').addClass('visible');
170					} else if ($oldVisibleTabs.eq(0).is(':first-child') && $oldVisibleTabs.eq(1).is(':last-child')) {
171						// Will be activate the second last and third last element
172						$productsTabs.find('.wc-tabs li:nth-last-child(2), .wc-tabs li:nth-last-child(3)').addClass('visible');
173					} else if ($productsTabs.find('.wc-tabs li:not(.visible) + li.visible').prevAll().length >= 2) {
174						// Activate the two previous elements
175						const $previousElements = $productsTabs.find('.wc-tabs li:not(.visible) + li.visible').prevAll();
176						$previousElements.eq(0).addClass('visible');
177						$previousElements.eq(1).addClass('visible');
178					} else {
179						// Activate the last and first elements
180						$productsTabs.find('.wc-tabs li:first-child, .wc-tabs li:last-child').addClass('visible');
181					}
182					$oldVisibleTabs.removeClass('visible');
183				})
184			}
185			// Change continue button text if is necesary (product variation available and last tab active or product variation available and edit cart flag)
186			const $addToCartButton = $('.single_add_to_cart_button');
187			const $continueButton = $('.configurator-product-navigation .button[href="#continue"]');
188			if (!$addToCartButton.hasClass('disabled') && ($('.woocommerce-tabs.configurator-product-tabs [role="tab"].active').index() == $tabElements.length-1 || pageUrl.searchParams.get('editCart') == 'true')) {
189				$continueButton.text($addToCartButton.text());
190			} else {
191				$continueButton.text($continueButton.data('text'));
192			}
193		} );
194
195		// Menu actions (Document, download, share and print) on the left
196		$('.configurator-product-share-buttons').css('height', $('.configurator-product-tabs .tabs').height())
197		// Menu actions, change links when variation changes
198		$('[name="variation_id"]').on('change', function () {
199			const variationID = $(this).val();
200			if (variationID) {
201				const $documentLinks = $('.configurator-product-share-buttons a[href*="action=productInfo"]')
202				let linkUrl = new URL($documentLinks.attr('href'));
203				linkUrl.searchParams.set('vid', $(this).val());
204				$documentLinks.attr('href', linkUrl.href);
205			}
206		});
207		// Menu actions, share button
208		$('.configurator-product-share-buttons a[href="#share"]').on('click', function (e) {
209			e.preventDefault();
210			if ($('.configurator-product-share-options').length) {
211				$('.configurator-product-share-options').fadeOut(400, function () {
212					$(this).remove();
213				}); // Remove share options if exist yet
214			} else {
215				// $('.configurator-product-share-buttons a[href*="action=productInfo"]').attr('href');
216				let shareButtons = $('.jupiterx-social-share-product-page .jupiterx-social-share-inner').html();
217				shareButtons = shareButtons.replaceAll(document.location.pathname, document.location.pathname+document.location.search); // Set links with the atributtes params
218				$('<div class="configurator-product-share-options" style="display: none">'+shareButtons+'</div>').fadeIn().insertAfter('.configurator-product-share-buttons').on('click', function () {
219					$('.configurator-product-share-options').remove();
220				});
221			}
222		});
223		// If the share buttons are not at the same height as the attributes menu it is the mobile version
224		if ($('.configurator-product-share-buttons').offset().top != $('.configurator-product-tabs').offset().top) {
225			$('.configurator-product-share-buttons').addClass('closed').on('click', function () {
226				$(this).toggleClass('closed open');
227			});
228		}
229
230		// Extra info (in design only the seat have one)
231		$('.configurator-product-attributes-extra').each(function () {
232			// add a class to the parent (to apply custom styles)
233			$(this).parent().addClass('configurator-extra-info');
234		})
235		$('.configurator-product-attributes input[type="radio"]').on('change', function () {
236			$('.configurator-product-attributes-extra.open', $(this).parents('.wc-tab')).removeClass('open'); // Use parents to prevent reset other opened "configurator-product-attributes-extra"
237			$('.configurator-product-attributes-extra[data-attribute="'+$(this).attr('id')+'"]').addClass('open');
238			//console.log($(this).attr('id'));
239		})
240		
241		// Show the extra info for the active elements
242		$('.configurator-product-attributes input[type="radio"]:checked').each (function () {
243			if ($('.configurator-product-attributes-extra[data-attribute="'+$(this).attr('id')+'"]').length > 0) {
244				$(this).parent().find('.configurator-product-attributes-extra.open').removeClass('open');
245				$('.configurator-product-attributes-extra[data-attribute="'+$(this).attr('id')+'"]').addClass('open');
246			}
247		});
248		
249		/*** Woocommerce compatibility ***/
250		$(document).on('change', '.configurator-product-attributes input[type="radio"]', function() {
251			$('.configurator-product-attributes input[type="radio"]:checked').each(function(index, element) {
252				const $el = $(element);
253				const thisName = $el.attr('name');
254				const thisVal  = $el.attr('value');
255				$('select[name="'+thisName+'"]').val(thisVal).trigger('change');
256			});
257		});
258		$(document).on('woocommerce_update_variation_values', function() {
259			$('.configurator-product-attributes input[type="radio"]').each(function(index, element) {
260				const $el = $(element);
261				const thisName = $el.attr('name');
262				const thisVal  = $el.attr('value');
263				$el.removeAttr('disabled');
264				if($('select[name="'+thisName+'"] option[value="'+thisVal+'"]').is(':disabled')) {
265					$el.prop('disabled', true);
266				}
267			});
268		});
269		$(document).on('show_variation', function () {
270			const $headerPrice = $('.configurator-product-header .configurator-product-price bdi');
271			if ($('.woocommerce-variation-price .woocommerce-Price-amount.amount bdi').length > 0) {
272				// If this variation has price
273				$headerPrice.html($('.woocommerce-variation-price .woocommerce-Price-amount.amount bdi').html());
274			} else {
275				// Get the original price
276				let priceHtml = $headerPrice.parent().parent().find('+ .configurator-product-baseprice').text();
277				$headerPrice.parent().html($(priceHtml).html());
278			}
279			// Change continue button text if is necesary (product variation available and last tab active or product variation available and edit cart flag)
280			const $addToCartButton = $('.single_add_to_cart_button');
281			const $continueButton = $('.configurator-product-navigation .button[href="#continue"]');
282			if (!$addToCartButton.hasClass('disabled') && ($('.woocommerce-tabs.configurator-product-tabs [role="tab"].active').index() == $tabElements.length-1 || pageUrl.searchParams.get('editCart') == 'true')){
283				$continueButton.text($addToCartButton.text());
284			} else {
285				$continueButton.text($continueButton.data('text'));
286			}
287		})
288		// Fix close button (because not working)
289		$('.woocommerce-product-gallery').on('wc-product-gallery-after-init', function () {
290			if ($(window).width() <= 992) {
291				$('.pswp__button.pswp__button--close').attr('style', 'width: auto; color: white; background-image: none !important').text('Drag down to close');
292			}
293		});
294
295		// If the user arrives from the cart we will empty it
296		if (pageUrl.searchParams.get('editCart') == 'true' || pageUrl.searchParams.get('clearCart') == 'true') {
297			$.ajax({
298				url: __ARMAJAXURL,
299				type: 'POST',
300				data: {
301					action: 'clearCart',
302				},
303				success: function (response) {
304					// Clear cart from cookie (prevent ajax function failed)
305					if (response.data.cookieName) {
306						setCookie(response.data.cookieName, false, 0);
307					}
308					/*$.ajax({
309						url: __ARMAJAXURL,
310						type: 'POST',
311						data: {
312							action: 'checkProductsInCart',
313						},
314						success: function (response) {
315							console.info(response.data);
316							if (response.success && response.data > 0) {
317								console.error('Not cleared cart');								
318							}
319						},
320						error: function (response){
321							//result = response.responseJSON;
322							console.error(response);
323						}
324					});*/
325				},
326				error: function (response){
327					//result = response.responseJSON;
328					console.error(response);
329				}
330			});
331		}
332		/*** END Woocommerce compatibility ***/
333
334		// Check if you have a hash in the url to go to the selected tab
335		$( '.wc-tabs-wrapper, .woocommerce-tabs' ).on('init', function () {
336			// Do action when tabs is loaded
337			if (pageUrl.hash && (pageUrl.hash).indexOf('#tab-title-') > -1) {
338				//console.log(pageUrl.hash, $('a', pageUrl.hash));
339				$('a', pageUrl.hash).click();
340				$('html, body').animate({
341					scrollTop: $('a', pageUrl.hash).offset().top
342				}, 1500);
343			}
344		} );
345	}
346
347	const cart = function () {
348		// Woo Cart
349		console.info('Load cart');
350
351		// Set Variation edition links
352		$('.edit-variation-item').each(function (){
353			let configuratorPageUrl = new URL(variationUrl);
354			configuratorPageUrl.hash = ($(this).attr('href')).replace('#', '');
355			configuratorPageUrl.searchParams.set('clearCart', true); // Use this to clear cart
356			configuratorPageUrl.searchParams.set('editCart', true); // Use this to allow directly go to cart
357			$(this).attr('href', configuratorPageUrl.href);
358			//pageUrl.searchParams.set($(this).attr('name'), $(this).val());
359		})
360
361		$('#empty-cart').on('click', function (e) {
362			e.preventDefault();
363			$(this).addClass('loading');
364			let returnToLink = $(this).attr('href');
365			// Clear the cart first
366			$.ajax({
367				url: __ARMAJAXURL,
368				type: 'POST',
369				data: {
370					action: 'clearCart',
371				},
372				success: function (response) {
373					// Clear cart from cookie (prevent ajax function failed)
374					if (response.data.cookieName) {
375						setCookie(response.data.cookieName, false, 0);
376					}
377					console.info('Cart cleared successfully');
378					window.location.href = returnToLink;
379				},
380				error: function (response){
381					//result = response.responseJSON;
382					console.error(response);
383				}
384			});
385		})
386	}
387
388	const checkout = function () {
389		// Woo Checkout
390		console.info('Load checkout');
391
392		// Replicate the original functionality to be applied in the checkout form
393		/*$(document.body).on('updated_checkout', function () {
394			console.log('Checkout updated');
395			// (for shipping) Prevent the option not selected when clicks on the radio input
396			$('.configurator-checkout-order-details .woocommerce-shipping-methods input').on('click', function () {
397				$(this).parent().find('label').click();
398			});
399			// (for shipping)
400			$('.configurator-checkout-order-details .woocommerce-shipping-methods label').on('click', function () {
401				$(this).parent().find('input').prop( "checked", true );
402			});
403
404			// (for payment)
405			$('.configurator-checkout-order-details .woocommerce-checkout-payment input').on('click', function () {
406				//console.log($(this).parent().find('label'));
407				$(this).parent().find('label').click();
408			});
409			// (for payment)
410			$('.configurator-checkout-order-details .woocommerce-checkout-payment label').on('click', function () {
411				$(this).parent().find('input').prop( "checked", true );
412			});
413
414			// (for terms & conditions)
415			$('.configurator-checkout-order-details .woocommerce-terms-and-conditions-wrapper #terms').on('change', function () {
416				$('#order_review .woocommerce-terms-and-conditions-wrapper #terms').attr('checked', $(this).is(':checked'))
417			})
418
419		});*/
420
421		$('[href="#place-holder"]').on('click', function () {
422			$('#order_review button[type="submit"]').click();
423		});
424
425	}
426
427	const login = function () {
428		console.info(document.location.hash);
429		if ($('a[href="#register"]').length > 0) {
430			if (document.location.hash == '#register') {
431				activateForm('register');
432			}
433			$('a[href="#register"]').on('click', function () {
434				activateForm('register');				
435			});
436			$('a[href="#login"]').on('click', function () {
437				activateForm('login');				
438			});
439		}
440		function activateForm(formId) {
441			console.info(document.location.hash);
442			const formSelector = {				
443				'login' : '.login-form',
444				'register' : '.register-form'
445			}
446			if (formId in formSelector) {
447				for (let key in formSelector) {
448					if (key != formId) $(formSelector[key]).fadeOut();
449				}
450				$(formSelector[formId]).fadeIn();
451			}
452			
453		}
454
455		// Add terms links
456		$termsPolicies = $('[name="allow_policies"] + label');
457		// EN
458		$termsPolicies.html($termsPolicies.html().replace('SORIANO MOTORI AGREEMENT, TERMS OF USE, ', '<a href="https://www.sorianomotori.com/terms-and-conditions/" target="_blank">SORIANO MOTORI AGREEMENT, TERMS OF USE</a>'));
459		$termsPolicies.html($termsPolicies.html().replace('PRIVACY NOTICE', '<a href="https://www.sorianomotori.com/privacy-policy/" target="_blank">PRIVACY NOTICE</a>'));
460		// ES
461		$termsPolicies.html($termsPolicies.html().replace('ACUERDO SORIANO MOTORI, TÉRMINOS DE USO  ', '<a href="https://www.sorianomotori.com/es/terminos-y-condiciones-de-uso/" target="_blank">ACUERDO SORIANO MOTORI, TÉRMINOS DE USO</a>'));
462		$termsPolicies.html($termsPolicies.html().replace('AVISO DE PRIVACIDAD', '<a href="https://www.sorianomotori.com/es/politica-de-privacidad/" target="_blank">AVISO DE PRIVACIDAD</a>'));
463		// IT
464		$termsPolicies.html($termsPolicies.html().replace("l'ACCORDO SORIANO MOTORI, I TERMINI DI UTILIZZO ", '<a href="https://www.sorianomotori.com/it/termini-e-condizioni/" target="_blank">l\'ACCORDO SORIANO MOTORI, I TERMINI DI UTILIZZO</a>'));
465		$termsPolicies.html($termsPolicies.html().replace('l\'INFORMATIVA SULLA PRIVACY', '<a href="https://www.sorianomotori.com/it/politica-sulla-riservatezza/" target="_blank">l\'INFORMATIVA SULLA PRIVACY</a>'));
466
467
468		// Translations
469		this.getTranslations([
470			$('.arm-df__form-control-submit-btn'), 
471			//$('.arm_form_member_field_repeat_pass + .arm-df__fc--validation .arm-df__fc--validation__wrap'),
472			//$(''),
473			//$(''),
474			//$('')
475		]);
476		
477		// Placeholders translations
478		this.getTranslations([
479			$('[name="first_name"]'), 
480			$('[name="last_name"]'),
481			$('[name="user_email"]'),
482			$('[name="user_pass"]'),
483			$('[name="repeat_pass"]')
484		], 'placeholder');
485	}
486
487	const editAccount = function () {
488		// WOO+ARM Edit account
489		console.info('Load profile');
490		// Add pencil icon instead of x element
491		const pencilIcon = $('#editIcon').html();
492		if (pencilIcon != 'x') {
493			$('.armFileRemoveContainer').html(pencilIcon)
494		}
495
496		if ($('.configurator-country').length) {
497			$('.configurator-country input[name="billing_country"]').on('change', function () {
498				//billing_state
499				$.ajax({
500					url: __ARMAJAXURL,
501					type: 'POST',
502					data: {
503						action: 'loadStatesByCountry',
504						country : $(this).val(),
505					},
506					success: function (response) {
507						let result = '';
508						try {
509							result = JSON.parse(response);
510						} catch (e) {
511							result = response;
512						}
513						if (result.success == true) {
514							//console.log(result);
515							if (Object.keys(result.data).length > 0) {
516								const $armStates = $('.configurator-state .arm__dc--items');
517								$armStates.html('');
518								let item = 0;
519								for (state in result.data) {
520									if (item == 0) {
521										// Put the first element as selected
522										$('.configurator-state .arm__dc--head__title').text(result.data[state])
523										$('.configurator-state input[name="billing_state"]').val(result.data[state]);
524										$('.configurator-state .arm_autocomplete').val(result.data[state]);
525									}
526									$armStates.append(`<li class="arm__dc--item" data-label="${result.data[state]}" data-value="${state}">${result.data[state]}</li>`)
527									//<li class="arm__dc--item" data-label="Blagoevgrad" data-value="BG-01">Blagoevgrad</li>
528									item++;
529								}
530							}
531						} else {
532							console.error(response);
533						}
534					},
535					error: function (response){
536						//result = response.responseJSON;
537						console.error(response);
538					}
539				});
540			})
541		}
542
543		if ($('.arm_form_edit_profile input[name="billing_email"]').length) {
544			$('.arm_form_edit_profile input[name="billing_email"]').attr('disabled', true);
545		}
546	
547
548		// Translations		
549		this.getTranslations([
550			$('[name="armFormSubmitBtn"]'), 
551			$('.configurator-gender-field .arm_form_field_label_text'),
552			$('.configurator-gender-field .arm-df__form-field .arm_radio_label').eq(0),
553			$('.configurator-gender-field .arm-df__form-field .arm_radio_label').eq(1),
554			$('.configurator-gender-field .arm-df__form-field .arm_radio_label').eq(2),
555			$('.armFileDragAreaText'),
556			//$('')
557		]);
558		// Form placeholders
559		this.getTranslations([
560			$('[name="billing_first_name"]'), 
561			$('[name="billing_last_name"]'),
562			$('[name="date_cnp2l"]'),
563			$('[name="billing_phone"]'),
564			$('[name="billing_phone_2"]'),
565			$('[name="billing_address_1"]'),
566			$('[name="billing_address_2"]'),
567			$('[name="billing_city"]')
568		], 'placeholder');
569	}
570
571	const getTranslations = function ($elements, type = 'text') {
572		console.log('getTranslations');
573		let stringsToTranslate = [];
574		$elements.forEach($element => {
575			switch (type) {
576				case 'placeholder':
577					stringsToTranslate.push($element.attr('placeholder'));
578					break;
579				case 'text':
580					default:
581					stringsToTranslate.push($element.text());
582					break;
583			}
584			//console.log($element.html());
585		});
586
587		if (stringsToTranslate.length > 0) {
588			$.ajax({
589				url: __ARMAJAXURL,
590				type: 'POST',
591				data: {
592					action: 'translateStrings',
593					strings : stringsToTranslate,
594				},
595				success: function (response) {
596					if (response.success == true) {
597						for (elem in response.data) {
598							//console.log(stringsToTranslate[elem], response.data[elem]);
599							switch (type) {
600								case 'placeholder':
601									$elements[elem].attr('placeholder', ($elements[elem].attr('placeholder')).replace(stringsToTranslate[elem], response.data[elem]));
602									break;
603								case 'text':
604									default:
605									$elements[elem].html(($elements[elem].html()).replace(stringsToTranslate[elem], response.data[elem]));
606									break;
607							}
608						}
609					} else {
610						//console.error(response);
611					}
612				},
613				error: function (response){
614					//result = response.responseJSON;
615					//console.error(response);
616				}
617			});
618		}
619	}
620
621	const orders = function () {
622		// Do table responsive
623		if ($('.configurator-orders-table.shop_table_responsive.mobile-version').length) {
624			console.info('Load responsive orders table');
625			$('.configurator-orders-table.shop_table_responsive .order').on('click', function () {
626				$(this).toggleClass('open');
627			})
628		}		
629	}
630
631	const responsiveMenu = function () {
632		// Responsive of order history menu
633		const $myAccountMenu = $('.configurator-myaccount-navigation');
634		let tabsWidth = 0;
635			$myAccountMenu.find('.woocommerce-MyAccount-navigation-link').each(function () {
636				tabsWidth += $(this).innerWidth()
637			})
638
639		if (tabsWidth > $myAccountMenu.width() && !$myAccountMenu.find('ul').hasClass('with-navigation')) {
640			// Bigger than container
641			// Prepare elements
642			$('#jupiterx-main').css('overflow', 'hidden')
643			$myAccountMenu.find('ul').addClass('with-navigation');
644			let nextIcon = $('#nextText').html();
645			let prevIcon = $('#prevText').html();
646			nextIcon = nextIcon.replace('width="17"', 'width="12"'); nextIcon = nextIcon.replace('height="25"', 'height="20"');
647			prevIcon = prevIcon.replace('width="17"', 'width="12"'); prevIcon = prevIcon.replace('height="25"', 'height="20"');
648			// Add arrows
649			$('<a href="#prev" class="wc-tabs-navigation" aria-hidden="true">'+prevIcon+'</a><a href="#next" class="wc-tabs-navigation" aria-hidden="true">'+nextIcon+'</a>').insertAfter($myAccountMenu.find('ul'));
650			// Set default active elements
651			$myAccountMenu.find('.is-active.woocommerce-MyAccount-navigation-link').addClass('visible');
652			// Add actions
653			$myAccountMenu.find('.wc-tabs-navigation[href="#next"]').on('click', function () {
654				const $oldVisibleTabs = $myAccountMenu.find('.woocommerce-MyAccount-navigation-link.visible');
655				if ($oldVisibleTabs.eq(0).is(':last-child')) {
656					// Will be activate the first child
657					$myAccountMenu.find('.woocommerce-MyAccount-navigation-link:first-child').addClass('visible');
658				} else {
659					// Activate the next element
660					$myAccountMenu.find('.woocommerce-MyAccount-navigation-link.visible + li').addClass('visible');
661				}
662				$oldVisibleTabs.removeClass('visible');
663			})
664			$myAccountMenu.find('.wc-tabs-navigation[href="#prev"]').on('click', function () {
665				const $oldVisibleTabs = $myAccountMenu.find('.woocommerce-MyAccount-navigation-link.visible');
666				if ($oldVisibleTabs.eq(0).is(':first-child')) {
667					// Will be activate the last child
668					$myAccountMenu.find('.woocommerce-MyAccount-navigation-link:last-child').addClass('visible');
669				} else {
670					// Activate the previous element
671					const $previousElements = $myAccountMenu.find('.woocommerce-MyAccount-navigation-link:not(.visible) + li.visible').prevAll();
672					$previousElements.eq(0).addClass('visible');
673				}
674				$oldVisibleTabs.removeClass('visible');
675			})
676		}
677	}
678
679	const lifestyleInterest = function () {
680		console.info('Load Lifestyle interest');
681		// Change the header to apply the layout styles
682		$('<h2 class="configurator-heading-title">'+$('.arm_current_membership_heading_main').text()+'</h2>').insertAfter($('.arm_current_membership_heading_main'));
683		$('.arm_current_membership_heading_main').remove();
684
685		$('.arm_current_membership_list_item_renew_date').html($('.arm_setup_column_item.arm_active .arm_module_plan_description').text()+'<br>'+$('.arm_current_membership_list_item_renew_date').text());
686
687		// Remove Your plan info if is free plan or not have one of them
688		if ($('.configurator-current-plan-info .arm_current_membership_list_item_plan_profile').text() == 'Free' || $('.configurator-current-plan-info .arm_current_membership_list_item_plan_profile').length < 1) {
689			$('.configurator-current-plan-info').remove();
690		}
691
692		// Translations		
693		this.getTranslations([
694			$('#arm_subscription_plan_option_5 .arm_module_plan_name'),
695			$('#arm_subscription_plan_option_5 .arm_module_plan_description'),
696			$('#arm_subscription_plan_option_4 .arm_module_plan_name'),
697			$('#arm_subscription_plan_option_4 .arm_module_plan_description'),
698			$('#arm_subscription_plan_option_3 .arm_module_plan_name'),
699			$('#arm_subscription_plan_option_3 .arm_module_plan_description'),
700			$('#arm_subscription_plan_option_2 .arm_module_plan_name'),
701			$('#arm_subscription_plan_option_2 .arm_module_plan_description'),
702			$('.arm_setup_summary_text_main_container .arm_setup_summary_text div').eq(0),
703			$('.arm_setup_submit_btn')
704			//$('')
705		]);
706
707	}
708
709	const importProducts = function (productId) {
710		$.ajax({
711			url: ajaxurl,
712			type: 'POST',
713			data: {
714				action: 'importProductsVariationImages',
715				id : productId,
716			},
717			success: function (response) {
718				let result = '';
719				try {
720					result = JSON.parse(response);
721				} catch (e) {
722					result = response;
723				}
724				if (result.success == true) {
725					console.log(result);
726				} else {
727					console.error(response);
728				}
729			},
730			error: function (response){
731				//result = response.responseJSON;
732				console.error(response);
733			}
734		});
735	}
736
737	const setOrder = function (productId) {
738		$.ajax({
739			url: ajaxurl,
740			type: 'POST',
741			data: {
742				action: 'setProductPriority',
743				id : productId,
744			},
745			success: function (response) {
746				let result = '';
747				try {
748					result = JSON.parse(response);
749				} catch (e) {
750					result = response;
751				}
752				if (result.success == true) {
753					console.log(result);
754				} else {
755					console.error(response);
756				}
757			},
758			error: function (response){
759				//result = response.responseJSON;
760				console.error(response);
761			}
762		});
763	}
764
765	const importProductsPrices = function (productId) {
766		$.ajax({
767			url: ajaxurl,
768			type: 'POST',
769			data: {
770				action: 'importProductsVariationPrices',
771				id : productId,
772			},
773			success: function (response) {
774				let result = '';
775				try {
776					result = JSON.parse(response);
777				} catch (e) {
778					result = response;
779				}
780				if (result.success == true) {
781					console.log(result);
782				} else {
783					console.error(response);
784				}
785			},
786			error: function (response){
787				//result = response.responseJSON;
788				console.error(response);
789			}
790		});
791	}
792	
793
794	const syncVariations = function (productId) {
795		$.ajax({
796			url: __ARMAJAXURL,
797			type: 'POST',
798			data: {
799				action: 'syncProductsVariation',
800				id : productId,
801			},
802			success: function (response) {
803				// Clear cart from cookie (prevent ajax function failed)
804				if (response.data.length > 0) {
805					console.info(response.data);
806					/*for (elem in response.data) {
807						let vid = response.data[elem];
808						console.info(vid);
809						$.ajax({
810							url: __ARMAJAXURL,
811							type: 'POST',
812							data: {
813								action: 'syncProductsVariation',
814								id : vid,
815							},
816							success: function (response) {
817
818								//console.info(vid, response.data);
819							},
820							error: function (response){
821								//result = response.responseJSON;
822								console.error(response);
823							}
824						});
825					}*/
826				}
827			},
828			error: function (response){
829				//result = response.responseJSON;
830				console.error(response);
831			}
832		});
833
834	}	
835
836	return {
837		loadSingleProduct: singleProduct,
838		loadCart: cart,
839		loadCheckout: checkout,
840		loadLogin: login,
841		loadEditAccount: editAccount,
842		getTranslations: getTranslations,
843		loadOrders: orders,
844		loadResponsiveMenu: responsiveMenu,
845		loadLifestyleInterest: lifestyleInterest,
846		loadImportProducts: importProducts,
847		loadSetOrder: setOrder,
848		loadImportProductsPrices: importProductsPrices,
849		loadSyncVariations: syncVariations
850	};
851}(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.