PageSourceSearch

https://www.server-provider.com/vendor/ds_serverprovider/js/main.js

js server-provider.com collected 2026-10-08 05:46:52 UTC 66,529 bytes, 1,732 lines download raw bytes

1// Strict mode
2'use strict';
3
4// Global variables
5var touch_device = ('ontouchstart' in window) || (window.DocumentTouch && document instanceof window.DocumentTouch) || (navigator.maxTouchPoints > 0),
6	$_document = $(document),
7	$_window = $(window);
8
9// Touch swipe detection
10$.fn.swipe = function (options) {
11	options = $.extend({left: null, right: null}, options);
12
13	return this.each(function () {
14		if (options.left || options.right) {
15			var touchstart_x = 0,
16				touchstart_y = 0,
17				touchmove_x = 0,
18				touchmove_y = 0,
19				swipe = false;
20
21			$(this).on('touchstart', function (touchstart_e) {
22				touchstart_x = touchstart_e.pageX || touchstart_e.touches[0].pageX;
23				touchstart_y = touchstart_e.pageY || touchstart_e.touches[0].pageY;
24			});
25
26			$(this).on('touchmove', function (touchmove_e) {
27				if (swipe === false) {
28					touchmove_x = touchstart_x - (touchmove_e.pageX || touchmove_e.touches[0].pageX);
29					touchmove_y = touchstart_y - (touchmove_e.pageY || touchmove_e.touches[0].pageY);
30
31					if (Math.abs(touchmove_x) > 10 && Math.abs(touchmove_y) < 10) {
32						swipe = touchmove_x > 0 ? 'left' : 'right';
33						return false;
34					}
35				}
36
37				return true;
38			});
39
40			$_window.on('touchend', function (touchend_e) {
41				if (swipe && options[swipe]) {
42					options[swipe]();
43				}
44
45				touchmove_x = 0;
46				touchmove_y = 0;
47				swipe = false;
48			});
49		}
50	});
51};
52
53// DOM is ready
54$_document.on('DOMContentLoaded', function () {
55	// Document variables
56	var $_body = $('body'),
57		$_html_body = $('html, body');
58
59	// Confirm touch device detection
60	if (touch_device) $_body.addClass('touch-device');
61
62	// Header variables
63	var $_header = $('#header'),
64		$_header_nav = $_header.find('nav'),
65		$_header_nav_primary = $_header_nav.find('ul.nav-primary'),
66		$_header_container = $_header.find('.container'),
67		header_static = $_header.hasClass('header-static'),
68		header_dynamic = $_header.hasClass('header-dynamic'),
69		header_nav_overlay = $_header.hasClass('header-nav-overlay');
70
71	// Dynamic header based on scroll
72	if (header_dynamic) new Headroom($_header[0], {offset: 120, tolerance: {up: 5}}).init();
73
74	// Display header shadow based on scroll
75	if ($_header.hasClass('header-shadow-scroll')) {
76		var header_shadow_scroll = function () {
77			$_header[$_window.scrollTop() === 0 ? 'removeClass' : 'addClass']('active');
78		};
79
80		$_window.on('scroll', header_shadow_scroll);
81		header_shadow_scroll();
82	}
83
84	// Process primary navigation
85	$_header_nav_primary.find('li').each(function () {
86		if ($(this).has('ul').length) {
87			var $_li = $(this),
88				$_ul = $_li.find('ul:first');
89
90			$_li.on('mouseenter', function () {
91				if ((($_ul.outerWidth() + $_ul.offset().left + 20) - $_header_container.offset().left) > $_header_container.width()) {
92					$_ul.addClass('nav-left');
93				}
94			}).on('mouseleave', function () {
95				$_ul.removeClass('nav-left');
96			});
97
98			if ($_li.find('> .button').length) {
99				$_ul.addClass('nav-button').css('minWidth', ($_li.outerWidth() - 20) + 'px');
100			} else {
101				$_ul.css('minWidth', ($_li.outerWidth() + 20) + 'px');
102			}
103		}
104
105		if ($(this).find('a.button').length && $(this).next().find('a.button').length) {
106			$(this).addClass('button-follows');
107		}
108	});
109
110	// Handle navigation overlay
111	if ($_header_nav.length) {
112		var $_nav_overlay_background = $('<div id="nav-overlay-background"></div>'),
113			$_nav_overlay_open = $('<i id="nav-overlay-open" class="material-icons">menu</i>'),
114			$_nav_overlay_close = $('<i id="nav-overlay-close" class="material-icons">close</i>'),
115			$_nav_overlay = $('<div id="nav-overlay"></div>').append($_header_container.clone().append($_nav_overlay_close)),
116			nav_overlay_theme = ($_header.hasClass('header-light') && 'light') || ($_header.hasClass('header-gray') && 'gray') || ($_header.hasClass('header-dark') && 'dark'),
117			nav_overlay_class = $.trim((header_nav_overlay ? 'nav-overlay-visible' : '') + ' ' + (nav_overlay_theme ? 'nav-overlay-' + nav_overlay_theme : ''));
118
119		if (nav_overlay_class) {
120			$_nav_overlay.addClass(nav_overlay_class);
121			$_nav_overlay_open.addClass(nav_overlay_class);
122			$_nav_overlay_close.addClass(nav_overlay_class);
123			$_nav_overlay_background.addClass(nav_overlay_class);
124		}
125
126		$_nav_overlay_open.appendTo($_header_container).on('click', function () {
127			$_body.prepend($_nav_overlay_background, $_nav_overlay);
128			$_window.scrollTop(0);
129		});
130
131		$_nav_overlay_close.on('click', function () {
132			$_nav_overlay_background.detach();
133			$_nav_overlay.detach();
134		});
135	}
136
137	// Notification variables
138	var $_notification = $('#notification').show(),
139		notification_data = $_notification.data();
140
141	// Handle notification dismissal with cookies
142	if (notification_data && notification_data.dismissible) {
143		if (notification_data.title && Cookies.get('notification-' + notification_data.title)) {
144			$_notification.remove();
145		} else {
146			if (header_nav_overlay) {
147				$_notification.addClass('notification-dismiss-align');
148			}
149
150			$('<i id="notification-dismiss" class="material-icons">close</i>').prependTo($_notification.find('div.container')).on('click', function () {
151				$_notification.addClass('notification-hide');
152
153				if (notification_data.title) {
154					Cookies.set('notification-' + notification_data.title, 0,
155						{
156							expires: $.isNumeric(notification_data.expires) ? notification_data.expires : ''
157						});
158				}
159			});
160		}
161	}
162
163	// Handle text typing animation
164	$('span.type-text').each(function () {
165		var $_type_text = $(this),
166			type_text_value = $.trim($_type_text.text()),
167			type_text_data = $_type_text.data('type-text'),
168			type_text_data_speed = ($_type_text.data('type-text-speed') || 0.1) * 1000,
169			type_text_data_delay = ($_type_text.data('type-text-delay') || 2) * 1000,
170			type_text_data_loop = $_type_text.data('type-text-loop') ? true : false,
171			type_text_data_length = 0,
172			type_text_data_key = 0,
173			type_text_position = 0,
174			type_text_delete = false,
175			type_text_delay = false;
176
177		if (type_text_data) {
178			type_text_data = type_text_data.split(';');
179			$.map(type_text_data, $.trim);
180
181			if (type_text_value) {
182				type_text_data.unshift(type_text_value);
183				type_text_position = type_text_data[type_text_data_key].length;
184				type_text_delete = true;
185			}
186
187			if (type_text_data_length = type_text_data.length) {
188				var type_text = function () {
189					if (type_text_position < type_text_data[type_text_data_key].length || type_text_delete) {
190						setTimeout(function () {
191							type_text_delay = false;
192							type_text_position = type_text_position + (type_text_delete ? -1 : 1);
193							$_type_text.text(type_text_data[type_text_data_key].substr(0, type_text_position));
194
195							if (type_text_data_key < (type_text_data_length - 1) || type_text_data_loop) {
196								if (type_text_delete && type_text_position === 0) {
197									type_text_data_key = type_text_data_key === (type_text_data_length - 1) && type_text_data_loop ? 0 : type_text_data_key + 1;
198									type_text_delete = false;
199								} else if (type_text_position === type_text_data[type_text_data_key].length) {
200									type_text_delete = true;
201									type_text_delay = true;
202								}
203							}
204
205							setTimeout(type_text, type_text_delay ? type_text_data_delay : 0);
206						}, type_text_delete ? (type_text_data_speed / 2) : type_text_data_speed);
207					}
208				};
209
210				setTimeout(type_text, type_text_value ? type_text_data_delay : 0);
211			}
212		}
213	});
214
215	// Process custom form styles
216	$('form input[type="checkbox"]:not(.no-custom-style), form input[type="radio"]:not(.no-custom-style)').each(function () {
217		var $_input = $(this),
218			input_type = $_input.attr('type'),
219			$_form_row = $_input.closest('div.form-row'),
220			$_input_style = $('<div class="' + input_type + '-style"></div>'),
221			$_input_style_icon = $('<div class="' + input_type + '-style-icon"></div>'),
222			$_input_change = input_type === 'checkbox' ? $_input : $_input.closest('form').find('input[name="' + $_input.attr('name') + '"]');
223
224		$_input_style_icon.on('click', function () {
225			if ($_input.is(':disabled') === false) {
226				$_input.filter(':not([type="radio"]:checked)').prop('checked', $_input.is(':checked') === false);
227				$_input_change.trigger('change');
228			}
229		});
230
231		$_input_change.on('change', function () {
232			$_input_style[$_input.is(':checked') ? 'addClass' : 'removeClass']('active');
233		});
234
235		$_input.closest('form').on('reset', function () {
236			setTimeout(function () {
237				$_input_change.trigger('change');
238			}, 10);
239		});
240
241		$_input.on('focus blur', function (e) {
242			$_input_style[e.type === 'focus' ? 'addClass' : 'removeClass']('focus');
243		});
244
245		if ($_form_row.find('input[type="' + input_type + '"]').length === 1) $_form_row.addClass(input_type + '-style-block');
246		if (input_type === 'checkbox') $_input_style_icon.append('<i class="fas fa-check"></i>');
247		if ($_input.is(':disabled')) $_input_style.addClass('disabled');
248		if ($_input.is(':checked')) $_input_style.addClass('active');
249		$_input.after($_input_style.append($_input_style_icon));
250		$_input_style.append($_input);
251	});
252
253	$('form select:not([multiple]):not(.no-custom-style)').each(function () {
254		var $_select = $(this),
255			$_select_style_input = $('<input type="text">'),
256			$_select_style = $('<div class="select-style"></div>'),
257			$_select_style_icon = $('<i class="fas fa-chevron-down"></i>');
258
259		$_select.on('change', function () {
260			$_select_style_input.val($_select.find('option:selected').text());
261		});
262
263		$_select.on('focus blur', function (e) {
264			$_select_style_input[e.type === 'focus' ? 'addClass' : 'removeClass']('focus');
265		});
266
267		$_select.closest('form').on('reset', function () {
268			setTimeout(function () {
269				$_select.trigger('change');
270			}, 10);
271		});
272
273		$_select_style_input.on('focus', function () {
274			$_select.trigger('focus');
275		});
276
277		$_select_style_input.val($_select.find('option:selected').text());
278		$_select_style_input.attr($_select.is(':disabled') ? 'disabled' : 'readonly', true);
279		$_select.after($_select_style.append($_select_style_icon, $_select_style_input));
280		$_select_style.append($_select);
281	});
282
283	$('form input[type="search"]:not(.no-custom-style)').each(function () {
284		var $_search = $(this),
285			$_search_form = $_search.closest('form'),
286			$_search_style = $('<div class="search-style"></div>'),
287			$_search_style_icon = $('<div class="search-style-icon"><i class="fas fa-search"></i></div>');
288
289		$_search_style_icon.on('click', function () {
290			$_search_form.submit();
291		});
292
293		$_search.after($_search_style.append($_search_style_icon));
294		$_search_style.append($_search);
295	});
296
297	// Process tab groups
298	$('div.tab-group').each(function () {
299		var $_tab_group = $(this),
300			$_tab_group_nav = $('<ul></ul>'),
301			$_tab_group_items = $_tab_group.find('div.tab-item'),
302			tab_group_item_active = Math.max(0, $_tab_group_items.filter(location.hash && $_tab_group_items.filter(location.hash).length ? location.hash : '.active').index());
303
304		if ($_tab_group_items.length > 1) {
305			$_tab_group_items.each(function (key) {
306				var $_tab_group_item = $(this),
307					$_tab_group_nav_li = $('<li></li>', {id: $_tab_group_item.data('title').replace(/\s/g, '').toLowerCase() || key}),
308					$_tab_group_nav_div = $('<div class="tab-item-title"></div>'),
309					$_tab_group_item_inner = $('<div class="tab-item-inner"></div>'),
310					tab_group_item_title = $_tab_group_item.data('title') || key,
311					tab_group_item_id = $_tab_group_item.attr('id');
312
313				var tab_group_item_change = function () {
314					if (tab_group_item_id) history.pushState(null, null, '#' + tab_group_item_id);
315					$_tab_group.find('div.tab-title').removeClass('active');
316					$_tab_group_nav.find('li').removeClass('active');
317					$_tab_group_items.removeClass('active');
318					$_tab_group_nav_div.addClass('active');
319					$_tab_group_nav_li.addClass('active');
320					$_tab_group_item.addClass('active');
321				};
322
323				if (key === tab_group_item_active) {
324					$_tab_group_nav_div.addClass('active');
325					$_tab_group_nav_li.addClass('active');
326					$_tab_group_item.addClass('active');
327				}
328
329				if (tab_group_item_id) {
330					$_tab_group_item.removeAttr('id');
331					$_tab_group.prepend('<a id="' + tab_group_item_id + '"></a>');
332					$_window.on('hashchange', function () {
333						if (location.hash.substr(1) === tab_group_item_id) tab_group_item_change();
334					});
335				}
336
337				$_tab_group_nav_div.text(tab_group_item_title).on('click', tab_group_item_change).prependTo($_tab_group_item.wrapInner($_tab_group_item_inner));
338				$_tab_group_nav_li.text(tab_group_item_title).on('click', tab_group_item_change).appendTo($_tab_group_nav);
339			});
340
341			$_tab_group.prepend($_tab_group_nav);
342		}
343	});
344
345
346	// Process tab groups
347	$('div.tab-group.sub-tab').each(function () {
348		var $_tab_group = $(this),
349			$_tab_group_nav = $('<ul></ul>'),
350			$_tab_group_items = $_tab_group.find('div.tab-item-sub'),
351			tab_group_item_active = Math.max(0, $_tab_group_items.filter(location.hash && $_tab_group_items.filter(location.hash).length ? location.hash : '.active').index());
352
353		if ($_tab_group_items.length > 1) {
354			$_tab_group_items.each(function (key) {
355				var $_tab_group_item = $(this),
356					$_tab_group_nav_li = $('<li></li>'),
357					$_tab_group_nav_div = $('<div class="tab-item-title"></div>'),
358					$_tab_group_item_inner = $('<div class="tab-item-inner"></div>'),
359					tab_group_item_title = $_tab_group_item.data('title') || key,
360					tab_group_item_id = $_tab_group_item.attr('id');
361
362				var tab_group_item_change = function () {
363					if (tab_group_item_id) history.pushState(null, null, '#' + tab_group_item_id);
364					$_tab_group.find('div.tab-title').removeClass('active');
365					$_tab_group_nav.find('li').removeClass('active');
366					$_tab_group_items.removeClass('active');
367					$_tab_group_nav_div.addClass('active');
368					$_tab_group_nav_li.addClass('active');
369					$_tab_group_item.addClass('active');
370				};
371
372				if (key === tab_group_item_active) {
373					$_tab_group_nav_div.addClass('active');
374					$_tab_group_nav_li.addClass('active');
375					$_tab_group_item.addClass('active');
376				}
377
378				if (tab_group_item_id) {
379					$_tab_group_item.removeAttr('id');
380					$_tab_group.prepend('<a id="' + tab_group_item_id + '"></a>');
381					$_window.on('hashchange', function () {
382						if (location.hash.substr(1) === tab_group_item_id) tab_group_item_change();
383					});
384				}
385
386				$_tab_group_nav_div.text(tab_group_item_title).on('click', tab_group_item_change).prependTo($_tab_group_item.wrapInner($_tab_group_item_inner));
387				$_tab_group_nav_li.text(tab_group_item_title).on('click', tab_group_item_change).appendTo($_tab_group_nav);
388			});
389
390			$_tab_group.prepend($_tab_group_nav);
391		}
392	});
393
394	// Process gallery and client interaction
395	$('div.gallery').each(function (gallery_key) {
396		var $_gallery = $(this),
397			$_gallery_inner = $_gallery.find('ul'),
398			$_gallery_links = $_gallery_inner.find('li a'),
399			$_gallery_images = $_gallery_inner.find('li img');
400
401		if ($_gallery_links.length > 0) {
402			$_gallery_links.on('click', function (e) {
403				var gallery_link_href_click = $(this).attr('href');
404
405				if ($.inArray(gallery_link_href_click.split('.').pop(), ['jpg', 'jpeg', 'png', 'gif']) > -1) {
406					var $_gallery_overlay = $('<div id="gallery-overlay"></div>'),
407						$_gallery_overlay_close = $('<i id="gallery-overlay-close" class="material-icons">close</i>'),
408						$_gallery_overlay_previous = $('<i id="gallery-overlay-previous" class="material-icons">chevron_left</i>'),
409						$_gallery_overlay_next = $('<i id="gallery-overlay-next" class="material-icons">chevron_right</i>'),
410						$_gallery_overlay_title = $('<p id="gallery-overlay-title" class="hide"></p>'),
411						$_gallery_overlay_inner = $('<ul></ul>'),
412						$_gallery_overlay_inner_li = null,
413						gallery_overlay_active = 0,
414						gallery_overlay_key = 0;
415
416					var gallery_overlay_keydown = function (e) {
417						if (e.keyCode === 27) {
418							$_gallery_overlay_close.click();
419						} else if (e.keyCode === 37) {
420							$_gallery_overlay_previous.click();
421						} else if (e.keyCode === 39) {
422							$_gallery_overlay_next.click();
423						}
424					};
425
426					$_gallery_links.each(function (gallery_link_key) {
427						var gallery_link_href = $(this).attr('href'),
428							gallery_link_title = $(this).attr('title');
429
430						if ($.inArray(gallery_link_href.split('.').pop(), ['jpg', 'jpeg', 'png', 'gif']) > -1) {
431							var $_gallery_image_loading = $('<div class="loading hide"></div>'),
432								$_gallery_image = $('<img id="gallery-overlay-' + gallery_key + '-' + (gallery_overlay_key++) + '">');
433
434							if (gallery_link_href_click === gallery_link_href) {
435								var delay = setTimeout(function () {
436									$_gallery_image_loading.removeClass('hide');
437								}, 50);
438
439								$_gallery_image.attr('src', gallery_link_href).imagesLoaded(function () {
440									if (delay) {
441										clearTimeout(delay);
442									}
443
444									$_gallery_image_loading.addClass('hide');
445									$_gallery_image.addClass('ready');
446								});
447
448								if (gallery_link_title) {
449									$_gallery_overlay_title.text(gallery_link_title).removeClass('hide');
450								}
451
452								gallery_overlay_active = gallery_link_key;
453							} else {
454								$_gallery_image.data('src', gallery_link_href);
455							}
456
457							if (gallery_link_title) {
458								$_gallery_image.data('title', gallery_link_title);
459							}
460
461							$_gallery_overlay_inner.append($('<li></li>').append($_gallery_image_loading, $_gallery_image));
462						}
463					});
464
465					$_gallery_overlay_inner_li = $_gallery_overlay_inner.find('li');
466					$_gallery_overlay_inner_li.each(function (gallery_overlay_inner_li_key) {
467						$(this).css(
468							{
469								width: (100 / $_gallery_overlay_inner_li.length) + '%',
470								left: ((100 / $_gallery_overlay_inner_li.length) * gallery_overlay_inner_li_key) + '%'
471							});
472					});
473
474					$_window.on('keydown', gallery_overlay_keydown);
475					$_body.prepend($_gallery_overlay.append($_gallery_overlay_inner));
476					$_gallery_overlay.append($_gallery_overlay_close, $_gallery_overlay_title);
477					$_gallery_overlay_inner.css('width', ($_gallery_overlay_inner_li.length * 100) + '%');
478					$_gallery_overlay_close.on('click', function () {
479						$_window.off('keydown', gallery_overlay_keydown);
480						$_gallery_overlay.remove();
481					});
482
483					if ($_gallery_overlay_inner_li.length > 1) {
484						var gallery_overlay_change = function (active) {
485							var $_gallery_image = $('#gallery-overlay-' + gallery_key + '-' + active),
486								$_gallery_loading = $_gallery_image.parent().find('div.loading'),
487								gallery_image_data_src = $_gallery_image.data('src'),
488								gallery_image_data_title = $_gallery_image.data('title');
489
490							if (gallery_image_data_src) {
491								var delay = setTimeout(function () {
492									$_gallery_loading.removeClass('hide');
493								}, 50);
494
495								$_gallery_image.data('src', '').attr('src', gallery_image_data_src).imagesLoaded(function () {
496									if (delay) {
497										clearTimeout(delay);
498									}
499
500									$_gallery_loading.addClass('hide');
501									$_gallery_image.addClass('ready');
502								});
503							}
504
505							if (gallery_image_data_title) {
506								$_gallery_overlay_title.text(gallery_image_data_title).removeClass('hide');
507							} else {
508								$_gallery_overlay_title.addClass('hide');
509							}
510
511							$_gallery_overlay_previous[active === 0 ? 'hide' : 'show']();
512							$_gallery_overlay_next[(active + 1) === $_gallery_overlay_inner_li.length ? 'hide' : 'show']();
513							$_gallery_overlay_inner.css('transform', 'translateX(-' + ((100 / $_gallery_overlay_inner_li.length) * active) + '%)');
514						};
515
516						var gallery_overlay_previous = function () {
517							if ((gallery_overlay_active - 1) > -1) {
518								gallery_overlay_change(gallery_overlay_active = gallery_overlay_active - 1);
519							}
520						};
521
522						var gallery_overlay_next = function () {
523							if ((gallery_overlay_active + 1) < $_gallery_overlay_inner_li.length) {
524								gallery_overlay_change(gallery_overlay_active = gallery_overlay_active + 1);
525							}
526						};
527
528						if (gallery_overlay_active > 0) {
529							gallery_overlay_change(gallery_overlay_active);
530						} else {
531							$_gallery_overlay_previous.hide();
532						}
533
534						if (touch_device) {
535							$_gallery_overlay.swipe(
536								{
537									left: gallery_overlay_next,
538									right: gallery_overlay_previous
539								});
540						}
541
542						$_gallery_overlay.append($_gallery_overlay_previous, $_gallery_overlay_next);
543						$_gallery_overlay_previous.on('click', gallery_overlay_previous);
544						$_gallery_overlay_next.on('click', gallery_overlay_next);
545					}
546
547					e.preventDefault();
548				}
549			});
550		}
551
552		if ($_gallery_images.length > 1 && $_gallery.is('.gallery-slider')) {
553			var $_gallery_previous = $('<i class="gallery-previous material-icons">chevron_left</i>'),
554				$_gallery_next = $('<i class="gallery-next material-icons">chevron_right</i>'),
555				gallery_image_rotation = $(this).data('rotation'),
556				gallery_image_active = 0;
557
558			var gallery_height = function ($_image, animate) {
559				$_image.imagesLoaded(function () {
560					$_gallery[animate ? 'addClass' : 'removeClass']('gallery-animate').css('height', $_image.height() + 'px');
561				});
562			};
563
564			var gallery_change = function (inactive, active, clear) {
565				if (clear && gallery_image_rotation) {
566					clearInterval(gallery_image_rotation);
567				}
568
569				gallery_height($('#gallery-' + gallery_key + '-' + active), true);
570				$_gallery_inner.css('transform', 'translateX(-' + ((100 / $_gallery_images.length) * active) + '%)');
571			};
572
573			var gallery_previous = function () {
574				gallery_change(gallery_image_active, gallery_image_active = (gallery_image_active - 1) < 0 ? ($_gallery_images.length - 1) : (gallery_image_active - 1), true);
575			};
576
577			var gallery_next = function () {
578				gallery_change(gallery_image_active, gallery_image_active = (gallery_image_active + 1) > ($_gallery_images.length - 1) ? 0 : (gallery_image_active + 1), true);
579			};
580
581			$_gallery_images.each(function (key) {
582				if (key === 0) {
583					$_window.on('load', function () {
584						gallery_height($('#gallery-' + gallery_key + '-' + key), false);
585					});
586				}
587
588				$(this).attr('id', 'gallery-' + gallery_key + '-' + key);
589			});
590
591			if (touch_device) {
592				$_gallery.swipe(
593					{
594						left: gallery_next,
595						right: gallery_previous
596					});
597			}
598
599			$_gallery_previous.on('click', gallery_previous);
600			$_gallery_next.on('click', gallery_next);
601			$_window.on('resize', function () {
602				gallery_height($('#gallery-' + gallery_key + '-' + gallery_image_active), false);
603			});
604
605			$_gallery_inner.css('width', ($_gallery_images.length * 100) + '%');
606			$_gallery.prepend($_gallery_previous, $_gallery_next);
607
608			if (gallery_image_rotation) {
609				gallery_image_rotation = setInterval(function () {
610					gallery_change(gallery_image_active, gallery_image_active = (gallery_image_active + 1) > ($_gallery_images.length - 1) ? 0 : (gallery_image_active + 1), false);
611				}, gallery_image_rotation * 1000);
612			}
613		}
614	});
615
616	// Process interaction with product term selectors
617	$('select.product-term-select').each(function (select_key) {
618		var $_product_term_select = $(this),
619			$_product_term_select_sync = $('select.product-term-select[data-sync="' + $_product_term_select.data('sync') + '"]'),
620			$_product_box = $_product_term_select.parents('div.product-box'),
621			$_product_button = $_product_box.find('div.product-order a.button'),
622			$_product_price = $_product_box.find('div.product-price');
623
624		var product_term_select = function (e) {
625			if ($_product_term_select.is(':disabled') === false) {
626				var $_select_active = $_product_term_select.find('option:selected'),
627					select_active_data_price = $_select_active.data('price'),
628					select_active_data_term = $_select_active.data('term'),
629					select_active_data_href = $_select_active.data('href');
630
631				if (select_active_data_href && $_product_button.length) {
632					$_product_button.attr('href', select_active_data_href);
633				}
634
635				if (select_active_data_price && $_product_price.length) {
636					$_product_price.html(select_active_data_price);
637
638					if (select_active_data_term) {
639						$_product_price.append('<span class="term">' + select_active_data_term + '</span>');
640						$_product_price.attr('data-add', '<span class="term">' + select_active_data_term + '</span>');
641					}
642					$_product_price.attr('data-price', $_product_price.text().replace(select_active_data_term, '').replace(',', '.').replace(' €', '').replace('€', ''));
643					businessSwitch(false);
644				}
645
646				if ($_product_term_select_sync.length && e && e.originalEvent) {
647					$_product_term_select_sync.find('option:eq(' + $_select_active.index() + ')').prop('selected', true).change();
648				}
649			}
650		};
651
652		$_product_term_select.on('change', product_term_select);
653		product_term_select();
654	});
655
656	// Process product sliders and client interaction
657	$('div.product-slider').each(function (slider_key) {
658		var $_product_slider = $(this),
659			$_products = $_product_slider.find('> ul'),
660			products_li_length = $_products.first().find('li').length,
661			products_active_length = $_products.filter('.active').length;
662
663		if ($_products.length > 0) {
664			var slider_segment_width = 100 / $_products.length,
665				$_product_slider_sync = $('div.product-slider[data-sync="' + $_product_slider.data('sync') + '"]'),
666				$_slider = $('<div class="slider clear"></div>'),
667				$_handle = $('<div class="handle"></div>'),
668				$_range = $('<div class="range"></div>');
669
670			var move_slider = function (client_x, click) {
671				var client_offset_left = ((client_x - $_slider.offset().left) / $_slider.width()) * 100,
672					product = Math.min(Math.max(client_offset_left / (100 / $_products.length), 1), $_products.length),
673					product_next = Math.round(product),
674					product_difference = Math.abs(product_next - product);
675
676				if (product_difference < 0.1 || click) {
677					if ($_product_slider_sync.length) {
678						$_product_slider_sync.each(function () {
679							$(this).find('> ul').removeClass('active');
680							$(this).find('div.range').css('width', (slider_segment_width * product_next) + '%');
681							$('#' + $(this).attr('id') + '-' + (product_next - 1)).addClass('active');
682						});
683					} else {
684						$_products.removeClass('active');
685						$_range.css('width', (slider_segment_width * product_next) + '%');
686						$('#product-slider-' + slider_key + '-' + (product_next - 1)).addClass('active');
687					}
688				} else {
689					$_range.css('width', client_offset_left + '%');
690				}
691			};
692
693			$_products.each(function (product_key) {
694				if ((products_active_length === 0 && product_key === 0) || (products_active_length === 1 && $(this).is('.active'))) {
695					$(this).addClass('active');
696					$_range.css('width', (slider_segment_width * (product_key + 1)) + '%').append($_handle);
697				}
698
699				$(this).attr('id', 'product-slider-' + slider_key + '-' + product_key);
700				$_slider.append('<div class="segment" style="width: ' + slider_segment_width + '%;"></div>');
701			});
702
703			$_slider.on('click', function (e) {
704				move_slider(e.pageX, true);
705			});
706
707			$_handle.on('mousedown touchstart', function (e_down) {
708				$_window.on('mousemove touchmove', function (e_move) {
709					move_slider(e_move.pageX || e_move.touches[0].pageX, false);
710				});
711				$_window.on('mouseup touchend', function (e_up) {
712					move_slider(e_up.pageX || e_up.changedTouches[0].pageX, true);
713					$_window.off('mousemove touchmove').off('mouseup touchend');
714				});
715				e_down.preventDefault();
716			});
717
718			$_product_slider.attr('id', 'product-slider-' + slider_key);
719			$_product_slider.prepend($_slider.prepend($_range));
720		}
721	});
722
723	// Process product configurator and client interaction
724	$('div.product-configurator').each(function (configurator_key) {
725		var $_product_configurator = $(this),
726			$_product_configurator_sync = $('div.product-configurator[data-sync="' + $_product_configurator.data('sync') + '"]'),
727			$_product_configurator_total = $_product_configurator.find('div.configurator-total span.value'),
728			$_product_configurator_input = $_product_configurator.find('div.configurator-row input'),
729			product_configurator_currency = $_product_configurator.data('currency');
730
731		if ($_product_configurator.length && $_product_configurator_input.length && product_configurator_currency) {
732			$_product_configurator_input.each(function (input_key) {
733				var $_configurator_input = $(this),
734					$_configurator_group = $('<div class="configurator-group"></div>'),
735					$_configurator_slider = $('<div class="slider clear"></div>'),
736					$_configurator_handle = $('<div class="handle"></div>'),
737					$_configurator_range = $('<div class="range"></div>'),
738					$_configurator_title = $('<span class="value"></span>'),
739					configurator_input_value = Number($_configurator_input.val()),
740					configurator_input_data_min = Number($_configurator_input.data('min')),
741					configurator_input_data_max = Number($_configurator_input.data('max')),
742					configurator_input_data_step = Number($_configurator_input.data('step')),
743					configurator_input_data_price = Number($_configurator_input.data('price')),
744					configurator_input_data_title = $_configurator_input.data('title'),
745					configurator_input_data_title_plural = $_configurator_input.data('title-plural'),
746					configurator_input_data_description = $_configurator_input.data('description');
747
748				if (isNaN(configurator_input_data_step)) {
749					configurator_input_data_step = configurator_input_data_min;
750				}
751
752				var configurator_input_step = configurator_input_data_max / configurator_input_data_step,
753					configurator_slider_segment_width = 100 / configurator_input_step;
754
755				if (configurator_input_step === parseInt(configurator_input_step, 10)) {
756					var update_configurator = function (args) {
757						if (args.el_configurator_title.length) {
758							args.val_configurator_input = args.val_configurator_input + (args.val_configurator_title_plural && args.val_configurator_input != 1 ? args.val_configurator_title_plural : args.val_configurator_title);
759							args.el_configurator_title.html(args.val_configurator_input);
760						}
761
762						if (args.el_product_configurator_total.length) {
763							var configurator_input_total = 0;
764
765							args.el_product_configurator_input.each(function () {
766								var configurator_input_total_value = Number($(this).val()),
767									configurator_input_total_data_price = Number($(this).data('price')),
768									configurator_input_total_data_include = Number($(this).data('include')),
769									configurator_input_total_data_step = Number($(this).data('step')) || Number($(this).data('min'));
770
771								if (isNaN(configurator_input_total_data_include) === false) {
772									configurator_input_total_value = configurator_input_total_value - configurator_input_total_data_include;
773								}
774
775								if (configurator_input_total_value > 0) {
776									configurator_input_total += (configurator_input_total_value / configurator_input_total_data_step) * configurator_input_total_data_price;
777								}
778							});
779
780							args.el_product_configurator_total.html(args.val_product_configurator_currency.replace('%', (Math.round(configurator_input_total * Math.pow(10, 4)) / Math.pow(10, 4)).toFixed(2).toString().replace(/\./g, ',')));
781							$(args.el_product_configurator_total).attr('data-price', args.el_product_configurator_total.text().replace(',', '.').replace(' €', '').replace('€', ''));
782							businessSwitch(false);
783						}
784					};
785
786					var move_slider = function (client_x, click) {
787						var client_offset_left = ((client_x - $_configurator_slider.offset().left) / $_configurator_slider.width()) * 100,
788							client_offset_left_min = configurator_slider_segment_width * (configurator_input_data_min / configurator_input_data_step),
789							configurator_step = Math.min(Math.max(client_offset_left / (100 / configurator_input_step), configurator_input_data_min > 0 ? 1 : 0), configurator_input_step),
790							configurator_step_next = Math.round(configurator_step),
791							configurator_step_difference = Math.abs(configurator_step_next - configurator_step),
792							configurator_input_value_next = configurator_input_data_step * configurator_step_next,
793							configurator_range_width = Math.min(Math.max(client_offset_left, client_offset_left_min), 100);
794
795						if (configurator_input_value_next < configurator_input_data_min) {
796							configurator_step_next = configurator_input_data_min / configurator_input_data_step;
797							configurator_input_value_next = configurator_input_data_min;
798						}
799
800						if (client_offset_left >= client_offset_left_min && (configurator_step_difference < 0.1 || click)) {
801							configurator_range_width = configurator_slider_segment_width * configurator_step_next;
802						}
803
804						if ($_product_configurator_sync.length) {
805							$_product_configurator_sync.each(function () {
806								var $_product_configurator_sync_item = $(this),
807									$_product_configurator_sync_item_total = $_product_configurator_sync_item.find('div.configurator-total span.value'),
808									$_product_configurator_sync_item_input = $_product_configurator_sync_item.find('div.configurator-row input'),
809									$_product_configurator_sync_item_input_active = $_product_configurator_sync_item_input.filter('[name="' + $_configurator_input.attr('name') + '"]'),
810									$_product_configurator_sync_item_input_active_row = $_product_configurator_sync_item_input_active.parents('div.configurator-row');
811
812								$_product_configurator_sync_item_input_active_row.find('div.range').css('width', configurator_range_width + '%');
813								$_product_configurator_sync_item_input_active.val(configurator_input_value_next);
814
815								update_configurator(
816									{
817										el_configurator_title: $_product_configurator_sync_item_input_active_row.find('div.configurator-group span.value'),
818										el_product_configurator_total: $_product_configurator_sync_item_total,
819										el_product_configurator_input: $_product_configurator_sync_item_input,
820										val_configurator_input: configurator_input_value_next,
821										val_configurator_title: $_product_configurator_sync_item_input_active.data('title'),
822										val_configurator_title_plural: $_product_configurator_sync_item_input_active.data('title-plural'),
823										val_product_configurator_currency: $_product_configurator_sync_item.data('currency')
824									});
825							});
826						} else {
827							$_configurator_range.css('width', configurator_range_width + '%');
828							$_configurator_input.val(configurator_input_value_next);
829
830							update_configurator(
831								{
832									el_configurator_title: $_configurator_title,
833									el_product_configurator_total: $_product_configurator_total,
834									el_product_configurator_input: $_product_configurator_input,
835									val_configurator_input: configurator_input_value_next,
836									val_configurator_title: configurator_input_data_title,
837									val_configurator_title_plural: configurator_input_data_title_plural,
838									val_product_configurator_currency: product_configurator_currency
839								});
840						}
841					};
842
843					for (var i = -1; i < configurator_input_step; i++) {
844						if (configurator_input_value == ((i + 1) * configurator_input_data_step)) {
845							$_configurator_range.css('width', (configurator_slider_segment_width * (i + 1)) + '%').append($_configurator_handle);
846						}
847
848						$_configurator_slider.append('<div class="segment" style="width: ' + configurator_slider_segment_width + '%;"></div>');
849					}
850
851					$_configurator_slider.on('click', function (e) {
852						move_slider(e.pageX, true);
853					});
854
855					$_configurator_handle.on('mousedown touchstart', function (e_down) {
856						$_window.on('mousemove touchmove', function (e_move) {
857							move_slider(e_move.pageX || e_move.touches[0].pageX, false);
858						});
859						$_window.on('mouseup touchend', function (e_up) {
860							move_slider(e_up.pageX || e_up.changedTouches[0].pageX, true);
861							$_window.off('mousemove touchmove').off('mouseup touchend');
862						});
863						e_down.preventDefault();
864					});
865
866					$_configurator_input.before($_configurator_group.html($_configurator_title).append(configurator_input_data_description ? '<span class="label">' + configurator_input_data_description + '</span>' : ''));
867					$_configurator_input.before($_configurator_slider.prepend($_configurator_range));
868
869					update_configurator(
870						{
871							el_configurator_title: $_configurator_title,
872							el_product_configurator_total: $_product_configurator_total,
873							el_product_configurator_input: $_product_configurator_input,
874							val_configurator_input: configurator_input_value,
875							val_configurator_title: configurator_input_data_title,
876							val_configurator_title_plural: configurator_input_data_title_plural,
877							val_product_configurator_currency: product_configurator_currency
878						});
879				}
880			});
881		}
882	});
883
884	// Generate line numbers for pre code
885	$('pre.pre-code').each(function () {
886		var $_ul = $('<ul></ul>'),
887			code = $(this).html().trim('\n'),
888			code_lines = code.split('\n').length;
889
890		if (code_lines) {
891			for (var i = 1; i <= code_lines; i++) {
892				$_ul.append('<li>' + i + '</li>');
893			}
894
895			$(this).removeClass('pre-code').wrap('<div class="pre-code"></div>').after($_ul);
896		}
897	});
898
899	// Automatically adjust iframe height
900	$('iframe.iframe-keep-aspect-ratio').each(function () {
901		var $_iframe = $(this),
902			iframe_width = $(this).attr('width'),
903			iframe_height = $(this).attr('height');
904
905		var iframe_resize = function () {
906			var iframe_resize_width = $_iframe.width(),
907				iframe_resize_height = 0;
908
909			if (iframe_width !== iframe_resize_width) {
910				iframe_resize_height = Math.round((iframe_height / iframe_width) * iframe_resize_width);
911				$_iframe.css('height', iframe_resize_height + 'px');
912			}
913		};
914
915		$_window.on('resize', iframe_resize);
916		iframe_resize();
917	});
918
919	// Format tables with responsive headers and caption
920	$('table').each(function () {
921		if ($(this).is('.table-layout-static') === false) {
922			var $_thead_th = $(this).find('thead tr th'),
923				$_tbody_tr = $(this).find('tbody tr');
924
925			if ($_thead_th.length && $_tbody_tr.length) {
926				$_thead_th.each(function (key) {
927					var $_tbody_td = $_tbody_tr.find('td:nth-of-type(' + (key + 1) + ')'),
928						th_text = $(this).text();
929
930					if ($_tbody_td.length && th_text) {
931						$_tbody_td.addClass('has-responsive-th').prepend('<span class="responsive-th">' + th_text + '</span>');
932					}
933				});
934			}
935		}
936
937		$(this).has('caption').addClass('table-has-caption');
938	});
939
940	// Process grid layouts
941	$('div.grid').each(function () {
942		var $_grid = $(this),
943			$_grid_items = $_grid.find('> div.grid-item'),
944			$_grid_container = $_grid.closest('div.container'),
945			grid_data_columns = $_grid.data('grid-columns'),
946			grid_data_gap = $_grid.data('grid-gap');
947
948		if ($_grid_items.length) {
949			grid_data_columns = grid_data_columns || 3;
950			grid_data_gap = grid_data_gap >= 0 ? grid_data_gap : 60;
951
952			var grid_update = function () {
953				var grid_container_width = $_grid_container.outerWidth(),
954					grid_data_columns_resize = grid_data_columns,
955					grid_data_gap_resize = grid_data_gap,
956					window_width = $_window.width();
957
958				$.each([512, 768, 1024], function (key, value) {
959					if (window_width <= value) {
960						grid_data_columns_resize = Math.max(grid_data_columns - (3 - key), 1);
961						grid_data_gap_resize = Math.min(grid_data_gap, 30);
962						return false;
963					}
964				});
965
966				$_grid_items.css('width', ((grid_container_width - (grid_data_gap_resize * (grid_data_columns_resize - 1))) / grid_data_columns_resize).toFixed(4) + 'px');
967				Bricks({
968					container: $_grid[0],
969					packed: 'data-grid',
970					sizes: [{columns: grid_data_columns_resize, gutter: grid_data_gap_resize}]
971				}).pack();
972			};
973
974			$_window.on('resize', grid_update);
975			$_window.on('load', grid_update);
976			grid_update();
977		}
978	});
979
980	// Automatically adjust content row height
981	$('section.content-row').each(function () {
982		var $_content_row = $(this),
983			content_row_half_height = $_content_row.hasClass('content-row-half-height'),
984			content_row_full_height = $_content_row.hasClass('content-row-full-height');
985
986		if (content_row_half_height || content_row_full_height) {
987			var content_row_resize_height = 0,
988				content_row_resize_factor = content_row_full_height ? 1 : 2,
989				content_row_first = $_content_row.is('section.content-row:first');
990
991			var content_row_resize = function () {
992				$_content_row.css('height', 'auto');
993				content_row_resize_height = Math.round(($_window.height() - (content_row_first ? $_content_row.offset().top : (header_dynamic ? 0 : $_header.outerHeight()))) / content_row_resize_factor);
994
995				if (content_row_resize_height > $_content_row.outerHeight()) {
996					$_content_row.css('height', content_row_resize_height + 'px');
997				}
998			};
999
1000			$_window.on('resize', content_row_resize);
1001			$_window.on('load', content_row_resize);
1002			content_row_resize();
1003		}
1004	});
1005
1006	// Process content sliders and client interaction
1007	$('div.content-slider').each(function (content_slider_key) {
1008		var $_content_slider = $(this),
1009			$_content_slider_slides = $_content_slider.find('> .slide'),
1010			$_content_slider_inner = $('<div class="content-slider-inner"></div>'),
1011			content_slider_slides_length = $_content_slider_slides.length;
1012
1013		if (content_slider_slides_length) {
1014			var content_slider_height = function () {
1015				var content_slider_container_height = 0,
1016					content_slider_padding_top = parseInt($_content_slider_slides.css('padding-top'), 10),
1017					content_slider_padding_bottom = parseInt($_content_slider_slides.css('padding-bottom'), 10);
1018
1019				$_content_slider_slides.find('div.container').each(function () {
1020					content_slider_container_height = Math.max(content_slider_container_height, $(this).outerHeight());
1021				});
1022
1023				$_content_slider.css('height', (content_slider_container_height + content_slider_padding_top + content_slider_padding_bottom) + 'px');
1024			};
1025
1026			if (content_slider_slides_length > 1) {
1027				var content_slider_slide_active = 0,
1028					content_slider_nav = $_content_slider.data('nav'),
1029					content_slider_rotation = $_content_slider.data('rotation'),
1030					$_content_slider_nav = $('<ul></ul>'),
1031					$_content_slider_nav_li = null;
1032
1033				var content_slider_slide_change = function (inactive, active, clear) {
1034					if (clear && content_slider_rotation) {
1035						clearInterval(content_slider_rotation);
1036					}
1037
1038					if (content_slider_nav) {
1039						$('#content-slider-nav-' + content_slider_key + '-' + inactive).removeClass('active');
1040						$('#content-slider-nav-' + content_slider_key + '-' + active).addClass('active');
1041					}
1042
1043					if (inactive > active) {
1044						$('#content-slider-' + content_slider_key + '-' + inactive).addClass('inactive animate-previous').removeClass('active');
1045						$('#content-slider-' + content_slider_key + '-' + active).addClass('active animate-previous').removeClass('inactive');
1046					} else {
1047						$('#content-slider-' + content_slider_key + '-' + inactive).addClass('inactive').removeClass('active animate-previous');
1048						$('#content-slider-' + content_slider_key + '-' + active).addClass('active').removeClass('inactive animate-previous');
1049					}
1050				};
1051
1052				var content_slider_previous = function () {
1053					content_slider_slide_change(content_slider_slide_active, content_slider_slide_active = (content_slider_slide_active - 1) < 0 ? (content_slider_slides_length - 1) : (content_slider_slide_active - 1), true);
1054				};
1055
1056				var content_slider_next = function () {
1057					content_slider_slide_change(content_slider_slide_active, content_slider_slide_active = (content_slider_slide_active + 1) > (content_slider_slides_length - 1) ? 0 : (content_slider_slide_active + 1), true);
1058				};
1059
1060				if ((content_slider_slide_active = $_content_slider.find('.slide.active').index()) === -1) {
1061					content_slider_slide_active = 0;
1062				}
1063
1064				$_content_slider_slides.each(function (key) {
1065					if (content_slider_nav) {
1066						var $_content_slider_nav_li_append = $('<li></li>'),
1067							content_slider_slide_title = $(this).data('title'),
1068							content_slider_slide_title_resize = null;
1069
1070						if (key === content_slider_slide_active) {
1071							$_content_slider_nav_li_append.addClass('active');
1072						}
1073
1074						if (content_slider_slide_title) {
1075							content_slider_slide_title_resize = function () {
1076								$_content_slider_nav_li_append.text($_window.width() <= 768 ? '' : content_slider_slide_title);
1077							};
1078
1079							$_window.on('resize', content_slider_slide_title_resize);
1080							content_slider_slide_title_resize();
1081						}
1082
1083						$_content_slider_nav_li_append.attr('id', 'content-slider-nav-' + content_slider_key + '-' + key).data('slide', key);
1084						$_content_slider_nav.append($_content_slider_nav_li_append);
1085					}
1086
1087					if (key === content_slider_slide_active) {
1088						$(this).removeClass('active').addClass('active-first');
1089					}
1090
1091					$(this).attr('id', 'content-slider-' + content_slider_key + '-' + key);
1092				});
1093
1094				if (content_slider_nav) {
1095					$_content_slider.addClass('content-slider-has-nav').prepend($_content_slider_nav);
1096					$_content_slider_nav_li = $_content_slider_nav.find('li').on('click', function () {
1097						content_slider_slide_change(content_slider_slide_active, content_slider_slide_active = $(this).data('slide'), true);
1098					});
1099				}
1100
1101				if ($_content_slider.data('nav-directional')) {
1102					var $_content_slider_previous = $('<i class="slide-previous material-icons">chevron_left</i>'),
1103						$_content_slider_next = $('<i class="slide-next material-icons">chevron_right</i>');
1104
1105					$_content_slider.prepend($_content_slider_previous, $_content_slider_next);
1106					$_content_slider_previous.on('click', content_slider_previous);
1107					$_content_slider_next.on('click', content_slider_next);
1108				}
1109
1110				if (touch_device) {
1111					$_content_slider.swipe(
1112						{
1113							left: content_slider_next,
1114							right: content_slider_previous
1115						});
1116				}
1117
1118				if (content_slider_rotation) {
1119					content_slider_rotation = setInterval(function () {
1120						content_slider_slide_change(content_slider_slide_active, content_slider_slide_active = (content_slider_slide_active + 1) > (content_slider_slides_length - 1) ? 0 : (content_slider_slide_active + 1), false);
1121					}, content_slider_rotation * 1000);
1122				}
1123			} else {
1124				$_content_slider_slides.removeClass('active').addClass('active-first');
1125			}
1126
1127			$_content_slider.append($_content_slider_inner.append($_content_slider_slides));
1128			$_window.on('resize', content_slider_height);
1129			$_window.on('load', content_slider_height);
1130			content_slider_height();
1131		}
1132	});
1133
1134	// Process content row backgrounds
1135	$('div.content-background').each(function () {
1136		var $_content_background = $(this),
1137			$_content_background_item = $_content_background.find('i, svg, img, video, iframe');
1138
1139		if ($_content_background_item.length) {
1140			var content_background_icon = $_content_background_item.is('i'),
1141				content_background_media = $_content_background_item.is('svg, img, video'),
1142				content_background_scale = $_content_background.hasClass('content-background-scale'),
1143				content_background_scroll = $_content_background.hasClass('content-background-scroll');
1144
1145			if (content_background_icon) {
1146				content_background_icon = function () {
1147					var content_background_width = $_content_background.outerWidth(),
1148						content_background_height = $_content_background.outerHeight();
1149
1150					$_content_background_item.css('font-size', Math.round(Math[content_background_scale ? 'min' : 'max'](content_background_width, content_background_height)) + 'px');
1151				};
1152
1153				$_window.on('resize', content_background_icon);
1154				$_window.on('load', content_background_icon);
1155				content_background_icon();
1156			} else if (content_background_media) {
1157				content_background_media = function () {
1158					$_content_background.removeClass('object-fit-width');
1159					$_content_background.removeClass('object-fit-height');
1160
1161					if (content_background_scale) {
1162						var content_background_width = $_content_background.outerWidth(),
1163							content_background_item_width = $_content_background_item.outerWidth();
1164
1165						if (content_background_width < content_background_item_width) {
1166							$_content_background.addClass('object-fit-width');
1167						}
1168
1169						var content_background_height = $_content_background.outerHeight(),
1170							content_background_item_height = $_content_background_item.outerHeight();
1171
1172						if (content_background_height < content_background_item_height) {
1173							$_content_background.addClass('object-fit-height');
1174						}
1175					} else {
1176						var content_background_height = $_content_background.outerHeight(),
1177							content_background_item_height = $_content_background_item.outerHeight();
1178
1179						if (content_background_height > content_background_item_height) {
1180							$_content_background.addClass('object-fit-height');
1181						}
1182					}
1183				};
1184
1185				$_content_background_item.on('loadeddata', content_background_media);
1186				$_window.on('resize', content_background_media);
1187				$_window.on('load', content_background_media);
1188				content_background_media();
1189			}
1190
1191			if (content_background_scroll) {
1192				var $_content_row = $_content_background.closest('section.content-row'),
1193					content_background_scroll_request = null;
1194
1195				content_background_scroll = function () {
1196					var content_row_offset_top = $_content_row.offset().top,
1197						content_row_height = $_content_row.outerHeight(),
1198						window_scroll_top = $_window.scrollTop(),
1199						window_height = $_window.height();
1200
1201					if ((window_scroll_top + window_height) > content_row_offset_top && window_scroll_top < (content_row_offset_top + content_row_height)) {
1202						$_content_background.css('transform', 'translate3d(0, ' + (40 * (((window_scroll_top + window_height) - content_row_offset_top) / (content_row_height + window_height)).toFixed(4) - 20) + '%, 0)');
1203					}
1204				};
1205
1206				if (window.requestAnimationFrame) {
1207					content_background_scroll_request = function () {
1208						requestAnimationFrame(content_background_scroll);
1209					};
1210				}
1211
1212				$_window.on('resize scroll', content_background_scroll_request || content_background_scroll);
1213				$_window.on('load', content_background_scroll);
1214				content_background_scroll();
1215			}
1216		}
1217	});
1218
1219	// Handle video overlay links
1220	$('a.video-overlay').each(function () {
1221		var $_video_overlay_link = $(this),
1222			video_overlay_href = $_video_overlay_link.attr('href'),
1223			video_overlay_width = $_video_overlay_link.data('width') || 1280,
1224			video_overlay_height = $_video_overlay_link.data('height') || 720;
1225
1226		if (video_overlay_href) {
1227			var video_youtube = video_overlay_href.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/),
1228				video_vimeo = video_overlay_href.match(/(?:https?:\/{2})?(?:w{3}\.)?vimeo\.com\/(\d+)(?:$|[^\s&]+)/),
1229				video_html = $.inArray(video_overlay_href.split('.').pop(), ['mp4', 'mov']) > -1;
1230
1231			if (video_youtube || video_vimeo || video_html) {
1232				if ($_video_overlay_link.find('> img').length) {
1233					$_video_overlay_link.addClass('video-overlay-has-icon');
1234					$_video_overlay_link.append('<i id="video-overlay-icon" class="material-icons">play_arrow</i>');
1235				}
1236
1237				video_youtube = video_youtube ? 'https://www.youtube.com/embed/' + video_youtube[1] + '?autoplay=1' : false;
1238				video_vimeo = video_vimeo ? 'https://player.vimeo.com/video/' + video_vimeo[1] + '?autoplay=1' : false;
1239				video_html = video_html ? video_overlay_href : false;
1240
1241				$_video_overlay_link.on('click', function (e) {
1242					var $_video_overlay = $('<div id="video-overlay"></div>'),
1243						$_video_overlay_close = $('<i id="video-overlay-close" class="material-icons">close</i>'),
1244						$_video_overlay_player = $(video_html ? '<video controls autoplay></video>' : '<iframe allowfullscreen></iframe>');
1245
1246					var video_overlay_keydown = function (e) {
1247						if (e.keyCode === 27) {
1248							$_video_overlay_close.click();
1249						}
1250					};
1251
1252					var video_overlay_resize = function () {
1253						var video_scale = Math.min(($_window.width() - 120) / video_overlay_width, ($_window.height() - 120) / video_overlay_height);
1254
1255						$_video_overlay_player.css(
1256							{
1257								maxWidth: video_overlay_width + 'px',
1258								maxHeight: video_overlay_height + 'px',
1259								width: Math.round(video_scale * video_overlay_width) + 'px',
1260								height: Math.round(video_scale * video_overlay_height) + 'px'
1261							});
1262					};
1263
1264					$_video_overlay.append($_video_overlay_player.attr('src', video_html ? video_html : (video_youtube ? video_youtube : video_vimeo)));
1265					$_body.prepend($_video_overlay.append($_video_overlay_close));
1266					$_window.on('keydown', video_overlay_keydown);
1267					$_window.on('resize', video_overlay_resize);
1268					$_video_overlay_close.on('click', function () {
1269						$_window.off('keydown', video_overlay_keydown);
1270						$_window.off('resize', video_overlay_resize);
1271						$_video_overlay.remove();
1272					});
1273
1274					video_overlay_resize();
1275					e.preventDefault();
1276				});
1277			}
1278		}
1279	});
1280
1281	// Handle iframe overlay links
1282	$('a.iframe-overlay').each(function () {
1283		var $_iframe_overlay_link = $(this),
1284			iframe_overlay_src = $_iframe_overlay_link.data('src'),
1285			iframe_overlay_width = $_iframe_overlay_link.data('width'),
1286			iframe_overlay_height = $_iframe_overlay_link.data('height');
1287
1288		if (iframe_overlay_src) {
1289			$_iframe_overlay_link.on('click', function (e) {
1290				var $_iframe_overlay = $('<div id="iframe-overlay"></div>'),
1291					$_iframe_overlay_close = $('<i id="iframe-overlay-close" class="material-icons">close</i>'),
1292					$_iframe_overlay_container = $('<iframe allowfullscreen></iframe>').attr('src', iframe_overlay_src);
1293
1294				var iframe_overlay_keydown = function (e) {
1295					if (e.keyCode === 27) {
1296						$_iframe_overlay_close.click();
1297					}
1298				};
1299
1300				var iframe_overlay_resize = function () {
1301					if (iframe_overlay_width && iframe_overlay_height) {
1302						var iframe_scale = Math.min(($_window.width() - 120) / iframe_overlay_width, ($_window.height() - 120) / iframe_overlay_height);
1303
1304						$_iframe_overlay_container.css(
1305							{
1306
1307								maxWidth: iframe_overlay_width + 'px',
1308								maxHeight: iframe_overlay_height + 'px',
1309								width: Math.round(iframe_scale * iframe_overlay_width) + 'px',
1310								height: Math.round(iframe_scale * iframe_overlay_height) + 'px'
1311							});
1312					} else {
1313						$_iframe_overlay_container.css(
1314							{
1315								width: ($_window.width() - 120) + 'px',
1316								height: ($_window.height() - 120) + 'px'
1317							});
1318					}
1319				};
1320
1321				if (iframe_overlay_width && iframe_overlay_height) {
1322					$_iframe_overlay_container.attr('width', iframe_overlay_width);
1323					$_iframe_overlay_container.attr('height', iframe_overlay_height);
1324				}
1325
1326				$_iframe_overlay.append($_iframe_overlay_container);
1327				$_body.prepend($_iframe_overlay.append($_iframe_overlay_close));
1328				$_window.on('keydown', iframe_overlay_keydown);
1329				$_window.on('resize', iframe_overlay_resize);
1330				$_iframe_overlay_close.on('click', function () {
1331					$_window.off('keydown', iframe_overlay_keydown);
1332					$_window.off('resize', iframe_overlay_resize);
1333					$_iframe_overlay.remove();
1334				});
1335
1336				iframe_overlay_resize();
1337				e.preventDefault();
1338			});
1339		}
1340	});
1341
1342	// Handle modal overlays
1343	$('div.modal').each(function () {
1344		var $_modal = $(this),
1345			$_modal_header = $_modal.find('> div.modal-header'),
1346			$_modal_content = $_modal.find('> div.modal-content'),
1347			$_modal_overlay = $('<div id="modal-overlay"></div>'),
1348			$_modal_container = $('<div class="modal-container"></div>'),
1349			$_modal_dismiss = $('<i class="material-icons modal-dismiss">close</i>'),
1350			modal_data = $_modal.data('modal'),
1351			modal_data_show = $_modal.data('modal-show'),
1352			modal_data_dismissible = $_modal.data('modal-dismissible');
1353
1354		if ($_modal_header.length && $_modal_content.length && modal_data) {
1355			var modal_show = function (e) {
1356				$('#modal-overlay i.modal-dismiss').click();
1357				$_window.on('keydown', modal_dismiss_keydown);
1358				$_modal_container.append($_modal_header, $_modal_content);
1359				$_body.prepend($_modal_overlay.append($_modal_container));
1360				e && e.preventDefault();
1361			};
1362
1363			var modal_dismiss = function (e) {
1364				$_window.off('keydown', modal_dismiss_keydown);
1365				$_modal.append($_modal_header, $_modal_content);
1366				$_modal_overlay.remove();
1367				e && e.preventDefault();
1368			};
1369
1370			var modal_dismiss_keydown = function (e) {
1371				e.keyCode === 27 && modal_data_dismissible && modal_dismiss(e);
1372			};
1373
1374			if ($_modal.hasClass('modal-small')) $_modal_container.addClass('modal-container-small');
1375			else if ($_modal.hasClass('modal-large')) $_modal_container.addClass('modal-container-large');
1376			$('[data-modal-dismiss="' + modal_data + '"]').on('click', modal_dismiss);
1377			$('[data-modal-target="' + modal_data + '"]').on('click', modal_show);
1378			$_modal_dismiss.on('click', modal_dismiss);
1379			$_modal_header.append($_modal_dismiss);
1380
1381			if (modal_data_dismissible !== true) {
1382				$_modal_dismiss.hide();
1383			}
1384
1385			if (modal_data_show) {
1386				if ($.isNumeric(modal_data_show)) {
1387					setTimeout(function () {
1388						modal_show();
1389					}, modal_data_show * 1000);
1390				} else {
1391					modal_show();
1392				}
1393			}
1394		}
1395	});
1396
1397	// Handle internal links
1398	var $_location_target = null,
1399		location_hash = location.hash;
1400
1401	var location_scroll_position = function () {
1402		return Math.round($_location_target.offset().top - (header_static ? 0 : $_header.outerHeight()));
1403	};
1404
1405	if (location_hash && ($_location_target = $(location_hash)).length) {
1406		var location_scroll_load = function () {
1407			$_html_body.scrollTop(location_scroll_position());
1408		};
1409
1410		$_window.on('load', location_scroll_load);
1411		location_scroll_load();
1412	}
1413
1414	$_document.on('click', 'a[href*="#"]', function (e) {
1415		if (location_hash = this.hash) {
1416			var location_target_scroll_position = 0,
1417				location_target_split = this.href.split('#'),
1418				location_split = location.toString().split('#');
1419
1420			if (location_target_split[0] === '' || location_target_split[0] === location_split[0]) {
1421				if (($_location_target = $(location_hash)).length) {
1422					if (header_dynamic) $_header.addClass('headroom--disabled');
1423					$_html_body.animate({scrollTop: (location_target_scroll_position = location_scroll_position())}, Math.max(400, Math.round(Math.abs($_window.scrollTop() - location_target_scroll_position) / 5)), function () {
1424						if (header_dynamic) {
1425							setTimeout(function () {
1426								$_header.removeClass('headroom--disabled headroom--unpinned');
1427								$_header.addClass('headroom--pinned');
1428							}, 10);
1429						}
1430					});
1431
1432					if ($_header_nav.length) $_nav_overlay_close.click();
1433					history.pushState(null, null, location_hash);
1434					$_window.trigger('hashchange');
1435					e.preventDefault();
1436				}
1437			}
1438		}
1439	});
1440
1441	// Handle content preloading
1442	$_body.hasClass('preload') && $_window.on('load', function () {
1443		window.setTimeout(function () {
1444			$_body.addClass('preload-done').on('transitionend', function () {
1445				$_body.removeClass('preload preload-done');
1446			});
1447		}, 600);
1448	});
1449});
1450
1451/*
1452function getCookie(name) {
1453  const value = `; ${document.cookie}`;
1454  const parts = value.split(`; ${name}=`);
1455  if (parts.length === 2) return parts.pop().split(';').shift();
1456}
1457
1458function setCCmenu() {
1459var menuState = getCookie("ccMenuStatus");
1460	if (menuState != "shown") {
1461	    hideCCmenu();
1462	}
1463}
1464
1465document.addEventListener("DOMContentLoaded", function(event) {
1466    setCCmenu();
1467});
1468
1469function toggleCCmenu() {
1470	if ($('#cc_navbar').data("togglemenu") === false) {
1471        hideCCmenu();
1472	} else {
1473        showCCmenu();
1474	}
1475}
1476
1477function hideCCmenu() {
1478		$('.cc_menu_large_content').css('visibility','hidden');
1479		$('#cc_navbar').css('min-width','160px');
1480		$('#cc_navbar').css('width','160px');
1481		$('#cc_content').css('width','100%');
1482		$('#cc_toggleIcon').removeClass('fa-angle-double-left')
1483		$('#cc_toggleIcon').addClass('fa-angle-double-right')
1484		$('#cc_navbar').data('togglemenu', true);
1485		document.cookie = "ccMenuStatus=hidden";
1486}
1487
1488function showCCmenu() {
1489		$('.cc_menu_large_content').css('visibility','visible');
1490		$('#cc_navbar').css('width','25%');
1491		$('#cc_content').css('width','75%');
1492		$('#cc_toggleIcon').removeClass('fa-angle-double-right')
1493		$('#cc_toggleIcon').addClass('fa-angle-double-left')
1494		$('#cc_navbar').data('togglemenu', false);
1495		document.cookie = "ccMenuStatus=shown";
1496}*/
1497
1498function getParameters() {
1499	var parameterFragments = location.search.substr(1).split("&");
1500	var parameters = {}
1501	for (var i = 0; i < parameterFragments.length; i++) {
1502		var splittedParameter = parameterFragments[i].split("=");
1503		parameters[splittedParameter[0]] = decodeURIComponent(splittedParameter[1]);
1504	}
1505	return parameters;
1506}
1507
1508$_document.on('DOMContentLoaded', function () {
1509	var URIparameters = getParameters();
1510	if ('tab' in URIparameters) {
1511		var tabID = URIparameters.tab;
1512		var tab = document.getElementById(tabID);
1513		if (typeof (tab) != 'undefined' && tab != null) {
1514			tab.click();
1515		}
1516
1517
1518	}
1519});
1520
1521var acc = document.getElementsByClassName("accordion");
1522var i;
1523
1524for (i = 0; i < acc.length; i++) {
1525	acc[i].addEventListener("click", function () {
1526		/* Toggle between adding and removing the "active" class,
1527		to highlight the button that controls the panel */
1528		this.classList.toggle("active");
1529
1530		/* Toggle between hiding and showing the active panel */
1531		var panel = this.nextElementSibling;
1532		if (panel.style.display === "block") {
1533			panel.style.display = "none";
1534		} else {
1535			panel.style.display = "block";
1536		}
1537	});
1538}
1539var displayBusiness = function (business) {
1540	if (business) {
1541		$('.businessDisplay').show();
1542		$('.privateDisplay').hide();
1543	} else {
1544		$('.privateDisplay').show();
1545		$('.businessDisplay').hide();
1546	}
1547
1548	var netPriceConverter = function (element) {
1549		var oldPrice = $(element).attr('data-price');
1550		if (oldPrice == null) {
1551			oldPrice = $(element).text().replace(',', '.').replace(' €', '').replace('€', '');
1552			$(element).attr('data-price', oldPrice);
1553		}
1554
1555		if(oldPrice.match(/\(([^)]+)\)/) != null){
1556			var netto = oldPrice.match(/\(([^)]+)\)/)[1] / 1.19;
1557
1558			var formatter = new Intl.NumberFormat('de-DE', {
1559				style: 'currency',
1560				currency: 'EUR',
1561			});
1562			if (business) {
1563				$(element).attr('data-type', "netto");
1564				$(element).text(oldPrice.replace(oldPrice.match(/\(([^)]+)\)/)[1], formatter.format(netto)));
1565			}else{
1566				$(element).attr('data-type', "brutto");
1567				$(element).text(oldPrice.replace(oldPrice.match(/\(([^)]+)\)/)[1], formatter.format(oldPrice.match(/\(([^)]+)\)/)[1])));
1568			}
1569		}else{
1570			var netto = oldPrice / 1.19;
1571
1572			var formatter = new Intl.NumberFormat('de-DE', {
1573				style: 'currency',
1574				currency: 'EUR',
1575			});
1576			if (business) {
1577				$(element).attr('data-type', "netto");
1578				$(element).text(formatter.format(netto));
1579			}else{
1580				$(element).attr('data-type', "brutto");
1581				$(element).text(formatter.format(oldPrice))
1582			}
1583			if($(element).text() == "NaN"){
1584
1585			}
1586		}
1587		if($("#lifetime[name='lifetime']")){
1588			$("#lifetime[name='lifetime']").change();
1589		}
1590		if($(element).attr('data-add') != null){
1591
1592			$(element).append($(element).attr('data-add'));
1593		}
1594	}
1595
1596	$('.price span.value').each(function (val) {
1597		netPriceConverter($(this));
1598	});
1599
1600	$('.priceField').each(function (val) {
1601		netPriceConverter($(this));
1602	});
1603}
1604
1605var businessSwitch = function (doSwitch) {
1606	if (doSwitch == null) doSwitch = false;
1607
1608	var business = localStorage.getItem('business');
1609	if (business == null) business = false;
1610	else business = (business == "true") ? true : false;
1611
1612	if (doSwitch) {
1613		business = !business;
1614		localStorage.setItem('business', business);
1615	}
1616	displayBusiness(business);
1617}
1618businessSwitch(false);
1619
1620/*
1621$('#neuesticketeröffnen').on('DOMContentLoaded', function() {
1622	$('#neuesticketeröffnen').attr('id', $('#neuesticketeröffnen').attr('id').replace("neuesticketeröffnen", "neuesticketeroeffnen"));
1623});
1624$('#jährlicheabrechnung').ready(function() {
1625	$('#jährlicheabrechnung').attr('id', $('#jährlicheabrechnung').attr('id').replace("jährlicheabrechnung", "jaehrlicheabrechnung"));
1626});
1627$(document).ready(function() {
1628
1629
1630	$('li').click(function(){
1631		window.location.hash = "nav" + this.id;
1632	});
1633	if(window.location.hash) {
1634		var nav = window.location.hash.split("nav")[1];
1635		var navpos = 0;
1636		$('.tab-group li')[0].className = $('.tab-group li')[0].className.replace("active", "");
1637
1638		for (i = 0; i < $('.tab-group li').length; i++) {
1639			if(nav == $('.tab-group li')[i].id){
1640				navpos = i;
1641				$('.tab-group li')[i].className = $('.tab-group li')[i].className + " active";
1642			}
1643		}
1644		$('.tab-item')[0].className = $('.tab-item')[0].className.replace("active", "");
1645		$('.tab-item')[navpos].className = $('.tab-item')[navpos].className + " active";
1646	}
1647	console.log("It works");
1648});
1649*/
1650
1651
1652function checkHighlightDelayed() {
1653	return new Promise(resolve => {
1654		setTimeout(() => {
1655			$(".oscontainer .radio-style.active").parent().css('border-color','#ffcc33');
1656			$(".oscontainer .radio-style:not(.active)").parent().css('border-color','#e6e9ee');
1657		}, 100);
1658	});
1659}
1660
1661async function checkHighlight() {
1662	const result = await checkHighlightDelayed();
1663}
1664
1665checkHighlight();
1666
1667function initThemeOS() {
1668	let mode = localStorage.getItem('darkMode');
1669	const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)");
1670	if (prefersDarkScheme.matches) {
1671		if(mode == null) {
1672			mode = 'dark'
1673			localStorage.setItem('darkMode', mode);
1674			var darkModeStatus = localStorage.getItem('darkMode');
1675			setCookie('darkMode', darkModeStatus, 365);
1676			setCookie('enableDarkModeMessage', true, 7);
1677			location.reload();
1678		}
1679	}
1680
1681	try {
1682		let box = document.querySelector('.darkModeMessage.showMessage');
1683		let height = box.offsetHeight + 10;
1684		let header = document.querySelector('#header.darkModeMessageEnabled');
1685		header.style.paddingTop = height + "px";
1686		document.getElementById('content').style.paddingTop = height - 30 + "px";
1687
1688		var style = document.createElement('style');
1689		style.innerHTML = '#nav-overlay { padding-top: ' + height + 'px; }';
1690		document.getElementsByTagName('head')[0].appendChild(style);
1691	}
1692	catch (e) {}
1693
1694}
1695
1696initThemeOS();
1697
1698function setCookie(name,value,days) {
1699	var expires = "";
1700	if (days) {
1701		var date = new Date();
1702		date.setTime(date.getTime() + (days*24*60*60*1000));
1703		expires = "; expires=" + date.toUTCString();
1704	}
1705	document.cookie = name + "=" + (value || "")  + expires + "; path=/";
1706}
1707
1708
1709function toggleTheme() {
1710	var mode = localStorage.getItem('darkMode');
1711	if(mode == null) {
1712		mode = 'light';
1713	}
1714	if(mode == 'light') {
1715		mode = 'dark';
1716	}
1717	else {
1718		mode = 'light';
1719	}
1720	localStorage.setItem('darkMode', mode);
1721	var darkModeStatus = localStorage.getItem('darkMode');
1722	setCookie('darkMode', darkModeStatus, 365);
1723	location.reload();
1724}
1725
1726function darkModeMessageAction(state) {
1727	if(state === 'light') {
1728		toggleTheme();
1729	}
1730	setCookie('enableDarkModeMessage', false, 1);
1731	location.reload();
1732}

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.