PageSourceSearch

https://www.ksb-rhein-sieg.de/typo3conf/ext/co_theme/Resources/Public/Theme/_Master/Js/functions.1757508382.js

js ksb-rhein-sieg.de collected 2026-10-07 23:50:00 UTC 21,250 bytes, 629 lines download raw bytes

1$(document).ready(function () {
2
3    // readMoreButton($);
4
5    // AOS.init();
6
7    // mobileTabs($);
8
9    $('html').addClass('ua-' + detectIE());
10
11
12    $('table.table-responsive').removeClass('table-responsive').wrapAll('<div class="table-responsive" />');
13
14    $('.gallery-item figure.video').parent().addClass('w-100');
15
16    // $('body.home .nav-item a[title="Home"]').parent().addClass('active');
17
18    scrollTop();
19
20    $(window).scroll(function () {
21        scrollTop();
22    });
23
24
25    $('.accordion.accordion-multiple .collapse').removeAttr('data-parent');
26    $('.accordion:not(.accordion-single) .collapse').removeAttr('data-parent');
27
28    $('#toTop').click(function () {
29        $('html, body').scrollTop(0);
30        return false;
31    });
32
33    $('a.scroll-to').on('click', function (e) {
34        e.preventDefault();
35        var cOffset = $($(this).attr('href')).offset().top - 100;
36        $('html,body').scrollTop(cOffset);
37    });
38
39    $('.hamburger').click(function () {
40        $(this).toggleClass('is-active');
41    });
42
43    $('#servicenav.servicehub').click(function () {
44        $(this).toggleClass('is-active');
45    });
46
47    $('.grid-toggle-container.tabs-layout .tab-header').first().addClass('active show');
48    $('.grid-toggle-container.tabs-layout .tab-pane').first().addClass('active show');
49    $('.grid-toggle-container.accordion-multiple .collapse').removeAttr('data-parent');
50    $('.grid-toggle-container.accordion-open-first .accordion-header').first().removeClass('collapsed');
51    $('.grid-toggle-container.accordion-open-first .collapse ').first().addClass('show');
52    $('.gallery-item .video .video-embed video ').parent().addClass('pb-0');
53
54
55    wcag()
56
57    $('img.svg-icon').each(function () {
58        var img = jQuery(this);
59        var imgID = img.attr('id');
60        var imgClass = img.attr('class');
61        var imgURL = img.attr('src');
62        $.get(imgURL, function (data) {
63            var svg = jQuery(data).find('svg');
64            if (typeof imgID !== 'undefined') {
65                svg = svg.attr('id', imgID);
66            }
67            if (typeof imgClass !== 'undefined') {
68                svg = svg.attr('class', imgClass + ' replaced-svg');
69            }
70            svg = svg.removeAttr('xmlns:a');
71            img.replaceWith(svg);
72        }, 'xml');
73    });
74
75    imgToBg($);
76
77    $('[data-toggle="tooltip"], [data-bs-toggle="tooltip"]').tooltip({
78        html: true
79    });
80
81    $('.navbar-nav.test-navigation .dropdown:not(.megamenu) > a').click(function () {
82        if ($('.navbar-toggler').css('display') === 'none') {
83            location.href = this.href;
84        }
85    });
86
87    $(document).scroll(function () {
88        var pos = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
89        var $elem = $("#servicenav");
90        if (pos > 450) {
91            $elem.css("top", "200px");
92        } else {
93            $elem.css("top", (650 - pos) + "px");
94        }
95    });
96
97    var myLazyLoad = new LazyLoad();
98// After your content has changed...
99    myLazyLoad.update();
100
101
102    // Select all links with hashes
103    $('.frame-type-menu_section a[href*="#"]')
104        // Remove links that don't actually link to anything
105        .not('[href="#"]')
106        .not('[href="#0"]')
107        .not('.page-link')
108        .click(function (event) {
109            // On-page links
110            if (
111                location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
112                &&
113                location.hostname == this.hostname
114            ) {
115                // Figure out element to scroll to
116                var target = $(this.hash);
117                target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
118                // Does a scroll target exist?
119                if (target.length) {
120                    // Only prevent default if animation is actually gonna happen
121                    event.preventDefault();
122                    $('html, body').animate({
123                        scrollTop: target.offset().top
124                    }, 600, function () {
125                        // Callback after animation
126                        // Must change focus!
127                        var $target = $(target);
128                        $target.focus();
129                        if ($target.is(":focus")) { // Checking if the target was focused
130                            return false;
131                        } else {
132                            $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable
133                            $target.focus(); // Set focus again
134                        }
135                        ;
136                    });
137                }
138            }
139        });
140
141    popup()
142
143    toast()
144
145    googleSearchGdpr()
146    // setTimeout(function () {
147    //     $('input.gsc-input').attr('placeholder', 'Wonach suchen Sie?');
148    // }, 500)
149
150    sgCookieYouTubePreviewImage()
151
152    console.log('coTheme loaded & ready.');
153
154});
155
156
157// function mobileTabs($) {
158//     $('.mobile-tab-nav .tab-link').click(function () {
159//         var href = $(this).attr("href");
160//         var hash = href.substr(href.indexOf("#"));
161//
162//         $('.tab-pane, .nav-tabs .tab-link').removeClass('active');
163//
164//         $('.nav-tabs .tab-link[href="' + hash + '"], .tab-pane' + hash).addClass('show active');
165//     });
166//
167//     // $('.single-product-table > ul.nav-tabs .tab-link').click(function() {
168//     //     var href = $(this).attr("href");
169//     //     var hash = href.substr(href.indexOf("#"));
170//     //     $('.mobile-tab-nav .tab-link').removeClass('active');
171//     //     $('.nav-tabs .tab-link[href="' + hash + '"]').addClass('show active');
172//     // });
173// }
174
175
176function readMoreButton($) {
177    $('.btn-readmore').each(function () {
178        $(this).text('weiterlesen');
179        $(this).nextAll().wrapAll('<div class="more-text" />');
180        $(this).parent().append($(this));
181    });
182
183    $('.btn-readmore').click(function () {
184        $(this).toggleClass('btn-show');
185        $(this).parent().find('.more-text').slideToggle();
186
187        if ($(this).hasClass('btn-show')) {
188            $(this).text('weniger');
189        } else {
190            $(this).text('weiterlesen');
191        }
192    });
193};
194
195
196function scrollTop() {
197    if (document.getElementById("toTop")) {
198        if ($(window).scrollTop() > 100) {
199            $('#toTop').fadeIn();
200        } else {
201            $('#toTop').fadeOut();
202        }
203
204        var paddingBottom = 16;
205        // console.log(document.getElementById("toTop"))
206        if ($('#toTop').offset().top >= $('#footer').offset().top)
207            $('#toTop').css({'position': 'absolute', 'bottom': '0', 'transform': 'translateY(100%)'});
208        if ($(document).scrollTop() + window.innerHeight < $('#footer').offset().top + $('#toTop').height() + paddingBottom)
209            $('#toTop').css({'position': 'fixed', 'bottom': +paddingBottom + 'px', 'transform': 'translateY(0)'}); // restore when you scroll up
210    }
211
212}
213
214function imgToBg($) {
215    $('.frame-img-to-bg').each(function () {
216        var imgUrl = $(this).find('.image img').attr('src');
217        $(this).parent().css({
218            'background': 'url(' + imgUrl + ') no-repeat',
219            'background-size': 'cover',
220            'background-position': 'center'
221        });
222    });
223}
224
225/**
226 * detect IE
227 * returns version of IE or false, if browser is not Internet Explorer
228 */
229function detectIE() {
230    var ua = window.navigator.userAgent;
231
232    var msie = ua.indexOf('MSIE ');
233    if (msie > 0) {
234        // IE 10 or older => return version number
235        return 'ie ie-' + parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
236    }
237
238    var trident = ua.indexOf('Trident/');
239    if (trident > 0) {
240        // IE 11 => return version number
241        var rv = ua.indexOf('rv:');
242        return 'ie ie-' + parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
243    }
244
245    var edge = ua.indexOf('Edge/');
246    if (edge > 0) {
247        // Edge (IE 12+) => return version number
248        return 'edge edge-' + parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
249    }
250
251    var opera = ua.indexOf('OPR/');
252    if (opera > 0) {
253        return 'opera opera-' + parseInt(ua.substring(opera + 4, ua.indexOf('.', opera)), 10);
254    }
255
256    var chrome = ua.indexOf('Chrome/');
257    if (chrome > 0) {
258        return 'chrome chrome-' + parseInt(ua.substring(chrome + 7, ua.indexOf('.', chrome)), 10);
259    }
260
261    var firefox = ua.indexOf('Firefox/');
262    if (firefox > 0) {
263        return 'firefox firefox-' + parseInt(ua.substring(firefox + 8, ua.indexOf('.', firefox)), 10);
264    }
265
266    var safari = ua.indexOf('Safari/');
267    if (safari > 0) {
268        return 'safari safari-' + parseInt(ua.substring(safari + 7, ua.indexOf('.', safari)), 10);
269    }
270
271    // other browser
272    return 'modern';
273}
274
275
276function popup() {
277    let popupEl = $('#buendePopup')
278    let popupDelay = 1000
279    let midnight = new Date();
280    midnight.setHours(23, 59, 59, 0);
281
282    let popupCookieName = 'popupState'
283    // if (typeof popupCookieName !== "undefined") {
284    //     popupCookieName += window.location.pathname.split('/')[1]
285    // }
286
287    if (popupEl.length) {
288        if (Cookies.get(popupCookieName) !== 'shown') {
289            if (Cookies.get('cookie_optin')) {
290                showModalDelayed(popupEl, popupDelay);
291            }
292        }
293
294        $('.sg-cookie-optin-box-button > button').click(function () {
295            if (Cookies.get(popupCookieName) !== 'shown') {
296                showModalDelayed(popupEl, popupDelay);
297            }
298        })
299
300        popupEl.on('hidden.bs.modal', function (e) {
301            Cookies.set(popupCookieName, 'shown', {expires: midnight});
302            $('#coronaPopup').modal('hide');
303        });
304
305        popupEl.find('.modal-footer .btn').click(function () {
306            Cookies.set(popupCookieName, 'shown', {expires: midnight});
307        })
308
309        function showModalDelayed(el, delay) {
310            setTimeout(function () {
311                el.modal('show')
312            }, delay);
313        }
314    }
315}
316
317function toast() {
318    let toastEl = $('#supportInfoToast')
319    let toastDelay = 1000
320    let midnight = new Date();
321    midnight.setHours(23, 59, 59, 0);
322
323    let toastCookieName = 'toastState'
324
325    if (toastEl.length) {
326        if (Cookies.get(toastCookieName) !== 'shown') {
327            if (Cookies.get('cookie_optin')) {
328                showToastDelayed(toastEl, toastDelay);
329            }
330        }
331
332        $('.sg-cookie-optin-box-button > button').click(function () {
333            if (Cookies.get(toastCookieName) !== 'shown') {
334                showToastDelayed(toastEl, toastDelay);
335            }
336        })
337
338        toastEl.on('hidden.bs.toast', function (e) {
339            Cookies.set(toastCookieName, 'shown', {expires: midnight});
340        });
341
342        toastEl.find('.modal-footer .btn').click(function () {
343            Cookies.set(toastCookieName, 'shown', {expires: midnight});
344        })
345
346        function showToastDelayed(el, delay) {
347            setTimeout(function () {
348                el.toast('show')
349            }, delay);
350        }
351    }
352}
353
354
355// function googleSearchGdpr() {
356//     var cookieOptin = Cookies.get('cookie_optin')
357//     if (cookieOptin) {
358//         if (cookieOptin.indexOf('google-search:0') >= 0) {
359//             // console.log('search disabled')
360//             $('.google-search-wrapper .open-cookie-optin-wrapper').addClass('d-flex')
361//         } else if (cookieOptin.indexOf('google-search:1') >= 0) {
362//             // console.log('search enabled')
363//             $('.google-search-wrapper .open-cookie-optin-wrapper').removeClass('d-flex').hide()
364//             $('.cookie-optin-text').hide()
365//         }
366//
367//         if (cookieOptin.indexOf('google-search') === -1) {
368//             Cookies.remove('cookie_optin');
369//             SgCookieOptin.openCookieOptin()
370//         }
371//     }
372//
373//     $(document).on('click', '.sg-cookie-optin-box-button button', function () {
374//         // console.log('banner dismissed')
375//         var cookieOptin = Cookies.get('cookie_optin')
376//         // console.log(cookieOptin)
377//         if (cookieOptin) {
378//             if (cookieOptin.indexOf('google-search:0') >= 0) {
379//                 // console.log('search disabled')
380//                 $('.google-search-wrapper .open-cookie-optin-wrapper').addClass('d-flex')
381//             } else if (cookieOptin.indexOf('google-search:1') >= 0) {
382//                 // console.log('search enabled')
383//                 setTimeout(function () {
384//                     $('input.gsc-input').attr('placeholder', 'Wonach suchen Sie?');
385//                 }, 500)
386//                 $('.google-search-wrapper .open-cookie-optin-wrapper').removeClass('d-flex').hide()
387//                 $('.cookie-optin-text').hide()
388//             }
389//         }
390//     })
391//
392//     setTimeout(function () {
393//         $('input.gsc-input').attr('placeholder', 'Wonach suchen Sie?');
394//     }, 500)
395// }
396
397
398// function googleSearchGdpr() {
399//     function loadGoogleSearchScript() {
400//         var googleSearchScript = document.getElementById('googleSearchScript');
401//         var newScript = document.createElement('script');
402//         newScript.src = googleSearchScript.getAttribute('src');
403//         newScript.type = 'text/javascript';
404//         document.body.appendChild(newScript);
405//     }
406//
407//     var cookieOptin = Cookies.get('cookie_optin');
408//     if (cookieOptin) {
409//         if (cookieOptin.indexOf('google-search:0') >= 0) {
410//             // console.log('search disabled')
411//             $('.google-search-wrapper .open-cookie-optin-wrapper').addClass('d-flex');
412//         } else if (cookieOptin.indexOf('google-search:1') >= 0) {
413//             // console.log('search enabled')
414//             loadGoogleSearchScript();
415//             $('.google-search-wrapper .open-cookie-optin-wrapper').removeClass('d-flex').hide();
416//             $('.cookie-optin-text').hide();
417//         }
418//
419//         if (cookieOptin.indexOf('google-search') === -1) {
420//             Cookies.remove('cookie_optin');
421//             SgCookieOptin.openCookieOptin();
422//         }
423//     }
424//
425//     $(document).on('click', '.sg-cookie-optin-box-button button', function () {
426//         // console.log('banner dismissed')
427//         var cookieOptin = Cookies.get('cookie_optin');
428//         // console.log(cookieOptin)
429//         if (cookieOptin) {
430//             if (cookieOptin.indexOf('google-search:0') >= 0) {
431//                 // console.log('search disabled')
432//                 $('.google-search-wrapper .open-cookie-optin-wrapper').addClass('d-flex');
433//             } else if (cookieOptin.indexOf('google-search:1') >= 0) {
434//                 // console.log('search enabled')
435//                 loadGoogleSearchScript();
436//                 setTimeout(function () {
437//                     $('input.gsc-input').attr('placeholder', 'Wonach suchen Sie?');
438//                 }, 500);
439//                 $('.google-search-wrapper .open-cookie-optin-wrapper').removeClass('d-flex').hide();
440//                 $('.cookie-optin-text').hide();
441//             }
442//         }
443//     });
444//
445//     setTimeout(function () {
446//         $('input.gsc-input').attr('placeholder', 'Wonach suchen Sie?');
447//     }, 500);
448// }
449
450function googleSearchGdpr() {
451    // Function to load the Google Search script
452    function loadGoogleSearchScript() {
453        var googleSearchScript = document.getElementById('googleSearchScript');
454        var newScript = document.createElement('script');
455        newScript.src = googleSearchScript.getAttribute('src');
456        newScript.type = 'text/javascript';
457        document.body.appendChild(newScript);
458    }
459
460    // Function to handle the display of Google Search elements
461    function handleGoogleSearchDisplay(cookieOptin) {
462        if (cookieOptin.indexOf('google-search:0') >= 0) {
463            // Search disabled
464            $('.google-search-wrapper .open-cookie-optin-wrapper').addClass('d-flex');
465        } else if (cookieOptin.indexOf('google-search:1') >= 0) {
466            // Search enabled
467            loadGoogleSearchScript();
468            $('.google-search-wrapper .open-cookie-optin-wrapper').removeClass('d-flex').hide();
469            $('.cookie-optin-text').hide();
470            waitForElement('input.gsc-input', function () {
471                $('input.gsc-input').attr('placeholder', 'Wonach suchen Sie?');
472            });
473        }
474    }
475
476    // Function to wait for an element to be available in the DOM
477    function waitForElement(selector, callback) {
478        if ($(selector).length) {
479            callback();
480        } else {
481            setTimeout(function () {
482                waitForElement(selector, callback);
483            }, 100);
484        }
485    }
486
487    var cookieOptin = Cookies.get('cookie_optin');
488    if (cookieOptin) {
489        handleGoogleSearchDisplay(cookieOptin);
490
491        // Load & parse the SG Cookie Opt‑in JSON
492        var dataEl = document.getElementById('cookieOptinData');
493        var hasGoogleGroup = false;
494        if (dataEl) {
495            try {
496                var cfg = JSON.parse(dataEl.textContent);
497                hasGoogleGroup = Array.isArray(cfg.cookieGroups) &&
498                    cfg.cookieGroups.some(function (g) {
499                        return g.groupName === 'google-search';
500                    });
501            } catch (e) {
502                // malformed JSON? assume no group
503                console.warn('Failed to parse cookieOptinData JSON', e);
504            }
505        }
506
507        // Only reset & reopen if:
508        // 1) the cookie has no 'google-search' entry, AND
509        // 2) our JSON config actually declares a google-search group
510        if (
511            !cookieOptin.includes('google-search') &&
512            hasGoogleGroup
513        ) {
514            Cookies.remove('cookie_optin');
515            SgCookieOptin.openCookieOptin();
516        }
517    }
518
519    // Event listener for the click on the opt-in button
520    $(document).on('click', '.sg-cookie-optin-box-button button', function () {
521        var cookieOptin = Cookies.get('cookie_optin');
522        if (cookieOptin) {
523            handleGoogleSearchDisplay(cookieOptin);
524        }
525    });
526}
527
528
529function wcag() {
530    let font_active = false
531    let desaturate_active = false
532
533    $(".desaturate").click(function () {
534        $(this).toggleClass('active');
535        $('html').toggleClass('wcag-desaturate');
536
537        if (readCookie('desaturate') === 'true') {
538            desaturate_active = true;
539        } else {
540            desaturate_active = false;
541        }
542
543        if (desaturate_active == true) {
544            desaturate_active = false;
545            createCookie('desaturate', 'false', 7);
546        } else {
547            desaturate_active = true;
548            createCookie('desaturate', 'true', 7);
549        }
550    });
551
552    $(".bigger-font").click(function () {
553        $(this).toggleClass('active');
554        $('html').toggleClass('wcag-bigger-font');
555
556        if (readCookie('bigger-font') === 'true') {
557            font_active = true;
558        } else {
559            font_active = false;
560        }
561
562        if (font_active == true) {
563            font_active = false;
564            createCookie('bigger-font', 'false', 7);
565        } else {
566            font_active = true;
567            createCookie('bigger-font', 'true', 7);
568        }
569    });
570
571    if (readCookie('bigger-font') === 'true') {
572        $(".bigger-font").toggleClass('active');
573        $('html').toggleClass('wcag-bigger-font');
574
575        font_active = true;
576    }
577
578    if (readCookie('desaturate') === 'true') {
579        $(".desaturate").toggleClass('active');
580        $('html').toggleClass('wcag-desaturate');
581
582        desaturate_active = true;
583    }
584}
585
586function readCookie(name) {
587    var nameEQ = name + "=";
588    var ca = document.cookie.split(';');
589    for (var i = 0; i < ca.length; i++) {
590        var c = ca[i];
591        while (c.charAt(0) === ' ') c = c.substring(1, c.length);
592        if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
593    }
594    return null;
595}
596
597function createCookie(name, value, days) {
598    var expires = "";
599    if (days) {
600        var date = new Date();
601        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
602        expires = "; expires=" + date.toUTCString();
603    }
604    document.cookie = name + "=" + value + expires + "; path=/";
605}
606
607function sgCookieYouTubePreviewImage() {
608    // select all elements with class "co-embed-video"
609    const videoEmbedEls = document.querySelectorAll('.co-embed-video');
610
611    videoEmbedEls.forEach(videoEl => {
612        // find element with class "preview-image" inside current video element
613        const ytPreviewImageEl = videoEl.querySelector('.preview-image');
614
615        if (ytPreviewImageEl) {
616            // get data-bg attribute value
617            const ytPreviewImageUrl = ytPreviewImageEl.dataset.bg;
618
619            // find iframe consent element
620            const iframeConsentEl = videoEl.querySelector('.sg-cookie-optin-iframe-consent');
621
622            if (iframeConsentEl) {
623                console.log(`url:("${ytPreviewImageUrl}")`);
624                // set background-image style
625                iframeConsentEl.style.backgroundImage = `url("${ytPreviewImageUrl}")`;
626            }
627        }
628    });
629}

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.