PageSourceSearch

https://park-inn-bielefeld.de/wp-content/themes/theplace/js/palace-functions.js?ver=1.0

js park-inn-bielefeld.de collected 2026-10-04 01:58:36 UTC 18,093 bytes, 521 lines download raw bytes

1/* Copyright AurelienD http://themeforest.net/user/AurelienD?ref=AurelienD */
2jQuery(document).ready(function(jQ) {		
3	
4	function debouncer( func , timeout ) {
5		var timeoutID , timeout = timeout || 50;
6		return function () {
7			var scope = this , args = arguments;
8			clearTimeout( timeoutID );
9			timeoutID = setTimeout( function () {
10				func.apply( scope , Array.prototype.slice.call( args ) );
11			} , timeout );
12		}
13	}
14	
15	if (!(jQ.browser.msie  && parseInt(jQ.browser.version, 10) === 8)) {		
16		jQ(window).resize(function(){			
17			if ( jQ('body').hasClass('has-layout-boxed') ) {				
18				if( jQ(window).width() < 1024 ){				
19					jQ('body').removeClass('layout-boxed');				
20					jQ('body').addClass('layout-unboxed');			
21				} else {
22					jQ('body').addClass('layout-boxed');				
23					jQ('body').removeClass('layout-unboxed');			
24				}		
25			}				
26		}).resize();	
27	} else {		
28		if ( jQ('body').hasClass('has-layout-boxed') ) {			
29			jQ('body').addClass('layout-boxed');		
30		} else {			
31			jQ('body').addClass('layout-unboxed');	
32		}		
33		jQ(window).resize(function(){			
34			if( jQ(window).width() < 1000 ){		
35				jQ('header').addClass('ie8-header-small');		
36			} else {			
37				jQ('header').removeClass('ie8-header-small');		
38			}		
39		}).resize();	
40	}		
41
42	function nav_init() {		
43		if (!(jQ.browser.msie  && parseInt(jQ.browser.version, 10) === 8 )) {
44			
45			if ( jQ('#nav-select select').length > 0 ) {
46				jQ('<option />', {
47					'value'   : '#',
48					'text'    : ' '
49				}).appendTo('#nav-select select');
50				jQ('nav a').each(function() {
51					var el = jQ(this);
52					var dashes = '';
53					for (var i=1;i<el.parents('ul').length;i++) {
54						dashes += '-';
55					}
56					if ( dashes != '' ) {
57						dashes += ' ';
58					}
59					jQ('<option />', {
60						'value'   : el.attr('href'),
61						'text'    : dashes + el.text()
62					}).appendTo('#nav-select select');
63				});
64				jQ('#nav-select select').change(function() {
65					window.location.href = jQ(this).find('option:selected').val();
66				});
67			} else {
68				var nav = jQ('nav').html();			
69				nav = nav.replace('class="nav-standard"', 'class="nav-mobile"');			
70				nav = nav.replace('id="', 'id="mobile-');		
71				jQ('nav').append(nav);									
72				jQ('nav>ul.nav-mobile li').each(function() {		
73					if (jQ(this).children('ul').length > 0) { 		
74						jQ(this).append('<a class="nav-button-sub" href="#"><span class="nav-plus-small">+</span></a>');		
75					}			
76				});			
77
78				jQ('ul.nav-mobile').css('top', '-1000px');				
79				jQ('#nav-button-main').click(function() {		
80					var main_ul = jQ('ul.nav-mobile');			
81					if (main_ul.hasClass('nav-main-expanded')) {			
82						main_ul.removeClass('nav-main-expanded');			
83						main_ul.animate({top: '-1000px'});			
84						jQ('#nav-button-main .nav-arrow').rotate({animateTo:0});		
85					} else {				
86						main_ul.addClass('nav-main-expanded');				
87						main_ul.animate({top: 0});
88						jQ('#nav-button-main .nav-arrow').rotate({animateTo:180});		
89					}		
90				});				
91				jQ('.nav-button-sub').click(function() {				
92					var son_ul = jQ(this).parent().find('>ul');		
93					if (son_ul.hasClass('nav-sub-expanded')) {			
94						son_ul.removeClass('nav-sub-expanded');		
95						son_ul.slideUp();			
96						jQ(this).find('.nav-plus-small').rotate({animateTo:0, callback:function() {			
97							jQ(this).html('+').removeClass('nav-minus-small');	
98						}});		
99					} else {			
100						son_ul.addClass('nav-sub-expanded');			
101						son_ul.slideDown();			
102						jQ(this).find('.nav-plus-small').rotate({animateTo:180, callback:function() {			
103							jQ(this).html('&#8722;').addClass('nav-minus-small');		
104						}});			
105					}			
106					return false;		
107				});	
108			}
109			jQ('nav>ul.nav-standard>li').each(function() {		
110				if (jQ(this).children('ul').length > 0) { 				
111					jQ(this).find('>a').append('&nbsp;&nbsp;<span class="nav-arrow-down">&#9660;</span>');		
112				}		
113			});		
114			jQ('nav ul.nav-standard li ul li ul').parent().find('>a').append('<span class="nav-arrow-right">&#9658;</span>');	
115		}			
116		jQ('nav ul.nav-standard').superfish({		
117			delay: 600,			
118			animation : {height:'show'}, 
119			animationClose : {height:'hide'},		
120			autoArrows:  false	
121		});	
122	}	
123	nav_init();	
124	
125	if (jQ('#ap_fwh_options').length > 0) {
126		var fwho = JSON.parse(jQ('#ap_fwh_options').val());
127		if ( fwho['autoplay'] == 'yes' ) {
128			ma = true;
129		} else {
130			ma = false;
131		}
132		if ( jQ('#full-width-slider').length > 0 ) {
133			full_width_slider(ma, fwho['pause_time'], fwho['animation_speed']);
134		} else {
135			full_width_header(fwho['animation_speed']);
136		}
137	}
138
139	if (jQ('#full-screen-slider').length > 0) {
140		full_screen_slider('#full-screen-slider');
141	}
142	
143	jQ('.sc-fws-container').each(function() {
144		full_width_slider_inside(jQ(this));
145	});
146	
147	jQ('.slider-type-a').each(function() {
148		slider_type_a(jQ(this));
149	});
150	
151	jQ('.slider-type-b').each(function() {
152		slider_type_b(jQ(this));
153	});
154	
155	if ( jQ('.gallery-ap').length > 0 ) {
156		gallery_ap();
157	}
158	
159	var day_names = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
160	
161	jQ('.ap-calendars-wrapper').each(function() {
162		var cid = jQ(this).attr('id');
163		var co = JSON.parse(jQ('#' + cid).find('input.ah-calendar-options').val());
164		var adminDateFormat = co['dateFormat'];
165		var ahcd = new Array();
166		var sa = false;
167		var lang = '';
168		if ( jQ(this).find('.ah-calendars-data').length > 0 ) {
169			ahcd = JSON.parse(jQ('#' + cid).find('.ah-calendars-data').val());
170			sa = true;
171		}
172		if ( jQ(this).find('.ah-calendar-lang').length > 0 ) {
173			lang = jQ('#' + cid).find('.ah-calendar-lang').val();
174		} 
175		if ( lang != '' ) {
176			 co['dateFormat'] = jQ.datepick.regional[lang].dateFormat;
177			 day_names = jQ.datepick.regional[lang].dayNames;
178		}
179		var iid = cid.substring('calendar-'.length);
180		jQ('#' + iid).data('date-format', co['dateFormat']);
181		jQ('#' + iid).data('admin-date-format', adminDateFormat);
182		if ( jQ(this).hasClass('calendar-inline-no-input') ) {
183			jQ('#' + iid).css('display', 'none');
184		} else {
185			jQ('#' + iid).prop('readonly', true);
186		}
187		if ( jQ(this).hasClass('calendar-pop-up') ) {
188			//jQ('#' + iid).after('<a class="calendar-button" href="#"></a>');
189			jQ('#' + iid).addClass('input-calendar');
190			jQ(this).css('display','none');
191		}
192		co['onSelect'] = function(dates) { 
193			if (co['multiSelect'] == 0) {
194				if ( dates.length ) {
195					jQ('#' + iid).val(jQ.datepick.formatDate(co['dateFormat'],dates[0]));
196					if (jQ(this).parent().hasClass('calendar-pop-up')) {
197						jQ(this).parent().slideToggle();
198					}
199				}
200			} else {
201				if ( dates.length ) {
202					var d = '';
203					for(var i=0; i<dates.length; i++) {
204						if ( i != 0 ) {
205							d = d + ', ';
206						}
207						d = d + jQ.datepick.formatDate(co['dateFormat'],dates[i]);
208					}
209					jQ('#' + iid).val(d);
210				} else {
211					jQ('#' + iid).val(d);
212				}
213			}
214		};
215		jQ('#' + cid + ' .ap-calendar').each(function() {
216			if ( sa ) {
217				co['onDate'] = function(date) {
218					var id = jQ(this).attr('id');
219					var n = id.indexOf('-name-');
220					id = id.substring(0, n);
221					if ( cid == 'calendar-check-out' ) {
222						var date_minus_one_day = new Date();
223						date_minus_one_day.setDate( date.getDate() - 1 );
224						if ( jQ.inArray(jQ.datepick.formatDate('yyyy-mm-dd',date_minus_one_day), ahcd[id] ) > -1 ) {
225							return { selectable: false };
226						} else {
227							return {};
228						}
229					} else {
230						if ( jQ.inArray(jQ.datepick.formatDate('yyyy-mm-dd',date), ahcd[id] ) > -1 ) {
231							return { selectable: false };
232						} else {
233							return {};
234						}
235					}
236				};
237			}
238			if ( co['multiSelect'] == 0 ) {
239				jQ(this).parent().find('.calendar-button-ok').css('display','none');
240			} 
241			jQ(this).datepick();
242			if ( lang != '' ) {
243				jQ(this).datepick('option', jQ.datepick.regional[lang]);
244			}
245			function remove_selection(id,c) {
246				jQ('#' + id + ' .datepick table a').css({'cursor':'default','color':c}).attr('title','');
247			}
248			function change_calendar_width(id,w) {
249				jQ('#' + id + ' .datepick-month').css('width', w + '%');
250			}
251			if ( co['multiSelect'] == -1 ) {
252				co['onSelect'] = function() {
253					var id = jQ(this).attr('id');
254					var c = jQ(this).find('.datepick table a').css('color');
255					setTimeout(function() { remove_selection(id,c); }, 10);
256				}
257				co['onChangeMonthYear'] = function(year, month) { 
258					var id = jQ(this).attr('id');
259					var c = jQ(this).find('.datepick table a').css('color');
260					setTimeout(function() { remove_selection(id,c); }, 10);
261					jQ('#' + cid + ' .ap-calendar').datepick('showMonth', year, month);
262				};
263			} else {
264				co['onChangeMonthYear'] = function(year, month) { 
265					if ( cid == 'calendar-check-in' ) {
266						var check_out_month_shown = jQ('#calendar-check-out .ap-calendar').data('month-shown');
267						var check_out_year_shown = jQ('#calendar-check-out .ap-calendar').data('year-shown');
268						if ( check_out_year_shown * 12 + check_out_month_shown < year * 12 + month ) {
269							jQ('#calendar-check-out .ap-calendar').datepick('showMonth', year, month);
270							jQ('#calendar-check-out .ap-calendar').data('month-shown', month);
271							jQ('#calendar-check-out .ap-calendar').data('year-shown', year);
272						}
273					}
274					if ( cid == 'calendar-check-out' ) {
275						jQ('#calendar-check-out .ap-calendar').data('month-shown', month);
276						jQ('#calendar-check-out .ap-calendar').data('year-shown', year);
277					}
278				};
279			}
280			jQ(this).datepick('option', co);
281			if ( co['multiSelect'] == -1 ) {
282				var c = jQ(this).find('.datepick table a').css('color');
283				jQ(this).find('.datepick table a').css({'cursor':'default','color':c}).attr('title','');
284			}
285			if ( cid == 'calendar-check-out' ) {
286				var current_date = new Date();
287				var current_month = current_date.getMonth() + 1;
288				var current_year = current_date.getFullYear();
289				jQ(this).data('month-shown', current_month);
290				jQ(this).data('year-shown', current_year);
291			}
292		});
293		if ( ( jQ('#' + cid + ' .ah-calendar-type-to-show').length > 0 ) && ( jQ('#' + cid + ' .ap-calendar').length > 1 ) ) {
294			jQ('#' + cid + ' .calendar-for-' + jQ('#' + cid + ' .ah-calendar-type-to-show').val()).css('display','block');
295		} else {
296			jQ('#' + cid + ' .ap-calendar').eq(0).css('display','block');
297		}
298	});
299	
300	if ( (jQ('#check-in').length > 0) && (jQ('#check-out').length > 0) ) {
301		jQ('.wpcf7-submit').click(function() {
302			var date_format = jQ('#check-in').data('date-format');
303			var check_in_date, check_out_date;
304			try {
305				check_in_date = jQ.datepick.parseDate(date_format, jQ('#check-in').val());
306				check_out_date = jQ.datepick.parseDate(date_format, jQ('#check-out').val());
307			} catch(e) {
308				alert(thepalacejstext.invaliddate);
309				return false;
310			}
311			if ( ( check_in_date == null ) && ( check_out_date == null ) ) {
312				alert(thepalacejstext.selectcheckincheckout);
313				return false;
314			} else if ( check_in_date == null ) {
315				alert(thepalacejstext.selectcheckin);
316				return false;
317			} else if ( check_out_date == null ) {
318				alert(thepalacejstext.selectcheckout);
319				return false;
320			}
321			if ( check_in_date >= check_out_date ) { 
322				alert(thepalacejstext.errorcheckoutbeforecheckin);
323				return false;
324			}
325			var _MS_PER_DAY = 1000 * 60 * 60 * 24;
326			var utc1 = Date.UTC(check_in_date.getFullYear(), check_in_date.getMonth(), check_in_date.getDate());
327			var utc2 = Date.UTC(check_out_date.getFullYear(), check_out_date.getMonth(), check_out_date.getDate());
328			var number_of_nights = Math.floor((utc2 - utc1) / _MS_PER_DAY);
329			var room_type = '';
330			if ( jQ('#calendar-check-in .ah-calendar-type-to-show').length > 0 ) {
331				room_type = jQ('#calendar-check-in .ah-calendar-type-to-show').val();
332			} else {
333				room_type = jQ('.room-type').val();
334			}
335			if ( room_type == '' ) {
336				room_type = jQ('input[name="room"]').val();
337			}
338			var minimal_stay = JSON.parse(jQ('#minimal-stay').val());
339			for ( var i=0; i<minimal_stay.length; i++) {
340				if ( ( room_type == minimal_stay[i]['room-id'] ) && ( number_of_nights < minimal_stay[i]['nights'] ) ) {
341					alert(thepalacejstext.minimalstay);
342					return false;
343				}
344			}
345			var check_in_day_c = JSON.parse(jQ('#check-in-day-compulsory').val());
346			for ( var i=0; i<check_in_day_c.length; i++) {
347				if ( ( room_type == check_in_day_c[i]['room-id'] ) && ( check_in_date.getDay() != (check_in_day_c[i]['check-in-day']-1) ) ) {
348					alert(thepalacejstext.check_in_day_compulsory + '(' + day_names[check_in_day_c[i]['check-in-day']-1] + ').');
349					return false;
350				}
351			}			
352			var check_out_day_c = JSON.parse(jQ('#check-out-day-compulsory').val());
353			for ( var i=0; i<check_out_day_c.length; i++) {
354				if ( ( room_type == check_out_day_c[i]['room-id'] ) && ( check_out_date.getDay() != (check_out_day_c[i]['check-out-day']-1) ) ) {
355					alert(thepalacejstext.check_out_day_compulsory + '(' + day_names[check_out_day_c[i]['check-out-day']-1] + ').');
356					return false;
357				}
358			}
359			if ( jQ('.ah-control-avai-calendars-data').length > 0 ) {
360				var unavai_dates = JSON.parse(jQ('.ah-control-avai-calendars-data').val())['calendar-' + room_type];
361				var check_in_date_for_control = new Date(check_in_date.getTime());
362				do {
363					str_date = jQ.datepick.formatDate('yyyy-mm-dd', check_in_date_for_control);
364					if ( jQ.inArray(jQ.datepick.formatDate('yyyy-mm-dd', check_in_date_for_control), unavai_dates ) > -1 ) {
365						alert(thepalacejstext.noavailability);
366						return false;
367					}
368					check_in_date_for_control.setDate(check_in_date_for_control.getDate()+1);
369				} while ( check_in_date_for_control < check_out_date );
370			}
371			jQ('#check-in-formatted').val(jQ.datepick.formatDate('yyyy-mm-dd', check_in_date));
372			jQ('#check-out-formatted').val(jQ.datepick.formatDate('yyyy-mm-dd', check_out_date));
373		});
374	}
375	
376	jQ('.input-calendar').click(function() {
377		var cid = jQ(this).attr('id');
378		jQ('#calendar-' + cid).slideToggle();
379		return false;
380	});
381	
382	jQ('.calendar-button-ok').click(function() {
383		jQ(this).parent().parent().slideToggle();
384		return false;
385	});
386	
387	if (jQ('.ah-room-types-data').length > 0) {
388		var rt = JSON.parse(jQ('.ah-room-types-data').val());
389		var select_rt_content = '';
390		for (var i=0; i<rt.length; i++) {
391			select_rt_content += '<option value="' + rt[i]['id'] + '">' + rt[i]['name'] + '</option>';
392		}
393		jQ('.room-type').html(select_rt_content);
394	}
395	jQ('.room-type').change(function() {
396		var rt = jQ(this).val();
397		jQ('.ap-calendars-wrapper').each(function() {
398			if ( jQ(this).find('.ap-calendar').length > 1 ) {
399				jQ(this).find('.ap-calendar').css('display','none');
400				jQ(this).find('.calendar-for-' + rt).fadeIn(1000);
401			}
402		});
403	});
404	
405	function init_google_map(map_coords, map_type) {
406		var lat_lng = map_coords.split(',');
407		var point = new google.maps.LatLng( lat_lng[0] , lat_lng[1] );
408		var google_map_type = google.maps.MapTypeId.ROADMAP;
409		if ( map_type == 'satellite' ) {
410			google_map_type = google.maps.MapTypeId.SATELLITE;
411		}	
412		var mapOptions = {
413			zoom: 15,
414			center: point,
415			mapTypeId: google_map_type
416		}	
417		var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
418		var noPoi = [{
419			featureType: "poi.business",
420			stylers: [{ visibility: "off" }]  
421		}];
422		map.setOptions({styles: noPoi});
423		var marker = new google.maps.Marker({
424			position: point,
425			map: map
426		});
427		jQ(window).unload(function() { 
428			GUnload(); 
429		});
430	}
431
432	if ( jQ('#map-lat-lng').length > 0 ) {
433		init_google_map(jQ('#map-lat-lng').val(), jQ('#map-type').val());
434	}
435
436	var logo_height = 0,
437		logo_width = 0;
438	
439	function init_logo_resize() {
440		jQ('<img />').load(function () {
441			logo_height = jQ('#logo img.logo').height();
442			logo_width = jQ('#logo img.logo').width();
443			logo_resize();
444		}).attr('src', jQ('#logo img.logo').attr('src'));
445	}
446
447	function viewport_width() {
448		var e = window , a = 'inner';
449		if ( !( 'innerWidth' in window ) ) {
450			a = 'client';
451			e = document.documentElement || document.body;
452		}
453		return e[ a+'Width' ];
454	}
455	
456	function logo_resize() {
457		if ( viewport_width() <= 959 ) {
458			var reducing_scale_factor = jQ('#logo .logo').data('reducing-scale-factor');
459			jQ('#logo img.logo').css({'height': Math.floor(logo_height/reducing_scale_factor) + 'px', 'width': Math.floor(logo_width/reducing_scale_factor) + 'px'});
460		} else {
461			jQ('#logo img.logo').css({'height': logo_height + 'px', 'width': logo_width + 'px'});
462		}
463	}
464
465	function logo_change() {
466		if ( viewport_width() <= 959 ) {
467			jQ('#logo img.logo').attr('src', jQ('#logo .logo').data('mobile-logo-url') );
468		} else {
469			jQ('#logo img.logo').attr('src', jQ('#logo .logo').data('default-logo-url') );
470		}
471	}
472	
473	if ( jQ('#logo .logo').data('mobile-logo-type') == 'reduce' ) {
474		init_logo_resize();
475		jQ(window).resize(debouncer(function(e) {
476			logo_resize();
477		}));
478	} else if ( jQ('#logo .logo').data('mobile-logo-type') == 'change-img' ) {
479		jQ(window).resize(debouncer(function(e) {
480			logo_change();
481		}));
482		logo_change();
483	}
484	
485	function copy_widget_area_mobile() {
486		if ( jQ('#widget-area-top-container').length > 0 ) {
487			jQ('#widget-area-top-container-mobile').html(jQ('#widget-area-top-container').html() + '<div class="clear"></div>');
488		}
489	}
490	copy_widget_area_mobile();	
491	
492	if ( jQ('#background').length > 0 ) {
493		function do_resize() {
494			var img = jQ('#background img');
495				ratio_img = img.width() / img.height(),
496				ratio_win = jQ(window).width() / jQ(window).height();
497			if ( ratio_win < ratio_img ) {
498				img.css({'height': '100%', 'width': 'auto'});
499				img.css({'left': '50%', 'margin-left': -Math.floor(img.width()/2) + 'px', 'margin-top': 0,  'top': 0});		
500			} else {
501				img.css({'height': 'auto', 'width': '100%'});
502				img.css({'left': 0, 'margin-left': 0, 'margin-top': -Math.floor(img.height()/2) + 'px', 'top': '50%'});
503			}			
504		}
505		jQ(window).resize(debouncer(function(e) {
506			do_resize();
507		}));
508		jQ('<img />').attr('src', jQuery('#background img').attr('src')).load(function () {
509			do_resize();
510		});
511	}
512	
513	if ( jQ('#footer-image').length == 0 ) {
514		jQ('footer.below-main-container, #footer-image-container').css('background', 'none');
515	}
516	
517	jQ('p:not([class]):empty').remove();
518	
519});
520
521/* Copyright AurelienD http://themeforest.net/user/AurelienD?ref=AurelienD */

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.