PageSourceSearch

https://www.bhs-world.com/typo3temp/assets/compressed/merged-23291…468a4568957aaf71a7874eb0.js.gzip?1789547852

js bhs-world.com collected 2026-10-02 05:44:59 UTC 85,335 bytes, 2,200 lines download raw bytes

1
2/** @type {Record<string, string>} */
3const initialValues = window.c3accessibility.getSettings();
4
5if (!localStorage.getItem('c3accessibility.initialized')) {
6    if (window.matchMedia('(prefers-contrast: more)').matches) {
7        initialValues.colorFilter = 'high-contrast';
8    }
9    if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
10        initialValues.reduceMotion = 'true';
11    }
12    window.c3accessibility.commitSettings(initialValues);
13    localStorage.setItem('c3accessibility.initialized', 'true');
14}
15
16{
17    const currentUrl = new URL(location);
18    const newUrl = new URL(currentUrl);
19    const searchParamRegex = /c3accessibility\[(?<settingsKey>.+)]/;
20    let settingsKeyFound = false;
21    for (const [key, value] of currentUrl.searchParams) {
22        if (!key.startsWith('c3accessibility')) {
23            continue;
24        }
25
26        const settingsKey = key.match(searchParamRegex).groups.settingsKey;
27        if (!settingsKey) {
28            continue;
29        }
30
31        settingsKeyFound = true;
32        initialValues[settingsKey] = value;
33        newUrl.searchParams.delete(key);
34    }
35
36    if (settingsKeyFound) {
37        window.c3accessibility.commitSettings(initialValues);
38        history.replaceState('', '', newUrl);
39    }
40}
41
42customElements.define('c3accessibility-root', class extends HTMLElement {
43    constructor() {
44        super();
45        this.attachShadow({mode: 'open'});
46
47        for (const style of c3accessibility.assets.styles) {
48            const styleElement = document.createElement('link');
49            styleElement.href = style;
50            styleElement.rel = 'stylesheet';
51            this.shadowRoot.append(styleElement);
52        }
53
54        this.shadowRoot.append(document.querySelector('#c3accessibility-template').content.cloneNode(true));
55
56        this.buttons = {
57            /** @type {HTMLButtonElement} */
58            save: this.shadowRoot.querySelector('.c3accessibility-button[data-action="save"]'),
59            /** @type {HTMLButtonElement} */
60            cancel: this.shadowRoot.querySelector('.c3accessibility-button[data-action="cancel"]'),
61        };
62
63        this.elements = {
64            /** @type {HTMLDialogElement} */
65            dialog: this.shadowRoot.querySelector('#c3accessibility-dialog'),
66            /** @type {HTMLButtonElement} */
67            flag: this.shadowRoot.querySelector('#c3accessibility-flag'),
68            /** @type {HTMLFormElement} */
69            form: this.shadowRoot.querySelector('#c3accessibility-settings-form'),
70        };
71
72        const availableOptions = new Set(this.getAttribute('options').split(','));
73
74        this.elements.flag.addEventListener('click', () => {
75            viewTransition(() => {
76                this.elements.dialog.showModal();
77            });
78        });
79
80        this.elements.form.addEventListener('submit', e => {
81            e.preventDefault();
82            const data = new FormData(this.elements.form);
83            const storedData = {};
84            for (const [key, value] of data) {
85                if (!availableOptions.has(key)) {
86                    continue;
87                }
88                storedData[key] = value;
89            }
90
91            viewTransition(() => {
92                window.c3accessibility.commitSettings(storedData);
93                this.elements.dialog.close();
94                window.dispatchEvent(new CustomEvent('c3accessibility:update', {
95                    detail: {
96                        data: storedData
97                    }
98                }));
99            });
100        });
101
102        this.buttons.cancel.addEventListener('click', () => {
103            viewTransition(() => {
104                this.elements.dialog.close();
105            });
106            this.initDialogForm();
107        });
108    }
109
110    connectedCallback() {
111        this.initDialogForm();
112    }
113
114    initDialogForm() {
115        /** @type {Record<string, 'radio' | 'select' | 'checkbox'>} */
116        const fields = {
117            fontSize: 'radio',
118            lineHeight: 'radio',
119            fontFamily: 'select',
120          graphics: 'select',
121            colorFilter: 'select',
122            reduceMotion: 'checkbox'
123        };
124
125        for (const [key, value] of Object.entries(window.c3accessibility.getSettings())) {
126            const type = fields[key];
127
128            switch (type) {
129                case 'radio': {
130                    /** @type {HTMLInputElement} */
131                    const element = this.elements.form.querySelector(`[name="${key}"][value="${value}"]`);
132                    if (element) {
133                        element.checked = true;
134                    }
135                    break;
136                }
137                case 'select': {
138                    /** @type {HTMLSelectElement} */
139                    const element = this.elements.form.querySelector(`[name="${key}"]`);
140                    if (element) {
141                        element.value = value;
142                    }
143                    break;
144                }
145                case 'checkbox': {
146                    /** @type {HTMLInputElement} */
147                    const element = this.elements.form.querySelector(`[name="${key}"]`);
148                    if (element) {
149                        element.checked = value === 'true';
150                    }
151                    break;
152                }
153            }
154        }
155    }
156});
157
158customElements.define('c3accessibility-icon', class extends HTMLElement {
159    constructor() {
160        super();
161        this.icon = this.getAttribute('icon');
162        this.src = window.c3accessibility.assets.icons[this.icon];
163        this.content = fetch(this.src)
164            .then(res => {
165                if (!res.ok || res.status >= 400) {
166                    return Promise.resolve(null);
167                }
168                return res.text();
169            })
170            .catch(() => null);
171        this.setAttribute('aria-hidden', 'true');
172    }
173
174    connectedCallback() {
175        this.content.then(res => {
176            this.innerHTML = res;
177        });
178    }
179});
180
181window.addEventListener('load', function(){
182    if ( document.documentElement.dataset.c3accessibilityReduceMotion === "true" ){
183        document.querySelectorAll("video").forEach(vid => {
184            vid.pause();
185            vid.currentTime = 0;
186            vid.removeAttribute('autoplay');
187        });
188    }
189})
190
191/**
192 * polyfill function for view transitions. Does not show transition, if the browser does not support it
193 * @param {() => void} callback
194 */
195function viewTransition(callback) {
196    if (!document.startViewTransition) {
197        callback();
198        return {
199            finished: Promise.resolve()
200        };
201    }
202
203    return document.startViewTransition(() => {
204        callback();
205    });
206}
207window.dataLayer = window.dataLayer || [];
208
209function checkNav() {
210
211    if ($(document).scrollTop() > 50) {
212        $('body').addClass('fixedNav');
213        $('.page-header').addClass('page-header--scrolled');
214    } else {
215        $('body').removeClass('fixedNav');
216        $('.page-header').removeClass('page-header--scrolled');
217    }
218
219}
220
221function removeDuplicateOptions(s, comparitor) {
222    if (!s) {
223        return;
224    }
225    if (s.tagName.toUpperCase() !== 'SELECT') {
226        return false;
227    }
228    var c, i, o = s.options, sorter = {};
229    if (!comparitor || typeof comparitor !== 'function') {
230        comparitor = function (o) {
231            return o.value;
232        };
233    }
234    for (i = 0; i < o.length; i++) {
235        c = comparitor(o[i]);
236        if (sorter[c]) {
237            s.removeChild(o[i]);
238            i--;
239        } else {
240            sorter[c] = true;
241        }
242    }
243    return true;
244}
245
246function filterJoblist() {
247
248    var jobValue = document.getElementById('job').options[document.getElementById('job').selectedIndex].value;
249    var filialeValue = document.getElementById('filiale').options[document.getElementById('filiale').selectedIndex].value;
250
251    let data = document.querySelectorAll('.panel-body .button p a');
252
253    if (jobValue != '' && filialeValue === '') {
254        for (var i = 0; i < data.length; i++) {
255            if (jobValue != data[i].dataset.stelle) {
256                document.querySelectorAll('.panel-group .panel')[i].style.display = 'none';
257            } else {
258                document.querySelectorAll('.panel-group .panel')[i].style.display = 'block';
259            }
260        }
261    } else if (filialeValue != '' && jobValue === '') {
262        for (var t = 0; t < data.length; t++) {
263            if (filialeValue != data[t].dataset.filiale) {
264                document.querySelectorAll('.panel-group .panel')[t].style.display = 'none';
265            } else {
266                document.querySelectorAll('.panel-group .panel')[t].style.display = 'block';
267            }
268        }
269    } else if (filialeValue != '' && jobValue != '') {
270        for (var i = 0; i < data.length; i++) {
271            if (jobValue != data[i].dataset.stelle) {
272                document.querySelectorAll('.panel-group .panel')[i].style.display = 'none';
273            } else {
274                for (var t = 0; t < data.length; t++) {
275                    if (filialeValue != data[t].dataset.filiale) {
276                        document.querySelectorAll('.panel-group .panel')[t].style.display = 'none';
277                    } else {
278                        document.querySelectorAll('.panel-group .panel')[t].style.display = 'block';
279                    }
280                }
281            }
282        }
283    } else {
284        for (var t = 0; t < document.querySelectorAll(".panel-group .panel").length; t++) {
285            document.querySelectorAll('.panel-group .panel')[t].style.display = 'block';
286        }
287    }
288
289}
290
291function initMultiStepSlideBox() {
292    for (const container of document.querySelectorAll('.multistep')) {
293        /** @type {HTMLButtonElement} */
294        const openButton = container.querySelector('.multistep-button--open');
295        /** @type {HTMLButtonElement} */
296        const closeButton = container.querySelector('.multistep-button--close');
297
298        openButton.addEventListener('click', () => {
299            let currentActive = container.querySelector('.multistep-screen.active');
300            currentActive.nextElementSibling.classList.add('active');
301            if (currentActive.nextElementSibling.classList.contains('last')) {
302                container.classList.add('last-screen');
303            }
304            container.classList.add('mid-screen');
305            currentActive.classList.remove('active');
306            currentActive.classList.add('closed');
307        });
308
309        closeButton.addEventListener('click', () => {
310            let currentActive = container.querySelector('.multistep-screen.active');
311            currentActive.previousElementSibling.classList.add('active');
312            currentActive.previousElementSibling.classList.remove('closed');
313            if (currentActive.previousElementSibling.classList.contains('first')) {
314                container.classList.remove('mid-screen');
315            }
316            container.classList.remove('last-screen');
317            currentActive.classList.remove('active');
318        });
319    }
320}
321
322$(function () {
323    var userAgent = window.navigator.userAgent;
324
325    if (navigator.userAgent.match(/safari/i) && navigator.vendor.match(/apple/i) && navigator.maxTouchPoints) {
326        $('body').addClass('mobile-safari');
327    }
328
329    $(window).scroll(checkNav);
330    initMultiStepSlideBox();
331    checkNav();
332    initPopups();
333    powermailSubmit();
334    registrationForm();
335
336    if ($('.accordion-outer-wrap').length) {
337        $('.accordion-outer-wrap').each(function () {
338            $(this).accordion({
339                active: false,
340                collapsible: true,
341                heightStyle: 'content',
342                animate: document.documentElement.dataset.c3accessibilityReduceMotion === 'true' ? 0 : {},
343                activate: function (event, ui) {
344                    /*    if(!$.isEmptyObject(ui.newHeader.offset())) {
345                            $('html:not(:animated), body:not(:animated)').animate({ scrollTop: ui.newHeader.offset().top }, 'slow');
346                        }*/
347
348                    if (ui.newHeader[0]) {
349                        window.dataLayer.push({
350                            'event': 'accordion',
351                            'accordion.action': 'open',
352                            'accordion.title': ui.newHeader[0].innerText,
353                        });
354                    }
355
356                    if (ui.oldHeader[0]) {
357                        window.dataLayer.push({
358                            'event': 'accordion',
359                            'accordion.action': 'close',
360                            'accordion.title': ui.oldHeader[0].innerText,
361                        });
362                    }
363                },
364            });
365        });
366    }
367
368    // function for pdf/video element
369    $('.trigger-viewer').click(function () {
370        $(this).parent().toggleClass('open');
371        $(this).next().stop().slideToggle();
372    });
373
374    $('.ce-bodytext a[href*="#"]').click(function (e) {
375        const [path, hash] = $(this).attr('href').split('#');
376        if (path === location.pathname) {
377            const targetEl = $(`#${hash}`);
378            if (targetEl.length) {
379                e.preventDefault();
380
381                if (targetEl.hasClass('nav-item')) {
382                    targetEl.trigger('click');
383                }
384
385                targetEl[0].scrollIntoView({
386                    behavior: 'smooth',
387                });
388
389                const faq = targetEl.find('.tx-c3faq');
390                if (faq.length) {
391                    faq.find('.faq-item:first-child .faq-item-question').trigger('click');
392                }
393            }
394        }
395    });
396
397    /**
398     * die mobile dropdown löst die klicks der a-tags (desktop) aus
399     */
400    $('.innerTabNav--mobile select').on('change', function () {
401        let tabId = $(this).find('option:selected').attr('data-tab');
402        $(this).parents('.nav-tabs').find('a#nav-c' + tabId + '-tab').trigger('click');
403    });
404
405    $('.content-slider-static-image--slider:not(.content-slider-static-image--special)').each(function () {
406        if ($(this).find('.swiper-slide').length > 1) {
407            let swiperId = $(this).data('swiperid'),
408                outerSwiperWrap = $(this).parents('.content-slider-static-image');
409
410            let confObject = {
411                slidesPerView: (($(this).data('slidesperview') != undefined) ? $(this).data('slidesperview') : 1),
412                spaceBetween: 10,
413                grabCursor: true,
414                effect: 'fade',
415                speed: 500,
416                autoplay: {
417                    delay: 3000,
418                },
419                breakpoints: {},
420            };
421
422            if (outerSwiperWrap.find('.swiper-pagination').length) {
423                confObject.pagination = {
424                    el: outerSwiperWrap.find('.swiper-pagination')[0],
425                    clickable: true,
426                };
427            }
428
429            if (outerSwiperWrap.find('.swiper-button-next').length && outerSwiperWrap.find('.swiper-button-prev').length) {
430                confObject.navigation = {
431                    nextEl: outerSwiperWrap.find('.swiper-button-next')[0],
432                    prevEl: outerSwiperWrap.find('.swiper-button-prev')[0],
433                };
434            }
435
436            let temp = new Swiper($(this), confObject);
437            swiperContainer.push(temp);
438        }
439    });
440
441    // menu height
442    $('.level_2 > .menu-item, .level_3 > .menu-item').hover(function (e) {
443        if ($(this).parents('.level_2').height() < $(this).children('.menu').height()) {
444            $(this).parents('.level_2').height($(this).children('.menu').height());
445        }
446    }, function (e) {
447        $(this).parent().removeAttr('style');
448    });
449
450    // video handling
451    if ($('.video-embed-item').length) {
452        $('.video-embed-item').removeAttr('controls');
453        $('.video-embed-item').each(function () {
454            //$(this).get(0).currentTime = 1;
455        });
456        $('.video-embed-item').parent().click(function () {
457            if ($(this).children('.video-embed-item').get(0).paused) {
458                //$(this).children('.video-embed-item').get(0).currentTime = 0;
459                $(this).children('.video-embed-item').get(0).play();
460                $(this).children('.playButton').fadeOut();
461                $('.video-embed-item').attr('controls', 'controls');
462                //return false;
463            } else {
464                //$('.video-embed-item').removeAttr("controls");
465                //$(this).children('.video-embed-item').get(0).pause();
466                //$(this).children('.playButton').fadeIn();
467                //return false;
468            }
469        });
470    }
471
472    $('.externalVideoPreview button').click(function () {
473        $(this).parents('.video-embed').append('<iframe ' +
474            'width="' + $(this).siblings('img').width() + '" ' +
475            'height="' + $(this).siblings('img').height() + '" ' +
476            'src="//www.youtube-nocookie.com/embed/' + $(this)
477                .siblings('img')
478                .data('videosrc') + '?autoplay=1&rel=0" ' +
479            'frameborder="0" allowFullScreen allow="autoplay; encrypted-media"></iframe>');
480        $(this).parents('.externalVideoPreview').hide();
481    });
482
483    swiperContainer[0] && swiperContainer[0].on('slideChange', function () {
484        this.$el.find('.swiper-slide-prev')
485            .find('.close')
486            .trigger('click');
487    });
488
489    /* special header banner handling*/
490    $('svg [id*="marker_"]').click(function (e) {
491        // stop AutoSlide
492        swiperContainer[0].autoplay.stop();
493
494        // reset displaying
495        $('.overlayWrap .overlayItem').hide();
496        $('.overlayWrap .overlayItem .overlayContent').css('opacity', 0);
497        $('.overlayWrap .overlayItem .line').removeAttr('style');
498        $('[id*=\'highlightarea\']').css('opacity', 0);
499        $('[id*=\'highlightarea\']').css('display', 'none');
500        $('[id*=\'OuterRing\']').removeAttr('style');
501        $('[id*=\'InnerRing\']').removeAttr('style');
502        $('[id*=\'Plus_1\']').removeAttr('style');
503
504
505        // show highlight area and content
506        $(this).siblings('[id*=\'highlightarea\']').css('display', 'block');
507        $(this).siblings('[id*=\'highlightarea\']').css('opacity', 0.4);
508        let $targetOvlerlayItem = $('.overlayWrap .overlayItem.' + $(this).attr('id'));
509
510
511        // invert for active state
512        $(this).siblings('[id*=\'OuterRing\']').css('stroke', '#005094');
513        $(this).siblings('[id*=\'OuterRing\']').css('fill', '#FFFFFF');
514        $(this).siblings('[id*=\'OuterRing\']').css('animation', 'step-end');
515        $(this).siblings('[id*=\'OuterRing\']').css('animation-play-state', 'paused');
516        $(this).siblings('[id*=\'InnerRing\']').css('fill', '#005094');
517        $(this).siblings('[id*=\'InnerRing\']').css('animation', 'step-end');
518        $(this).siblings('[id*=\'InnerRing\']').css('animation-play-state', 'paused');
519        $(this).siblings('[id*=\'Plus_1\']').css('stroke', '#FFFFFF');
520
521
522        $targetOvlerlayItem.css('display', 'block');
523
524        let BaseWidth = 1434;
525        let BaseHeight = 1030;
526
527        // get targetPosition and scale accordingly
528        let LeftPercentage = 66;
529        let TargetLeftPercentage = 0;
530        if ($(this).siblings('[id*=\'textposition\']').length) {
531            //let BaseWidth = $(".highlightContainer svg image").attr("width");
532            TargetLeftPercentage = ($(this).siblings('[id*=\'textposition\']').attr('x') / BaseWidth) * 100;
533            if (TargetLeftPercentage < 66) LeftPercentage = TargetLeftPercentage;
534        }
535        $targetOvlerlayItem.css('left', LeftPercentage + '%');
536
537        let topPercentage = 75;
538        if ($(this).siblings('[id*=\'textposition\']').length) {
539            //let BaseHeight = $(".highlightContainer svg image").attr("height");
540            topPercentage = ($(this).siblings('[id*=\'textposition\']').attr('y') / BaseHeight) * 100;
541            if (topPercentage > 100 - ($targetOvlerlayItem.outerHeight() / $('.highlightContainer svg')
542                .outerHeight()) * 100)
543                topPercentage = 95 - ($targetOvlerlayItem.outerHeight() / $('.highlightContainer svg')
544                    .outerHeight()) * 100;
545        }
546        $targetOvlerlayItem.css('top', topPercentage + '%');
547        $targetOvlerlayItem.find('.overlayContent').css('opacity', 1);
548
549        // draw line
550        // calculate left offset
551        // get current scaling
552        let currentScale = $('.highlightContainer svg').width() / BaseWidth;
553        let leftOffset = ($(this).siblings('[id*=\'OuterRing\']').attr('cx') - $(this)
554            .siblings('[id*=\'textposition\']')
555            .attr('x')) * currentScale;
556        if (TargetLeftPercentage > 66) {
557            leftOffset += $('.highlightContainer svg').width() * ((TargetLeftPercentage - LeftPercentage) / 100);
558        }
559        let rawTopOffset = $(this).siblings('[id*=\'OuterRing\']').attr('cy') - $(this)
560            .siblings('[id*=\'textposition\']')
561            .attr('y') - $(this).siblings('[id*=\'OuterRing\']').attr('r');
562        $targetOvlerlayItem.find('.line').css('left', (leftOffset) - 1);
563        let topOffset = (rawTopOffset * currentScale) - $targetOvlerlayItem.outerHeight();
564        $targetOvlerlayItem.find('.line').css('bottom', (topOffset - 5) * -1);
565        $targetOvlerlayItem.find('.line').css('height', (topOffset - 5));
566
567
568        if (window.innerWidth < 768) {
569            let line = $targetOvlerlayItem.find('.line');
570            let tOffset = $('.highlightContainer svg').height() - ($(this)
571                .siblings('[id*=\'OuterRing\']')
572                .attr('cy') * currentScale) - ($(this).attr('r') / 2);
573            let lOffset = $(this).siblings('[id*="OuterRing"]').attr('cx');
574
575            lOffset = lOffset * currentScale;
576            line.css({
577                left: lOffset - 1,
578                top: -tOffset,
579                height: tOffset,
580            });
581            $targetOvlerlayItem.css('margin-bottom', -$targetOvlerlayItem.height());
582
583            $(this).parents('.swiper-slide')
584                .removeClass('info-closed')
585                .css('padding-bottom', $targetOvlerlayItem.height());
586            $(this).parents('.swiper-container')[0].swiper.update();
587        }
588    });
589
590    $('.overlayItem .close').click(function (e) {
591        $(this).parents('.overlayItem').hide();
592        // reset Displaying
593        $('.overlayWrap .overlayItem').hide();
594        $('.overlayWrap .overlayItem .overlayContent').css('opacity', 0);
595        $('.overlayWrap .overlayItem .line').removeAttr('style');
596        $('[id*=\'highlightarea\']').css('opacity', 0);
597        $('[id*=\'highlightarea\']').css('display', 'none');
598        $('[id*=\'OuterRing\']').removeAttr('style');
599        $('[id*=\'InnerRing\']').removeAttr('style');
600        $('[id*=\'Plus_1\']').removeAttr('style');
601        $(this).parents('.swiper-slide').addClass('info-closed');
602        swiperContainer[0].autoplay.start();
603        swiperContainer[0].update();
604    });
605
606
607    // handle news
608    loadMoreNews();
609    // news ajax data
610    $('.categoryFilter:not(.categoryFilter--mobile) .categoryItem a').click(function (e) {
611        e.preventDefault();
612        let clickObject = $(this);
613        clickObject.parents('.categoryFilter').find('.active').removeClass('active');
614        // let ObjectIdentifier = clickObject.parents(".categoryHeader").next().attr("id");
615        let ObjectIdentifier = clickObject.closest('.container').next().find('.news-list-view').attr('id');
616        $.ajax({
617            url: clickObject.attr('href'),
618        }).done(function (data) {
619            clickObject.parent().addClass('active');
620            clickObject.closest('.container')
621                .next()
622                .find('.news-list-view')
623                .find('.news-list-item, .page-navigation, .news-clear, .showMoreLink')
624                .remove();
625            $('#' + ObjectIdentifier + ' .row').append($(data).find('#' + ObjectIdentifier + ' .news-list-item'));
626            $('#' + ObjectIdentifier + ' .row').append($(data).find('#' + ObjectIdentifier + ' .page-navigation'));
627            $('#' + ObjectIdentifier + ' .row').append($(data).find('#' + ObjectIdentifier + ' .showMoreLink'));
628            loadMoreNews();
629        });
630        return false;
631    });
632    $('.categoryFilter--mobile select').change(function (e) {
633        e.preventDefault();
634        let clickObject = $(this);
635        // clickObject.parents(".categoryFilter").find(".active").removeClass("active");
636        // let ObjectIdentifier = clickObject.parents(".categoryHeader").next().attr("id");
637        let ObjectIdentifier = clickObject.closest('.container').next().find('.news-list-view').attr('id');
638        $.ajax({
639            url: clickObject.val(),
640        }).done(function (data) {
641            clickObject.parent().addClass('active');
642            clickObject.closest('.container')
643                .next()
644                .find('.news-list-view')
645                .find('.news-list-item, .page-navigation, .news-clear, .showMoreLink')
646                .remove();
647            $('#' + ObjectIdentifier + ' .row').append($(data).find('#' + ObjectIdentifier + ' .news-list-item'));
648            $('#' + ObjectIdentifier + ' .row').append($(data).find('#' + ObjectIdentifier + ' .page-navigation'));
649            $('#' + ObjectIdentifier + ' .row').append($(data).find('#' + ObjectIdentifier + ' .showMoreLink'));
650            loadMoreNews();
651        });
652        return false;
653    });
654
655    //Breadcrump und Site-Title bei Job-Detailseite anpassen
656
657    if ($('.show').length) {
658        $(document).prop('title', $('.showJobDetail h1')[0].innerText);
659
660        $('.breadcrumpName:last').text($('.showJobDetail h1')[0].innerText);
661    }
662
663    // Einblenden des Powermail-Formulares
664    $('#bewerbenButton').click(function () {
665        document.getElementsByClassName('gridPowermail')[0].style.display = 'flex';
666
667        let scrollTop = document.getElementsByClassName('gridPowermail')[0].offsetTop - 100;
668        window.scrollTo(0, scrollTop);
669
670    });
671
672    // Job-Details: Datenübertragung in Powermail-Formular
673
674    if ($('.show').length) {
675        let jobname = $('.showJobDetail h1')[0].innerText;
676        let worktime = $('.worktime')[0].innerText;
677        let place = $('.workplace')[0].innerText;
678
679        $('#powermail_field_stelle').val(jobname);
680        $('#powermail_field_arbeitszeit').val(worktime);
681        $('#powermail_field_ort').val(place);
682
683    }
684
685    //job Filter c3 recruiting
686
687    if ($('.list').length) {
688
689        let data = document.querySelectorAll('.list-item');
690
691        for (var i = 0; i < data.length; i++) {
692            var titleOptions = document.createElement('option');
693            titleOptions.value = data[i].dataset.jobplace;
694            titleOptions.innerHTML = data[i].dataset.jobplace;
695            if (titleOptions.value) {
696                document.getElementsByClassName('jobplace')[0]?.appendChild(titleOptions);
697            }
698        }
699
700        for (var i = 0; i < data.length; i++) {
701            var titleOptions = document.createElement('option');
702            titleOptions.value = data[i].dataset.jobworktime;
703            titleOptions.innerHTML = data[i].dataset.jobworktime;
704            if (titleOptions.value) {
705                document.getElementsByClassName('jobworktime')[0]?.appendChild(titleOptions);
706            }
707        }
708
709        for (var i = 0; i < data.length; i++) {
710            var titleOptions = document.createElement('option');
711            titleOptions.value = data[i].dataset.jobtype;
712            titleOptions.innerHTML = data[i].dataset.jobtype;
713            if (titleOptions.value) {
714                document.getElementsByClassName('jobtype')[0]?.appendChild(titleOptions);
715            }
716        }
717
718        for (var i = 0; i < data.length; i++) {
719            var titleOptions = document.createElement('option');
720            titleOptions.value = data[i].dataset.joblevel;
721            titleOptions.innerHTML = data[i].dataset.joblevel;
722            if (titleOptions.value) {
723                document.getElementsByClassName('joblevel')[0]?.appendChild(titleOptions);
724            }
725        }
726
727        for (var i = 0; i < data.length; i++) {
728            var titleOptions = document.createElement('option');
729            titleOptions.value = data[i].dataset.jobsublevel;
730            titleOptions.innerHTML = data[i].dataset.jobsublevel;
731            if (titleOptions.value) {
732                document.getElementsByClassName('jobSubLevel')[0]?.appendChild(titleOptions);
733            }
734        }
735
736
737        for (let i = 0; i < data.length; i++) {
738            const areas = data[i].dataset.businessareas ?? '';
739            const areaArray = areas.split(';');
740
741            for (const area of areaArray) {
742                const titleOptions = document.createElement('option');
743                titleOptions.value = area;
744                titleOptions.innerHTML = area;
745                if (titleOptions.value) {
746                    document.getElementsByClassName('jobbusinessareas')[0]?.appendChild(titleOptions);
747                }
748            }
749        }
750
751        for (let i = 0; i < data.length; i++) {
752            const limits = data[i].dataset.jobtimelimit ?? '';
753            const limitArray = limits.split(';');
754
755            for (const limit of limitArray) {
756                const titleOptions = document.createElement('option');
757                titleOptions.value = limit;
758                titleOptions.innerHTML = limit;
759                if (titleOptions.value) {
760                    document.getElementsByClassName('jobtimelimit')[0]?.appendChild(titleOptions);
761                }
762            }
763        }
764
765        const inputs = [
766            'jobplace',
767            'jobworktime',
768            'jobtype',
769            'joblevel',
770            'jobSubLevel',
771            'jobbusinessareas',
772            'jobtimelimit',
773        ];
774
775        for (const input of inputs) {
776            removeDuplicateOptions(document.getElementsByClassName(input)?.[0]);
777        }
778
779        document.querySelector('.resetFilters')?.addEventListener('click', () => {
780            for (const input of inputs) {
781                const select = document.getElementsByClassName(input)?.[0];
782                if (select) {
783                    select.value = '';
784                    select.dispatchEvent(new CustomEvent('change'));
785                }
786            }
787        });
788
789    }
790
791    $('.jobFilters select').change(function () {
792        if ($('.list').length) {
793
794            let data = document.querySelectorAll('.list-item');
795
796            const selectJobPlace = document.getElementsByClassName('jobplace')[0];
797            const selectJobWorkTime = document.getElementsByClassName('jobworktime')[0];
798            const selectJobType = document.getElementsByClassName('jobtype')[0];
799            const selectJobLevel = document.getElementsByClassName('joblevel')[0];
800            const selectJobSubLevel = document.getElementsByClassName('jobSubLevel')?.[0];
801            const selectJobTimeLimit = document.getElementsByClassName('jobtimelimit')?.[0];
802            const selectBusinessArea = document.getElementsByClassName('jobbusinessareas')[0];
803
804            // if (selectJobLevel.options[selectJobLevel.selectedIndex].value) {
805            //     selectJobSubLevel.style.display = "inline-block";
806            // } else {
807            if (selectJobSubLevel) {
808                selectJobSubLevel.style.display = 'none';
809            }
810            // }
811
812            for (const element of data) {
813                element.style.display = 'flex';
814            }
815
816            if (selectJobPlace && selectJobPlace.options[selectJobPlace.selectedIndex].value) {
817                for (const element of data) {
818                    if (element.dataset.joblevel === 'Ausbildung') {
819                        console.log(element.dataset.jobplace);
820                    }
821                    if (element.dataset.jobplace && selectJobPlace.options[selectJobPlace.selectedIndex].value !== element.dataset.jobplace) {
822                        element.style.display = 'none';
823                    }
824                }
825            }
826
827            if (selectBusinessArea && selectBusinessArea.options[selectBusinessArea.selectedIndex].value) {
828                for (const element of data) {
829                    if (element.dataset.businessareas && !element.dataset.businessareas.includes(selectBusinessArea.options[selectBusinessArea.selectedIndex].value)) {
830                        element.style.display = 'none';
831                    }
832                }
833            }
834
835            if (selectJobTimeLimit && selectJobTimeLimit.options[selectJobTimeLimit.selectedIndex].value) {
836                for (const element of data) {
837                    if (element.dataset.jobtimelimit && !element.dataset.jobtimelimit.includes(selectJobTimeLimit.options[selectJobTimeLimit.selectedIndex].value)) {
838                        element.style.display = 'none';
839                    }
840                }
841            }
842
843            if (selectJobWorkTime.options[selectJobWorkTime.selectedIndex].value) {
844                for (const element of data) {
845                    if (element.dataset.joblevel === 'Ausbildung') {
846                        console.log(element.dataset.jobworktime);
847                    }
848                    if (selectJobWorkTime.options[selectJobWorkTime.selectedIndex].value !== element.dataset.jobworktime) {
849                        element.style.display = 'none';
850                    }
851                }
852            }
853
854            if (selectJobType.options[selectJobType.selectedIndex].value) {
855                for (const element of data) {
856                    if (element.dataset.joblevel === 'Ausbildung') {
857                        console.log(element.dataset.jobtype);
858                    }
859                    if (selectJobType.options[selectJobType.selectedIndex].value !== element.dataset.jobtype) {
860                        element.style.display = 'none';
861                    }
862                }
863            }
864
865            if (selectJobLevel && selectJobLevel.options[selectJobLevel.selectedIndex].value) {
866                for (const element of data) {
867                    if (element.dataset.joblevel === 'Ausbildung') {
868                        console.log(element.dataset.joblevel);
869                    }
870                    if (selectJobLevel.options[selectJobLevel.selectedIndex].value !== element.dataset.joblevel) {
871                        element.style.display = 'none';
872                    }
873                }
874            }
875
876            // if (selectJobSubLevel.style.display === "inline-block") {
877            //     if (selectJobLevel.options[selectJobLevel.selectedIndex].value === "Professional") {
878            //         if (selectJobSubLevel.options[selectJobSubLevel.selectedIndex].value) {
879            //             for (var i = 0; i < data.length; i++) {
880            //                 if (selectJobSubLevel.options[selectJobSubLevel.selectedIndex].value != data[i].dataset.jobsublevel) {
881            //                     data[i].style.display = "none";
882            //                 }
883            //             }
884            //         }
885            //     }
886            // }
887
888        }
889    });
890
891    // job Filter
892    if ($('.news-layout-7, .news-layout-3').length) {
893        let jobArray = [];
894        $('.news-layout-7 .news-list-item, .news-layout-3 .news-list-item').each(function () {
895            if (undefined == jobArray.find(key => key.placeID === $(this).data('jobplace')))
896                jobArray.push({
897                    'placeID': $(this).data('jobplace'),
898                    'placeVal': $(this).find('.jobInfo .workplace').text(),
899                });
900
901            if (!$('select.joblevel option[value=\'' + $(this).data('joblevel') + '\']').length) {
902                $('select.joblevel')
903                    .append('<option value=\'' + $(this).data('joblevel') + '\'>' + $(this)
904                        .data('joblevel') + '</option>');
905            }
906            if (!$('select.jobSubLevel  option[value=\'' + $(this).data('jobsublevel') + '\']').length) {
907                $('select.jobSubLevel')
908                    .append('<option data-category=\'' + $(this).data('joblevel') + '\' value=\'' + $(this)
909                        .data('jobsublevel') + '\'>' + $(this).data('jobsublevel') + '</option>');
910            }
911        });
912        let reference_array = ['Weiherhammer'];
913        jobArray.sort(function (a, b) {
914            if (-1 !== reference_array.indexOf(a.placeID) && -1 !== reference_array.indexOf(b.placeID)) {
915                return reference_array.indexOf(a.placeID) - reference_array.indexOf(b.placeID);
916            } else if (-1 !== reference_array.indexOf(a.placeID)) {
917                return -1;
918            } else if (-1 !== reference_array.indexOf(b.placeID)) {
919                return 1;
920            } else {
921                return 0;
922            }
923        });
924        $.each(jobArray, function (key, item) {
925            if (!$('select.jobplace option[value=\'' + item.placeID + '\']').length) {
926                $('select.jobplace').append('<option value=\'' + item.placeID + '\'>' + item.placeVal + '</option>');
927            }
928        });
929
930        $('.jobFilters select').change(function () {
931            let url = new URLSearchParams(window.location.search);
932            let filterSet = 0;
933            let jobCondition = '.news-list-item';
934            if ($('.jobFilters select.joblevel').val()
935                && $('select.jobSubLevel option[data-category=\'' + $('.jobFilters select.joblevel')
936                    .val() + '\']').length) {
937                $('select.jobSubLevel').show();
938            } else {
939                $('.jobFilters .jobSubLevel').val('');
940                $('.jobFilters .jobSubLevel').hide();
941            }
942
943            $('.jobFilters select').each(function () {
944                if ($(this).val()) {
945                    jobCondition += '[data-' + $(this).attr('class') + '=\'' + $(this).val() + '\']';
946                    url.set($(this).attr('class'), $(this).val());
947                    window.localStorage.setItem($(this).attr('class'), $(this).val());
948                    filterSet++;
949                }
950            });
951            if (filterSet > 0) {
952
953                jobCondition += `, ${jobCondition.replace(/\[data-jobplace='[a-zA-Z]+']/, '[data-jobplace=""]')}`;
954
955                $('.news-layout-7 .currentCounter').html($('.news-layout-7 ' + jobCondition).length);
956                $('.news-layout-7 .news-list-item, .news-layout-3 .news-list-item').addClass('hidden');
957                $('.news-layout-7 .news-list-item, .news-layout-3 .news-list-item').removeClass('potentialVisible');
958                let activeCounter = 0;
959                $('.news-layout-7 ' + jobCondition + ', .news-layout-3 ' + jobCondition).each(function () {
960                    activeCounter++;
961                    if (activeCounter > $(this).parents('.news-list-view').data('itempp')) {
962                        $(this).addClass('potentialVisible');
963                    } else {
964                        $(this).removeClass('hidden');
965                    }
966                });
967            } else {
968                url.delete('jobplace');
969                window.localStorage.removeItem('jobplace');
970                url.delete('joblevel');
971                window.localStorage.removeItem('joblevel');
972                url.delete('jobSubLevel');
973                window.localStorage.removeItem('jobSubLevel');
974
975
976                $('.news-layout-7 .currentCounter').html($('.news-layout-7 .news-list-item').length);
977                $('.news-layout-7 .news-list-item, .news-layout-3 .news-list-item').addClass('hidden');
978                let activeCounter = 0;
979                $('.news-layout-7 .news-list-item, .news-layout-3 .news-list-item').each(function () {
980                    activeCounter++;
981                    if (activeCounter > $(this).parents('.news-list-view').data('itempp')) {
982                        $(this).addClass('potentialVisible');
983                    } else {
984                        $(this).removeClass('hidden');
985                    }
986                });
987            }
988            let params = url.toString();
989            let refresh = window.location.protocol + '//' + window.location.host + window.location.pathname + (params
990                ? '?' + params
991                : '');
992            window.history.pushState({path: refresh}, '', refresh);
993
994            if ($('.news-layout-7 .news-list-item.potentialVisible, .news-layout-3 .news-list-item.potentialVisible').length != 0) {
995                $('.news-layout-3 .showMoreLink').show();
996            } else {
997                $('.news-layout-3 .showMoreLink').hide();
998            }
999        });
1000        $('.news-layout-3 .showMoreLink a').click(function (e) {
1001            e.preventDefault();
1002            let activeCounter = 0;
1003            $('.news-layout-7 .news-list-item.potentialVisible, .news-layout-3 .news-list-item.potentialVisible')
1004                .each(function () {
1005                    activeCounter++;
1006                    if (activeCounter > $(this).parents('.news-list-view').data('itempp')) return true;
1007                    $(this).removeClass('hidden');
1008                    $(this).removeClass('potentialVisible');
1009                });
1010            if ($('.news-layout-7 .news-list-item.potentialVisible, .news-layout-3 .news-list-item.potentialVisible').length == 0) {
1011                $('.news-layout-3 .showMoreLink').hide();
1012            }
1013        });
1014
1015        // get data from storage or URL if provided
1016        let preFilterJobPlace = '';
1017        let preFilterJobLevel = '';
1018        let preFilterJobSubLevel = '';
1019        if (window.localStorage.getItem('jobPlace'))
1020            preFilterJobPlace = window.localStorage.getItem('jobPlace');
1021        if (window.localStorage.getItem('jobLevel'))
1022            preFilterJobLevel = window.localStorage.getItem('jobLevel');
1023        if (window.localStorage.getItem('jobSubLevel'))
1024            preFilterJobSubLevel = window.localStorage.getItem('jobSubLevel');
1025        if (window.location.search) {
1026            const urlParams = new URLSearchParams(window.location.search);
1027            if (urlParams.get('jobplace')) {
1028                preFilterJobPlace = urlParams.get('jobplace');
1029            }
1030            if (urlParams.get('joblevel')) {
1031                preFilterJobLevel = urlParams.get('joblevel');
1032            }
1033            if (urlParams.get('jobSubLevel')) {
1034                preFilterJobSubLevel = urlParams.get('jobSubLevel');
1035            }
1036        }
1037        if (preFilterJobPlace) {
1038            $('.jobFilters select.jobplace').val(preFilterJobPlace);
1039            $('.jobFilters select.jobplace').trigger('change');
1040        }
1041        if (preFilterJobLevel) {
1042            $('.jobFilters select.joblevel').val(preFilterJobLevel);
1043            $('.jobFilters select.joblevel').trigger('change');
1044        }
1045        if (preFilterJobSubLevel) {
1046            $('.jobFilters select.jobSubLevel').val(preFilterJobSubLevel);
1047            $('.jobFilters select.jobSubLevel').trigger('change');
1048        }
1049
1050        if (typeof jobFilterPreselectJoblevel !== 'undefined' && jobFilterPreselectJoblevel) {
1051            $('.jobFilters select.joblevel').val(jobFilterPreselectJoblevel);
1052            $('.jobFilters select.joblevel').trigger('change');
1053        }
1054    }
1055
1056    $('.scrollTopButton').click(function () {
1057        $('html, body').animate({scrollTop: 0}, 300);
1058        return false;
1059    });
1060
1061    /* backlink */
1062    $('.news-single a.btn-default, .globalBackButton').click(function (e) {
1063        if (document.baseURI && document.referrer && document.referrer.startsWith(document.baseURI) && document.referrer != window.location.href) {
1064            window.history.back();
1065            e.preventDefault();
1066            return false;
1067        }
1068    });
1069    $('.equalSubHeights').each(function () {
1070        let targetSubHeight = 0;
1071        $(this).find('.frame-layout-2').each(function () {
1072            if ($(this).height() > targetSubHeight) targetSubHeight = $(this).height();
1073        });
1074        $(this).find('.frame-layout-2').height(targetSubHeight);
1075    });
1076
1077    $('.news-single .contactContainer').prev().append($('.news-single .contactContainer'));
1078
1079
1080    $('.showHideFilter').click(function () {
1081        $(this).parents('.newsFilterWrap').toggleClass('closed');
1082    });
1083    $('.newsFilterWrap .primary-cta, .newsFilterWrap .secondary-cta').click(function () {
1084        let frameId = $(this).parents('.frame-type-news_pi1').attr('id');
1085        let overrides = $(this).parents('.newsFilterWrap').find('select').eq(0).val();
1086        if (!overrides)
1087            overrides = window.location.pathname;
1088        $('#' + frameId + ' .news-list-view').load(overrides + ' #' + frameId + ' .news-list-view');
1089    });
1090    $('.newsFilterWrap .filterReset').click(function () {
1091        $(this).parents('.newsFilterWrap').find('select').val('');
1092        $(this).prev().trigger('click');
1093    });
1094
1095    $('.languageWrapper').click(function () {
1096        $(this).toggleClass('language-menu-open');
1097    });
1098
1099
1100    mobileMenu();
1101    mobileFooter();
1102
1103    $('.highlightContainer').parents('.frame')
1104        .addClass('main-banner-frame');
1105
1106    /* scrollZoomOverlay */
1107    let zoomItem;
1108    $('.scaleNZoomImage').click(function () {
1109        if (!zoomItem || $('.zoomContainer').length == 0) {
1110            $('body').addClass('activeZoom');
1111            $(this).addClass('activeZoomElement');
1112            zoomItem = $('.scaleNZoomImage img').elevateZoom({
1113                //zoomWindowPosition: "zoomContainer",
1114                zoomType: 'lens',
1115                borderSize: 6,
1116                borderColour: '#005094',
1117                easing: true,
1118            });
1119        }
1120    });
1121    $('.closeZoom').click(function () {
1122        $('body').removeClass('activeZoom');
1123        $('.activeZoomElement').removeClass('activeZoomElement');
1124
1125        //remove
1126        $('.zoomContainer').remove();
1127        $('.scaleNZoomImage img').removeData('elevateZoom');
1128        $('.scaleNZoomImage img').removeData('zoomImage');
1129    });
1130
1131    /* event request */
1132    if ($('.registerForEvent').length) {
1133        $('#powermail_field_training').val($.trim($('.news-single h1').text()));
1134        let selectedOptions = '';
1135        selectedOptions = '';
1136        $('.eventModules input:checked').each(function () {
1137            selectedOptions += $(this).val() + ';\n';
1138        });
1139        $('#powermail_field_trainingoptions').val(selectedOptions);
1140        $('.eventModules input').change(function () {
1141            selectedOptions = '';
1142            $('.eventModules input:checked').each(function () {
1143                selectedOptions += $(this).val() + ';\n';
1144            });
1145            $('#powermail_field_trainingoptions').val(selectedOptions);
1146        });
1147    }
1148    $('.takePlace span').click(function () {
1149        $('#powermail_field_zeitraum').val($.trim($(this).parents('.timeSlot').find('.dateTime').text()));
1150        $([document.documentElement, document.body]).animate({
1151            scrollTop: $('.registerForEvent').eq(0).offset().top,
1152        }, 500);
1153    });
1154
1155
1156    if (jQuery('.simple-timeline').length > 0) {
1157        function checkHeight(pos, content) {
1158            content.each(function (ctr, el) {
1159                el = jQuery(el);
1160                let elPos = el.offset().top;
1161                if ((pos - 30) > (elPos - window.innerHeight)) {
1162                    el.addClass('fade');
1163                    if (false === el.hasClass('is-in')) {
1164                        window.setTimeout(function () {
1165                            el.addClass('is-in');
1166                            if (el.hasClass('counter')) {
1167                                startCounter(el[0]);
1168                            }
1169                        }, 100);
1170                    }
1171
1172                }
1173            });
1174        }
1175
1176        function rowFade(content) {
1177            // let content = jQuery('.content-block');
1178            checkHeight(window.scrollY, content);
1179            window.addEventListener('scroll', function () {
1180                checkHeight(window.scrollY, content);
1181            }, false);
1182        }
1183
1184        let items = jQuery('.simple-timeline').find('.frame');
1185
1186        rowFade(items);
1187
1188    }
1189
1190    $('.mobile-language-button').click(function () {
1191        $(this).toggleClass('mobile-language-button-open');
1192    });
1193
1194    $('.newsletter-box-container .newsletter-button').click(function () {
1195        $(this).parents('.newsletter-box-container').toggleClass('active');
1196        $(this).parents('.newsletter-box-container').find('.newsletter-container').stop().slideToggle();
1197    });
1198    $('.newsletter-box-container .close').click(function () {
1199        $(this).parents('.newsletter-box-container').toggleClass('active');
1200        $(this).parents('.newsletter-confirmation').stop().slideToggle();
1201    });
1202    if ($('.newsletter-box-container').length) {
1203        const queryString = window.location.search;
1204        const urlParams = new URLSearchParams(queryString);
1205        if (urlParams.get('newsletter') == 'true') {
1206            let newsletterElement = $('#' + urlParams.get('id'));
1207            newsletterElement.next().toggleClass('active');
1208            newsletterElement.next().find('.newsletter-confirmation').stop().slideToggle();
1209            $([document.documentElement, document.body]).animate({
1210                scrollTop: newsletterElement.offset().top - 200,
1211            }, 1000);
1212        }
1213    }
1214
1215    if ($('.formular-button-cta').length && $('.tx-powermail').length) {
1216        let tempProductTitle = $('.powermail_fieldset > .powermail_legend').html();
1217        $('.tx-powermail').prepend('<span class=\'close\'>X</span>');
1218        $('.tx-powermail .close').click(function (e) {
1219            $('body').removeClass('overlay');
1220            $('.productTitle').remove();
1221        });
1222        $('main .formular-button-cta').click(function (e) {
1223            e.preventDefault();
1224            $('body').addClass('overlay');
1225            let product = $(this).parents('.ce-textpic').find('h2, .h2').text();
1226            $('.powermail_grundihreranfrage').val(product);
1227            $('.powermail_fieldset > .powermail_legend')
1228                .html(tempProductTitle + ' <span class="productTitle">' + product + '</span>');
1229            return false;
1230        });
1231    }
1232
1233    $(window).scroll(function () {
1234        if ($(window).scrollTop() + window.innerHeight > ($(document).height() - 100)) {
1235            $('body').addClass('scrolled-to-bottom');
1236        } else {
1237            $('body').removeClass('scrolled-to-bottom');
1238        }
1239    });
1240
1241    initSearch();
1242    initNavigation();
1243    initPageRecommendations();
1244    setupMaskMap();
1245    initFileUpload();
1246    initTimer();
1247    initSliderBox();
1248    initImageAccordionSection();
1249    initListWithIcons();
1250});
1251
1252function loadMoreNews() {
1253    $('.news .news-list-view .page-navigation ul li.next a').click(function (e) {
1254        e.preventDefault();
1255        let clickObject = $(this);
1256        let ObjectIdentifier = clickObject.parents('.news-list-view').attr('id');
1257        $.ajax({
1258            url: clickObject.attr('href'),
1259        }).done(function (data) {
1260            clickObject.parents('.news-list-view').find('.showMoreLink').remove();
1261            clickObject.parents('.page-navigation').remove();
1262            const list = $('#' + ObjectIdentifier + ' .row');
1263            list.append($(data).find('#' + ObjectIdentifier + ' .news-list-item'));
1264            list.append($(data).find('#' + ObjectIdentifier + ' .page-navigation'));
1265            list.append($(data).find('#' + ObjectIdentifier + ' .showMoreLink'));
1266            loadMoreNews();
1267        });
1268        return false;
1269    });
1270}
1271
1272$(window).on('load', function (e) {
1273    $('.final-bg').each(function () {
1274        let BaseWidth = 1434;
1275        let BaseHeight = 1030;
1276
1277        // Get Transformation Matrix for Image
1278        let transform = $(this).parents('.highlightContainer').find('svg image').css('transform');
1279        let Scale = 1;
1280        if (transform && transform != 'none') { // safari seems to have issues with css transform
1281            let ImageMatrix = transform.match(/(-?[0-9\.]+)/g);
1282            Scale = ImageMatrix[0];
1283        } else {
1284            Scale = $(this)
1285                .parents('.highlightContainer')
1286                .find('svg image')
1287                .attr('transform')
1288                .split('scale')[1].replace(/\D/g, '');
1289        }
1290
1291
1292        // calc Width & Height:
1293        if ($(this).parents('.highlightContainer').find('svg image').width() == 0) {
1294            $(this)
1295                .width(($(this).parents('.highlightContainer').find('svg img').attr('width') * Scale / $(this)
1296                    .parents('.highlightContainer')
1297                    .find('svg')
1298                    .attr('width')) * 100 + '%');
1299            //  $(this).height(($(this).parents(".highlightContainer").find("svg img").attr("height")*Scale / $(this).parents(".highlightContainer").find("svg").attr("height"))*100 + "%");
1300        } else {
1301            $(this)
1302                .width(($(this)
1303                    .parents('.highlightContainer')
1304                    .find('svg image')
1305                    .width() * Scale / BaseWidth * 100) + '%');
1306            $(this)
1307                .height(($(this)
1308                    .parents('.highlightContainer')
1309                    .find('svg image')
1310                    .height() * Scale / BaseHeight * 100) + '%');
1311
1312        }
1313
1314        let ImageOffsetLeft = $(this).parents('.highlightContainer').find('svg image').offset()['left'];
1315        let ImageOffsetTop = $(this).parents('.highlightContainer').find('svg image').offset()['top'];
1316
1317        if (ImageOffsetLeft == 0 && ImageOffsetTop == 0) {
1318            let rect = $(this).parents('.highlightContainer').find('svg image')[0].getBoundingClientRect();
1319            let win = $(this).parents('.highlightContainer').find('svg image')[0].ownerDocument.defaultView;
1320
1321            ImageOffsetTop = rect.top + win.pageYOffset;
1322            ImageOffsetLeft = rect.left + win.pageXOffset;
1323        }
1324
1325        // calc Position
1326        let innerOffset = ImageOffsetLeft - $(this).parents('.highlightContainer').find('svg').offset()['left'];
1327        $(this).css('left', (innerOffset / $(this).parents('.highlightContainer').find('svg').width() * 100) + '%');
1328
1329        innerOffset = ImageOffsetTop - $(this).parents('.highlightContainer').find('svg').offset()['top'];
1330        $(this).css('top', (innerOffset / $(this).parents('.highlightContainer').find('svg').height() * 100) + '%');
1331
1332        $(this).css('opacity', 1);
1333        $(this).parents('.highlightContainer').find('svg image').css('opacity', 0);
1334    });
1335    $('.nav-tabs > div').each(function () {
1336        if (this.scrollWidth > $(this).outerWidth()) {
1337            $(this).addClass('activeOverflow');
1338        }
1339    });
1340
1341    /* jobLink Frames */
1342    $('.jobApplyLink').click(async function (e) {
1343
1344        e.preventDefault();
1345        $('body').addClass('activeOverlay');
1346
1347        // check http status
1348        let response = await checkStatusCode($('.jobApplyLink').attr('href'));
1349        if (response.status === 403) {
1350            $('body').append('<div class="overlay error-message">' + response.error_message + '</div>');
1351        } else {
1352            $('body').append('<div class="overlay"><iframe src="' + $(this).attr('href') + '" /></div>');
1353        }
1354
1355        $('body.activeOverlay').click(function () {
1356            $(this).removeClass('activeOverlay');
1357            $('.overlay').remove();
1358        });
1359
1360        // gtm tracking
1361        window.dataLayer = window.dataLayer || [];
1362        window.dataLayer.push({
1363            'event': 'jetzt_bewerben_klick',
1364            'location': 'content',
1365        });
1366        return false;
1367    });
1368
1369    // faq function
1370    $('.faq-item-question').click(function () {
1371        $(this).parents('.faq-item').toggleClass('open');
1372        $(this).siblings('.faq-item-text').stop().slideToggle('fast');
1373        let action = 'open';
1374        if (!$(this).parents('.faq-item').hasClass('open')) {
1375            action = 'close';
1376        }
1377        window.dataLayer.push({
1378            'event': 'faq-frage',
1379            'action': action,
1380            'title': $(this).text(),
1381        });
1382    });
1383
1384    if ($('.faq-list-categories').length) {
1385        let faqCategoryList = $('.faq-list-categories');
1386        faqCategoryList.each(function () {
1387            if ($(this).find('li').length < 2) {
1388                $(this).remove();
1389            }
1390        });
1391    }
1392
1393    $('.move-container').each(function () {
1394        let selector = $(this).data('moveto');
1395        $(this).appendTo($(selector));
1396        $(this).show();
1397    });
1398
1399    $('.lottie-animation').each(function () {
1400        let selector = $(this).find('.lottie-player');
1401        let newElement = $('<lottie-player></lottie-player>');
1402        newElement.attr('src', selector.attr('src'));
1403        newElement.attr('autoplay', 'autoplay');
1404        newElement.attr('loop', 'loop');
1405        selector.replaceWith(newElement);
1406    });
1407
1408    $(window).scroll(function () {
1409        var windowBottom = $(this).scrollTop() + $(this).innerHeight();
1410        $('.frame, .banner-item, .news-list-item').each(function () {
1411            /* Check the location of each desired element */
1412            var objectBottom = $(this).offset().top + 350;
1413
1414            /* If the element is completely within bounds of the window, fade it in */
1415            if (objectBottom < windowBottom) { //object comes into view (scrolling down)
1416                if ($(this).css('opacity') == 0) {
1417                    $(this).fadeTo(500, 1);
1418                }
1419            } else { //object goes out of view (scrolling up)
1420                if ($(this).index() > 1) {
1421                    if ($(this).css('opacity') == 1) {
1422                        //$(this).fadeTo(500, 0);
1423                    }
1424                }
1425            }
1426        });
1427        if (window.location.hash && window.location.hash !== '') {
1428            $(+window.location.hash).trigger('click');
1429        }
1430    }).scroll(); //invoke scroll-handler on page-load
1431
1432    if ($('.sideBarFooter .apply').length && $('.jobApplyLink').length) {
1433
1434        let sideBarApply = $('.sideBarFooter .apply a');
1435        sideBarApply.attr('href', $('.jobApplyLink').attr('href'));
1436        sideBarApply.click(async function (e) {
1437
1438            $('body').addClass('activeOverlay');
1439            e.preventDefault();
1440
1441            // check http status
1442            let response = await checkStatusCode($('.jobApplyLink').attr('href'));
1443            if (response.status === 403) {
1444                $('body').append('<div class="overlay error-message">' + response.error_message + '</div>');
1445            } else {
1446                $('body').append('<div class="overlay"><iframe src="' + $(this).attr('href') + '" /></div>');
1447            }
1448
1449            $('body.activeOverlay').click(function () {
1450                $(this).removeClass('activeOverlay');
1451                $('.overlay').remove();
1452            });
1453
1454            // gtm tracking
1455            window.dataLayer = window.dataLayer || [];
1456            window.dataLayer.push({
1457                'event': 'jetzt_bewerben_klick',
1458                'location': 'sidebar',
1459            });
1460            return false;
1461        });
1462    }
1463
1464    if (location.search !== '') {
1465        let getParameter = getUrlVars();
1466        if (getParameter['youtube']) {
1467            $('.youtube-activate-button').each(function () {
1468                convertIntoYoutubeElementLocal($(this), 0);
1469            });
1470        }
1471    }
1472
1473    $('.jobApplyLink').each(function () {
1474        $(this).attr('rel', 'noreferrer nofollow');
1475    });
1476
1477    $('.jump-section-media-video button, .content-section-media-inner button').click(function () {
1478        const video = $(this).prev()[0];
1479        video.play();
1480        video.controls = true;
1481
1482        $(this).remove();
1483    });
1484
1485    $('.banner-tile-footer-link').click(function () {
1486        let currentContainer = $(this).parents('.banner-tile');
1487        window.dataLayer.push({
1488            'event': 'banner_click',
1489            'size': currentContainer.data('size'),
1490            'position': currentContainer.data('position'),
1491            'title': currentContainer.find('.banner-tile-title').text(),
1492            'location': 'content',
1493        });
1494    });
1495});
1496
1497initTabSliderContainer();
1498initTabSliderContainerInnerSlider();
1499
1500function initTabSliderContainer() {
1501    let nav_item = document.querySelectorAll('.tab-navigation button');
1502    nav_item.forEach(function (item) {
1503        item.addEventListener('click', function () {
1504            nav_item.forEach(function (item) {
1505                nav_item.forEach(function (element) {
1506                    element.classList.remove('active');
1507                });
1508            });
1509            this.classList.add('active');
1510            document.getElementById(this.getAttribute('data-tab-id')).scrollIntoView({
1511                behavior: 'smooth',
1512                block: 'center',
1513            });
1514        });
1515    });
1516}
1517
1518function initTabSliderContainerInnerSlider() {
1519    let slide_item = document.querySelectorAll('.tab-content-inner button');
1520    slide_item.forEach(function (item) {
1521        item.addEventListener('click', function () {
1522            let max_count = parseInt(this.getAttribute('data-max-count'));
1523            let current_slide = parseInt(this.getAttribute('data-current-slide'));
1524            let content_class = this.getAttribute('data-content-class');
1525            if (current_slide < max_count) {
1526                current_slide++;
1527                document.getElementById(content_class + '-' + current_slide).scrollIntoView({
1528                    behavior: 'smooth',
1529                    block: 'center',
1530                });
1531                updateSlideButtonCount(current_slide, this.getAttribute('data-class'));
1532                updateSlideButtonState(this.getAttribute('data-class'));
1533            } else {
1534                current_slide--;
1535                document.getElementById(content_class + '-' + current_slide).scrollIntoView({
1536                    behavior: 'smooth',
1537                    block: 'center',
1538                });
1539                updateSlideButtonCount(current_slide, this.getAttribute('data-class'));
1540                updateSlideButtonState(this.getAttribute('data-class'));
1541            }
1542        });
1543    });
1544}
1545
1546function updateSlideButtonCount(count, element_class) {
1547    let button_list = document.querySelectorAll('.' + element_class);
1548    button_list.forEach(function (button) {
1549        button.setAttribute('data-current-slide', count);
1550    });
1551}
1552
1553function updateSlideButtonState(element_class) {
1554    let button_list = document.querySelectorAll('.' + element_class);
1555    button_list.forEach(function (button) {
1556        let max_count = parseInt(button.getAttribute('data-max-count'));
1557        let current_slide = parseInt(button.getAttribute('data-current-slide'));
1558        let direction = button.getAttribute('data-direction');
1559        if (direction === 'next') {
1560            if (current_slide === max_count) {
1561                button.disabled = true;
1562            } else {
1563                button.disabled = false;
1564            }
1565        }
1566        if (direction === 'prev') {
1567            if (current_slide === 1) {
1568                button.disabled = true;
1569            } else {
1570                button.disabled = false;
1571            }
1572        }
1573    });
1574}
1575
1576function checkStatusCode(url) {
1577    let language = document.querySelectorAll('meta[name="language"]')[0].getAttribute('content');
1578    return fetch('https://www.bhs-world.com/fileadmin/service/ping/', {
1579        method: 'POST',
1580        headers: {
1581            'Accept': 'application/json',
1582            'Content-Type': 'application/json',
1583        },
1584        body: JSON.stringify({
1585            'url': url,
1586            'language': language,
1587        }),
1588    })
1589        .then((response) => {
1590            return response.json();
1591        })
1592        .then((json) => {
1593            return json;
1594        });
1595}
1596
1597// Read a page's GET URL variables and return them as an associative array.
1598function getUrlVars() {
1599    let vars = [], hash;
1600    let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
1601    for (let i = 0; i < hashes.length; i++) {
1602        hash = hashes[i].split('=');
1603        vars.push(hash[0]);
1604        vars[hash[0]] = hash[1];
1605    }
1606    return vars;
1607}
1608
1609function convertIntoYoutubeElementLocal(element, autoplay) {
1610
1611    const parentElement = element.parent();
1612    const mainElement = parentElement.parent();
1613    const imgElement = parentElement.find('.preview-image');
1614
1615    let width = imgElement.data('width');
1616    let height = imgElement.data('height');
1617    let ytsrc = element.data('ytsrc');
1618    let uid = element.data('uid');
1619
1620    const videoElement = $('<iframe id="youtube-video-' + uid + '" class="youtube-video" width="' + width + '" height="' + height + '"\n' +
1621        'src="https://www.youtube-nocookie.com/embed/' + ytsrc + '?enablejsapi=1&autoplay=' + autoplay + '&rel=0&modestbranding=1"\n' +
1622        'frameborder="0" enablejsapi="1" allowfullscreen allow="autoplay; encrypted-media"></iframe>');
1623
1624    mainElement.append(videoElement);
1625    parentElement.remove();
1626
1627}
1628
1629
1630function mobileMenu() {
1631    $('.menu-link').click(function (e) {
1632        if (window.innerWidth < 786 && $(this).siblings('.menu').length > 0) {
1633            e.preventDefault();
1634            $(this).siblings('.menu')
1635                .addClass('mobile-visible');
1636            $(this).parents('.menu')
1637                .first()
1638                .addClass('submenu-open');
1639        }
1640    });
1641
1642    $('.mobile-prev-item .mobile-arrow').click(function () {
1643        $(this).parents('.menu')
1644            .first()
1645            .removeClass('mobile-visible')
1646            .parents('.menu')
1647            .first()
1648            .removeClass('submenu-open');
1649    });
1650}
1651
1652function mobileFooter() {
1653    $('.footerNavWrapper a').click(function (e) {
1654        if (window.innerWidth < 768) {
1655            if ($(this).siblings('ul').length && !$(this).parent().hasClass('clicked')) {
1656                e.preventDefault();
1657                $(this).parent()
1658                    .addClass('clicked');
1659                $(this).siblings('ul')
1660                    .slideDown();
1661            }
1662        }
1663    });
1664}
1665
1666function initPopups() {
1667    const popup = $('.popup');
1668    popup.each(function () {
1669        const id = $(this).data('popup');
1670        const self = $(this);
1671        if (!localStorage.getItem(`popup-closed-${id}`)) {
1672            popup.addClass('popup-active');
1673        }
1674
1675        self.find('.popup-close, .popup-background').click(function () {
1676            self.removeClass('popup-active');
1677            localStorage.setItem(`popup-closed-${id}`, 'true');
1678        });
1679    });
1680}
1681
1682function powermailSubmit() {
1683    for (const form of document.querySelectorAll('.powermail_form')) {
1684        const submit = form.querySelector('.powermail_fieldwrap_type_submit input');
1685
1686
1687        form.addEventListener('submit', () => {
1688            if (!form.checkValidity()) {
1689                return;
1690            }
1691
1692            submit.disabled = true;
1693
1694            let checkError = setInterval(function () {
1695                if (form.querySelectorAll('.powermail-errors-list').length) {
1696                    clearInterval(checkError);
1697                    submit.disabled = false;
1698                }
1699            });
1700        });
1701    }
1702}
1703
1704async function registrationForm() {
1705    const form = document.querySelector('.powermail_form_43');
1706    if (!form) {
1707        return;
1708    }
1709
1710    const otherPersonCheckbox = form.querySelector('#powermail_field_begleitperson_1');
1711    const childrenInput = form.querySelector('#powermail_field_kinder');
1712
1713    const selectFieldWrap = form.querySelector('.powermail_fieldwrap_uhrzeitfuerfuehrung');
1714
1715    const select = selectFieldWrap.querySelector('select');
1716    const options = select.querySelectorAll('option');
1717
1718    let controller;
1719
1720    form.addEventListener('change', checkValues);
1721
1722    checkValues();
1723
1724    function checkValues() {
1725        controller?.abort();
1726        controller = new AbortController();
1727
1728        let count = 1;
1729        if (otherPersonCheckbox) {
1730            if (otherPersonCheckbox.checked) {
1731                count++;
1732            }
1733        }
1734
1735        if (childrenInput) {
1736            if (childrenInput.valueAsNumber && childrenInput.valueAsNumber > 0) {
1737                count += childrenInput.valueAsNumber;
1738            }
1739        }
1740
1741        const searchParams = new URLSearchParams();
1742        searchParams.set('count', count.toString());
1743
1744        fetch(`/fileadmin/service/registrations/?${searchParams}`, {signal: controller.signal})
1745            .then(res => res.json())
1746            .then(allowed => {
1747                for (const option of options) {
1748                    if (option.value in allowed) {
1749                        option.disabled = allowed[option.value];
1750
1751                        if (option.selected && option.disabled) {
1752                            select.value = '';
1753                        }
1754                    }
1755                }
1756            });
1757    }
1758}
1759
1760function initNavigation() {
1761    const submenus = document.querySelectorAll('.page-header-nav-submenu');
1762    for (const submenu of submenus) {
1763        /** @type {NodeListOf<HTMLAnchorElement>} */
1764        const submenuItems = submenu.querySelectorAll('.page-header-nav-submenu-item--has-children > a');
1765        for (const item of submenuItems) {
1766            item.addEventListener('pointerenter', _resize);
1767            item.addEventListener('focusin', _resize);
1768
1769            function _resize() {
1770                submenu.style.removeProperty('--max-menu-height');
1771
1772                let currentMenuList = item.nextElementSibling;
1773                let maxHeight = currentMenuList.getBoundingClientRect().height;
1774
1775                while (true) {
1776                    if (currentMenuList.classList.contains('page-header-nav-submenu-root') || !currentMenuList) {
1777                        break;
1778                    }
1779
1780                    currentMenuList = currentMenuList.parentElement.closest('ul');
1781                    const currentHeight = currentMenuList.getBoundingClientRect().height;
1782
1783                    if (currentHeight > maxHeight) {
1784                        maxHeight = currentHeight;
1785                    }
1786                }
1787
1788                submenu.style.setProperty('--max-menu-height', `${maxHeight}px`);
1789            }
1790        }
1791    }
1792}
1793
1794function initSearch() {
1795    const searchBtn = document.querySelector('.page-header-button--search');
1796    const oldSearchBtn = document.querySelector('.searchButton');
1797    const searchOverlay = document.querySelector('.page-search');
1798    searchBtn?.addEventListener('click', _openSearchBox);
1799    oldSearchBtn?.addEventListener('click', _openSearchBox);
1800
1801    const closeBtn = document.querySelector('.page-search-form-close');
1802    closeBtn?.addEventListener('click', () => {
1803        if (document.startViewTransition) {
1804            document.startViewTransition(() => searchOverlay.close());
1805        } else {
1806            searchOverlay.close();
1807        }
1808    });
1809
1810    function _openSearchBox() {
1811        if (document.startViewTransition) {
1812            document.startViewTransition(() => searchOverlay.showModal());
1813        } else {
1814            searchOverlay.showModal();
1815        }
1816    }
1817}
1818
1819function initPageRecommendations() {
1820    const elements = document.querySelectorAll('.page-recommendations');
1821    for (const element of elements) {
1822        /** @type {HTMLSelectElement} */
1823        const answer1Select = element.querySelector('.page-recommendations-step--step1 select');
1824        /** @type {NodeListOf<HTMLSelectElement>} */
1825        const answer2Selects = element.querySelectorAll('.page-recommendations-step--step2 select');
1826
1827        /** @type {HTMLSelectElement} */
1828        let activeAnswer2Select = element.querySelector(
1829            '.page-recommendations-step--step2 .page-recommendations-select--active');
1830
1831        /** @type {NodeListOf<HTMLLIElement>} */
1832        const results = element.querySelectorAll('.page-recommendation');
1833
1834        answer1Select.addEventListener('change', () => {
1835            for (const select of answer2Selects) {
1836                const isActive = select.dataset.answer1 === answer1Select.value;
1837
1838                select.classList.toggle('page-recommendations-select--active', isActive);
1839
1840                if (isActive) {
1841                    activeAnswer2Select = select;
1842                }
1843            }
1844
1845            _updateResults();
1846        });
1847
1848        for (const select of answer2Selects) {
1849            select.addEventListener('change', () => {
1850                _updateResults();
1851            });
1852        }
1853
1854        function _updateResults() {
1855            const answer1 = answer1Select.value;
1856            const answer2 = activeAnswer2Select.value;
1857
1858            for (const resultItem of results) {
1859                resultItem.classList.toggle(
1860                    'page-recommendation--active',
1861                    resultItem.dataset.answer1 === answer1 && resultItem.dataset.answer2 === answer2,
1862                );
1863            }
1864        }
1865    }
1866}
1867
1868function setupMaskMap() {
1869    let openAll = sessionStorage.getItem('mask_map') ?? false;
1870
1871    $('.frame-type-mask-map').each(function () {
1872        $(this).find('.map-show').click(function () {
1873            let wrapperElement = $(this).parent();
1874            let mainElement = wrapperElement.parent();
1875
1876            let src = $(this).attr('data-src');
1877
1878            wrapperElement.remove();
1879            mainElement.append('<iframe src="' + src + '" style="width: 100%; height: 400px;"></iframe>');
1880
1881            sessionStorage.setItem('mask_map', true);
1882        });
1883
1884        if (openAll) {
1885            $(this).find('.map-show').trigger('click');
1886        }
1887    });
1888}
1889
1890function initFileUpload() {
1891    const numberFormatter = new Intl.NumberFormat('de', {
1892        maximumFractionDigits: 1,
1893    });
1894
1895    const elements = document.querySelectorAll('.file-input');
1896    for (const element of elements) {
1897        const maxFiles = element.classList.contains('file-input--multiple')
1898            ? parseInt(element.dataset.maxFiles ?? '5')
1899            : 1;
1900        const maxFileSize = parseInt(element.dataset.maxFileSize ?? Number.MAX_SAFE_INTEGER);
1901        /** @type {{removeFile: string, fileTooLarge: string}} */
1902        const messages = JSON.parse(element.dataset.messages ?? '{}');
1903
1904        const input = element.querySelector('input');
1905        const items = element.querySelector('.file-input-items');
1906
1907        const transfer = new DataTransfer();
1908
1909        input.addEventListener('change', () => {
1910            _updateInput([...input.files]);
1911        });
1912
1913        /**
1914         * @param {File[]} addedFiles
1915         * @private
1916         */
1917        function _updateInput(addedFiles = []) {
1918            const remainingFiles = Math.max(maxFiles - transfer.files.length, 0);
1919
1920            /** @type {File[]} */
1921            const files = addedFiles.slice(0, remainingFiles);
1922            for (const file of files) {
1923                if (file.size > maxFileSize) {
1924                    alert(messages.fileTooLarge.replace('%s', file.name));
1925                    continue;
1926                }
1927
1928                transfer.items.add(file);
1929            }
1930
1931            input.files = transfer.files;
1932
1933            const full = transfer.files.length >= maxFiles;
1934            element.classList.toggle('file-input--full', full);
1935            //input.disabled = full;
1936
1937            items.innerHTML = '';
1938
1939            for (const file of input.files) {
1940                const splitName = file.name.split('.');
1941                const extension = splitName[splitName.length - 1];
1942                const fileName = splitName.slice(0, splitName.length - 1).join('.');
1943
1944                let previewElement = null;
1945                if (file.type.startsWith('image/')) {
1946                    previewElement = document.createElement('img');
1947                    previewElement.src = URL.createObjectURL(file);
1948                    previewElement.width = 32;
1949                    previewElement.height = 32;
1950                    previewElement.ariaHidden = 'true';
1951                } else if (file.type.startsWith('video/')) {
1952                    previewElement = document.createElement('video');
1953                    previewElement.src = URL.createObjectURL(file);
1954                    previewElement.width = 32;
1955                    previewElement.height = 32;
1956                    previewElement.muted = true;
1957                    previewElement.controls = false;
1958                    previewElement.playsInline = true;
1959                    previewElement.ariaHidden = 'true';
1960                } else {
1961                    previewElement = document.createElement('span');
1962                    previewElement.innerText = extension.toUpperCase();
1963                }
1964
1965                const item = document.createElement('div');
1966                item.classList.add('file-input-item');
1967                item.ariaLabel = file.name;
1968
1969                const previewFrame = document.createElement('div');
1970                previewFrame.classList.add('file-input-item-preview');
1971                previewFrame.append(previewElement);
1972                item.append(previewFrame);
1973
1974                const fileInfo = document.createElement('div');
1975                fileInfo.classList.add('file-input-item-info');
1976                const fileInfoName = document.createElement('p');
1977                fileInfoName.classList.add('file-input-item-info-name');
1978                fileInfoName.innerText = fileName;
1979                fileInfo.append(fileInfoName);
1980                const fileInfoMeta = document.createElement('p');
1981
1982                let fileSize = '';
1983                if (file.size > 100000) {
1984                    fileSize = `${numberFormatter.format(file.size / (1024 * 1024))} MB`;
1985                } else {
1986                    fileSize = `${numberFormatter.format(file.size / 1024)} KB`;
1987                }
1988
1989                fileInfoMeta.innerText = `${extension.toUpperCase()} · ${fileSize}`;
1990                fileInfo.append(fileInfoMeta);
1991                item.append(fileInfo);
1992
1993                const removeBtn = document.createElement('button');
1994                removeBtn.classList.add('file-input-item-remove');
1995                removeBtn.title = messages.removeFile;
1996                const removeIcon = document.createElement('img');
1997                removeIcon.src = '/typo3conf/ext/c3local/Resources/Public/Icons/x.svg';
1998                removeIcon.ariaHidden = 'true';
1999                removeBtn.append(removeIcon);
2000                removeBtn.addEventListener('click', () => {
2001                    item.remove();
2002                    const fileIdx = [...input.files].findIndex(f => f === file);
2003                    transfer.items.remove(fileIdx);
2004                    _updateInput();
2005                });
2006                item.append(removeBtn);
2007
2008                items.append(item);
2009            }
2010        }
2011    }
2012}
2013
2014function initTimer() {
2015    const elements = document.querySelectorAll('.timer');
2016    const now = new Date();
2017    for (const element of elements) {
2018        const targetDate = new Date(element.dataset.targetDate);
2019        const dayDiff = Math.max(Math.round(Math.abs((targetDate - now) / (24 * 60 * 60 * 1000))), 0);
2020        const numberContainer = element.querySelector('.timer-counter-numbers');
2021        const observer = new IntersectionObserver(entries => {
2022            for (const entry of entries) {
2023                if (!entry.isIntersecting) {
2024                    continue;
2025                }
2026
2027                $({days: 99}).animate({days: dayDiff}, {
2028                    duration: 3000,
2029                    step: function () {
2030                        numberContainer.innerHTML = Math.ceil(this.days)
2031                            .toString()
2032                            .split('')
2033                            .map(number => `<span>${number}</span>`)
2034                            .join('');
2035                    },
2036                });
2037
2038                observer.unobserve(entry.target);
2039            }
2040        }, {
2041            threshold: .8,
2042        });
2043
2044        observer.observe(numberContainer);
2045
2046    }
2047}
2048
2049function initSliderBox() {
2050    const elements = document.querySelectorAll('.slider-box');
2051    for (const element of elements) {
2052        /** @type {HTMLButtonElement} */
2053        const rightButton = element.querySelector('.slider-box-slide--right .slider-box-slide-arrow');
2054        /** @type {HTMLButtonElement} */
2055        const leftButton = element.querySelector('.slider-box-slide--left .slider-box-slide-arrow');
2056        leftButton.addEventListener('click', () => {
2057            element.dataset.open = 'left';
2058        });
2059        rightButton.addEventListener('click', () => {
2060            element.dataset.open = 'right';
2061        });
2062    }
2063}
2064
2065function initImageAccordionSection() {
2066    const elements = document.querySelectorAll('.image-accordion-section');
2067    for (const element of elements) {
2068        /** @type {HTMLButtonElement} */
2069        const button = element.querySelector('.image-accordion-section-button');
2070        button.addEventListener('click', () => {
2071            const open = element.dataset.open !== 'true';
2072            element.dataset.open = open.toString();
2073            button.innerText = open ? button.dataset.textShowLess : button.dataset.textShowMore;
2074        });
2075    }
2076}
2077
2078function initListWithIcons() {
2079    const elements = document.querySelectorAll('.list-with-icons-container--expandable');
2080    for (const element of elements) {
2081        /** @type {HTMLButtonElement} */
2082        const button = element.querySelector('.list-with-icons-expand');
2083        button.addEventListener('click', () => {
2084            const open = element.dataset.open !== 'true';
2085            element.dataset.open = open.toString();
2086            button.innerText = open ? button.dataset.textShowLess : button.dataset.textShowMore;
2087        });
2088    }
2089}
2090
2091iconbarSlider();
2092
2093function iconbarSlider() {
2094    const iconbars = document.querySelectorAll('.iconbar--slider');
2095    for (const iconbar of iconbars) {
2096        const swiper = new Swiper(iconbar.querySelector('.swiper-container'), {
2097            slidesPerView: 3,
2098            slidesPerGroup: 3,
2099            spaceBetween: 64,
2100            loopFillGroupWithBlank: true,
2101            loop: true,
2102            navigation: {
2103                nextEl: iconbar.querySelector('.swiper-button-next'),
2104                prevEl: iconbar.querySelector('.swiper-button-prev')
2105            },
2106            breakpoints: {
2107                990: {
2108                    slidesPerView: 2,
2109                    slidesPerGroup: 2,
2110                    spaceBetween: 32
2111                },
2112                600: {
2113                    slidesPerView: 1,
2114                    slidesPerGroup: 1,
2115                }
2116            }
2117        });
2118    }
2119}
2120// mask elements hero_video / toggle_cards / hotspot_image
2121(function ($) {
2122    'use strict';
2123
2124    $(function () {
2125        if (document.documentElement.dataset.c3accessibilityReduceMotion !== 'true') {
2126            return;
2127        }
2128
2129        $('.hero-video-media').each(function () {
2130            this.autoplay = false;
2131            this.loop = false;
2132            this.pause();
2133            $(this).on('play', function () {
2134                this.pause();
2135            });
2136        });
2137    });
2138
2139    $(document).on('click', '.frame-type-toggle-cards .toggle-card-toggle', function () {
2140        var $toggle = $(this);
2141        var $card = $toggle.closest('.toggle-card');
2142        var isOpen = $card.toggleClass('toggle-card--open').hasClass('toggle-card--open');
2143
2144        $toggle.attr('aria-expanded', isOpen ? 'true' : 'false');
2145        $card.find('.toggle-card-panel').first().attr('aria-hidden', isOpen ? 'false' : 'true');
2146
2147        window.dataLayer.push({
2148            'event': 'accordion',
2149            'accordion.action': isOpen ? 'open' : 'close',
2150            'accordion.title': $card.find('.toggle-card-title').first().text().trim()
2151        });
2152    });
2153
2154    function closeHotspot($item) {
2155        $item.removeClass('is-open');
2156        $item.find('.hotspot-image-marker').attr('aria-expanded', 'false');
2157        $item.find('.hotspot-image-popup').attr('hidden', 'hidden');
2158    }
2159
2160    $(document).on('click', '.hotspot-image-marker', function () {
2161        var $marker = $(this);
2162        var $item = $marker.closest('.hotspot-image-item');
2163        var wasOpen = $item.hasClass('is-open');
2164
2165        $marker.closest('.hotspot-image').find('.hotspot-image-item.is-open').each(function () {
2166            closeHotspot($(this));
2167        });
2168
2169        if (wasOpen) {
2170            return;
2171        }
2172
2173        $item.addClass('is-open');
2174        $marker.attr('aria-expanded', 'true');
2175        $item.find('.hotspot-image-popup').removeAttr('hidden');
2176    });
2177
2178    $(document).on('click', function (e) {
2179        if ($(e.target).closest('.hotspot-image-item').length) {
2180            return;
2181        }
2182
2183        $('.hotspot-image-item.is-open').each(function () {
2184            closeHotspot($(this));
2185        });
2186    });
2187
2188    $(document).on('keydown', function (e) {
2189        if (e.key !== 'Escape' && e.key !== 'Esc') {
2190            return;
2191        }
2192
2193        $('.hotspot-image-item.is-open').each(function () {
2194            var $item = $(this);
2195
2196            closeHotspot($item);
2197            $item.find('.hotspot-image-marker').trigger('focus');
2198        });
2199    });
2200})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.