PageSourceSearch

https://www.lindenhof.it/wp-content/themes/betheme-child/assets/js/travel.js

js lindenhof.it collected 2026-09-26 11:12:51 UTC 9,045 bytes, 310 lines download raw bytes

1/**
2* Reiseberater
3*/
4'use strict'
5jQuery(document).ready(function() {
6	init_travel_consultant();
7	autofillForm();
8
9	/**
10	* Variable definition
11	*/
12	var formData = {};
13	/**
14	* Get Form data From Cookie if cookie exists
15	*/
16	if (Cookies.get('formData') !== undefined) {
17		formData = JSON.parse(Cookies.get('formData'));
18	}
19
20	var usable_buttons = [];
21	var langCode, headline_text, discover_page, travel_button_class_disabled, travel_button_parent_class, travel_button_class_active, travel_motiv_buttons;
22	/**
23	* Initialize Travel Consultant Popup
24	*/
25	function init_travel_consultant() {
26		langCode = jQuery('html').attr('lang');
27		travel_button_class_disabled = 'wso-travel-button-disabled';
28		travel_button_parent_class = 'wso-travel-button-selected';
29		travel_button_class_active = 'wso-travel-button-active';
30		discover_page = 'https://www.lindenhof.it/';
31		var travel_button_relations = {
32			'single': {
33				'values': {
34					'de-DE': 'Alleine',
35					'en-GB': 'alone',
36					'it-IT': 'Da Solo',
37				},
38				'page': {
39					'de-DE': '/ihre-individuelle-auszeit/',
40					'en-GB': '/en/your-individual-break/',
41					'it-IT': '/it/la-sua-vacanza-individuale/',
42				},
43				'text': {
44					'de-DE': 'Urlaub alleine',
45					'en-GB': 'holiday on your own',
46					'it-IT': 'Sua vacanza',
47				},
48				'buttons': [
49					'health',
50					'sport',
51					'culinary',
52					'wellness',
53					'adults',
54				],
55				'otherInputs': {
56					'anzahl-erwachsene': 1,
57					'anzahl-kinder': 0,
58					'kids-age': '',
59				}
60			},
61			'couple': {
62				'values': {
63					'de-DE': 'Zu zweit',
64					'en-GB': 'couple',
65					'it-IT': 'In Due',
66				},
67				'page': {
68					'de-DE': '/ihr-traumhafter-urlaub-zu-zweit/',
69					'en-GB': '/en/holidays-for-couples/',
70					'it-IT': '/it/la-vostra-vacanza-da-sogno-in-coppia/',
71				},
72				'text': {
73					'de-DE': 'Urlaub zu zweit',
74					'en-GB': 'holiday as a couple',
75					'it-IT': 'vacanza in due',
76				},
77				'buttons': [
78					'health',
79					'sport',
80					'culinary',
81					'wellness',
82					'adults',
83				],
84			},
85			'family': {
86				'values': {
87					'de-DE': 'Familie',
88					'en-GB': 'family',
89					'it-IT': 'In Famiglia',
90				},
91				'page': {
92					'de-DE': '/ihr-persoenlicher-familienurlaub/',
93					'en-GB': '/en/your-personal-family-holiday/',
94					'it-IT': '/it/la-vostra-vacanza-in-famiglia-individuale/',
95				},
96				'text': {
97					'de-DE': 'Familien­urlaub',
98					'en-GB': 'family holiday',
99					'it-IT': 'vacanza in famiglia',
100				},
101				'buttons': [
102					'health',
103					'sport',
104					'family',
105					'culinary',
106					'wellness',
107				],
108			},
109			'group': {
110				'values': {
111					'de-DE': 'Gruppe',
112					'en-GB': 'group',
113					'it-IT': 'In Gruppo',
114				},
115				'page': {
116					'de-DE': '/gemeinsam-den-urlaub-geniessen/',
117					'en-GB': '/en/enjoy-a-holiday-together/',
118					'it-IT': '/it/godetevi-le-vacanze-insieme/',
119				},
120				'text': {
121					'de-DE': 'Gruppen­urlaub',
122					'en-GB': 'holiday with a group',
123					'it-IT': 'vacanza in gruppo',
124				},
125				'buttons': [
126					'health',
127					'sport',
128					'culinary',
129					'wellness',
130					'adults',
131				],
132			},
133		};
134		travel_motiv_buttons = {
135			"Gesundheit": {
136				'de-DE': 'Gesundheit',
137				'en-GB': 'health',
138				'it-IT': 'Salute'
139			},
140			"Sport & Aktivitäten": {
141				'de-DE': 'Sport & Aktivitäten',
142				'en-GB': 'sport & activities',
143				'it-IT': 'Sport e attività'
144			},
145			"Zeit für die Familie": {
146				'de-DE': 'Zeit für die Familie',
147				'en-GB': 'time for the family',
148				'it-IT': 'Tempo con la famiglia'
149			},
150			"Kulinarik": {
151				'de-DE': 'Kulinarik',
152				'en-GB': 'cuisine',
153				'it-IT': 'Arte culinaria'
154			},
155			"Wellness & Entspannung": {
156				'de-DE': 'Wellness & Entspannung',
157				'en-GB': 'wellness & relaxation',
158				'it-IT': 'Benessere e relax'
159			},
160			'Adults only': {
161				'de-DE': 'Adults only',
162				'en-GB': 'adults only',
163				'it-IT': 'Adults Only'
164			}
165		}
166		/**
167		* Back Button
168		*/
169		jQuery(document).on('click', '#travel-consultant .wso-back-link', function() {
170			travel_prev_page();
171		});
172		/**
173		* Add Class to selected Button and remove class from other buttons
174		* Set Headline for 2nd Page
175		* Set usable buttons for 2nd Page
176		* Set correct Landing Page
177		* Write Form data to cookie
178		*/
179		jQuery(document).on('click', '#travel-consultant .wso-travel-companion button', function() {
180			jQuery(this).siblings().removeClass(travel_button_class_active);
181			jQuery(this).addClass(travel_button_class_active);
182			headline_text = travel_button_relations[jQuery(this).val()].text[langCode];
183			usable_buttons = travel_button_relations[jQuery(this).val()].buttons; /* Usable Buttons in section 2 */
184			discover_page = travel_button_relations[jQuery(this).val()].page[langCode]; /* Landing Page */
185
186			/**
187			* Generate and Write cookie
188			*/
189			formData.companion = travel_button_relations[jQuery(this).val()].values[langCode];
190			formData.otherInputs = travel_button_relations[jQuery(this).val()].otherInputs;
191			Cookies.set('formData', formData);
192
193			refresh_travel_motive();
194			travel_next_page();
195		});
196		/**
197		* Toggle Class of button on 2nd Page when clicked
198		*/
199		jQuery(document).on('click', '#travel-consultant .wso-travel-motive button', function() {
200			jQuery(this).parent().addClass(travel_button_parent_class);
201			jQuery(this).toggleClass(travel_button_class_active);
202			refresh_active_travel_motive();
203		});
204		/**
205		* Move to nexr Page Button
206		*/
207		jQuery(document).on('click', '#travel-consultant .wso-go-further-link', function() {
208			travel_next_page();
209			refresh_active_travel_motive();
210		});
211		/**
212		* Redirect to Form
213		*/
214		jQuery(document).on('click', 'button[value="request-offer"]', function() {
215			window.location = jQuery(this).data('href');
216		});
217		/**
218		* Redirect to Landing Page
219		*/
220		jQuery(document).on('click', 'button[value="discover-vacation"]', function(e) {
221			e.preventDefault();
222			window.location = discover_page;
223		});
224	}
225	/**
226	* Move to previous Page of the current Popup
227	*/
228	function travel_prev_page() {
229		setTimeout(function() {
230			jQuery('.fancybox-button--arrow_left').trigger("click");
231		}, 100);
232	}
233	/**
234	* Move to next Page of the current Popup
235	*/
236	function travel_next_page() {
237		setTimeout(function() {
238			jQuery('.fancybox-button--arrow_right').trigger("click");
239		}, 100);
240	}
241	/**
242	* Show Correct Buttons on Second Page
243	* Change Headline Text on Second Page
244	*/
245	function refresh_travel_motive() {
246		var holiday = {
247			'de-DE': 'Urlaub',
248			'en-GB': 'holiday',
249			'it-IT': 'vacanza'
250		}
251		if (headline_text != '') {
252			jQuery('.wso-change-text').html(headline_text);
253		} else {
254			jQuery('.wso-change-text').html(holiday[langCode]);
255		}
256		if (usable_buttons != undefined) {
257			jQuery('.wso-travel-motive button').addClass(travel_button_class_disabled);
258			jQuery('.wso-travel-motive button').filter(function() {
259				return usable_buttons.includes(this.value);
260			}).removeClass(travel_button_class_disabled);
261			jQuery(' .' + travel_button_class_disabled).removeClass(travel_button_class_active);
262		} else {
263			jQuery('.wso-travel-motive button').removeClass(travel_button_class_disabled);
264		}
265		refresh_active_travel_motive();
266	}
267	/**
268	* Write Active Buttons on 2nd Page to cookie
269	*/
270	function refresh_active_travel_motive() {
271		formData.activeButtons = [];
272		jQuery(' .' + travel_button_parent_class + ' .' + travel_button_class_active).each(function() {
273			formData.activeButtons.push(jQuery(this).attr('name'));
274		});
275		console.log(formData.activeButtons.length);
276		if (formData.activeButtons.length >= 1) {
277			jQuery('.wso-go-further-link').addClass('wso-go-further-link-active');
278		} else {
279			jQuery('.wso-go-further-link').removeClass('wso-go-further-link-active');
280		}
281		Cookies.set('formData', formData);
282	}
283	/**
284	* Get Form Data From cookie
285	* Fill Form with data defined in cookie
286	*/
287	function autofillForm() {
288
289		if (typeof Cookies !== undefined) {
290			if (Cookies.get('formData') == undefined || Cookies.get('formData') == 'undefined') {
291				return;
292			} else {
293				var autofillFormData = JSON.parse(Cookies.get('formData'));
294				jQuery('.wso-contact-form-col select[name="traveler"]').val(autofillFormData.companion);
295				var activeButtons_translated = [];
296				for (var i = 0; i < autofillFormData.activeButtons.length; i++) {
297					activeButtons_translated.push(travel_motiv_buttons[autofillFormData.activeButtons[i]][langCode]);
298				}
299				jQuery('.wso-contact-form-col input[type="checkbox"]').filter(function() {
300					return activeButtons_translated.indexOf(this.value) > -1;
301				}).prop('checked', true);
302				jQuery.each(autofillFormData.otherInputs, function(selector, value) {
303					selector = '.wso-contact-form-col [name="' + selector + '"]';
304					jQuery(selector).val(value);
305				});
306				jQuery('.wso-form-accordion .wso-form-title').trigger('click');
307			}
308		}
309	}
310});

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.