PageSourceSearch

https://wfl-leverkusen.de/fileadmin/wflLeverkusen/Resources/Public/Scripts/common.js

js wfl-leverkusen.de collected 2026-10-04 04:04:57 UTC 19,685 bytes, 496 lines download raw bytes

1var matchHeightObj = null;
2(function ($) {
3    $(function () {
4        /** navigation */
5        var navbar = '#collapsibleNavbar', navToggle = '.navbar-toggle', winWidth = 0, winHeight = 0, banner = '#banner';
6        $(navbar + ' .ic-toggle').click(function () {
7            $(this).toggleClass('clicked');
8        });
9
10        $('.ic-angle-right').text('');
11
12        /* slider */
13        var owls = $('.owl-carousel');
14        if (owls.length > 0) {
15            owls.each(function () {
16                if ($(this).hasClass('owl-exclude')) {
17
18                    var options = {
19                        margin: 12,
20                        loop: false,
21                        dots: true,
22                        nav: false,
23                        smartSpeed: 1000,
24                        autoplay: false,
25                        autoplayTimeout: 8000,
26                        responsive: {
27                            0: {
28                                items: 1
29                            },
30                            767: {
31                                items: 2
32                            },
33                            1280: {
34                                items: 3
35                            }
36                        }
37                    };
38                    if ($(this).attr('id') == 'owl-logos') {
39                        options.dots = false;
40                        options.autoplay = true;
41                        options.loop = true;
42                        options.nav = true;
43                        options.navText = ['<i class="material-icons"></i>', '<i class="material-icons"></i>'];
44                        options.responsive = {
45                            0: {
46                                items: 2
47                            },
48                            767: {
49                                items: 4
50                            },
51                            1280: {
52                                items: 6
53                            }
54                        };
55                    }
56
57                    if ($(this).attr('id') == 'owl-image-teasers') {
58                        options.dots = false;
59                        options.nav = true;
60                        options.navText = ['<i class="material-icons fa fa-angle-left" aria-hidden="true"></i>', '<i class="material-icons fa fa-angle-right" aria-hidden="true"></i>'];
61                        options.responsive = {
62                            0: {
63                                items: 1
64                            },
65                            767: {
66                                items: 2
67                            },
68                            1280: {
69                                items: 4
70                            }
71                        };
72                    }
73
74                    $(this).owlCarousel(options);
75                } else {
76                    $(this).owlCarousel({
77                        margin: 0,
78                        loop: true,
79                        dots: false,
80                        nav: true,
81                        navText: ['<i class="material-icons fa fa-angle-left" aria-hidden="true"></i>', '<i class="material-icons fa fa-angle-right" aria-hidden="true"></i>'],
82                        smartSpeed: 1000,
83                        autoplay: false,
84                        autoplayTimeout: 8000,
85                        lazyLoad: false,
86                        responsive: {
87                            0: {
88                                items: 1
89                            },
90                            600: {
91                                items: 1
92                            },
93                            1000: {
94                                items: 1
95                            }
96                        }
97                    });
98                }
99            })
100        }
101
102        var searchForm = '.search-form';
103        $(searchForm + ' > a').click(function (e) {
104            var $that = $(this);
105            if ($that.hasClass('open')) {
106                $that.next().removeClass('flipInY').fadeOut(function () {
107                    $that.removeClass('open');
108                });
109            } else {
110                $that.next().removeAttr('style').removeClass('hide').addClass('flipInY');
111                $that.next().find('.form-control').select();
112                $that.addClass('open');
113            }
114            return false;
115        });
116
117        $(searchForm + ' .closed').click(function (e) {
118            $(searchForm + ' > a').trigger('click');
119        });
120
121        var newsYear = '.news-menu-view';
122        if ($(newsYear).length) {
123            $(newsYear + '>ul>li').click(function (e) {
124                $(this).toggleClass('opened');
125            });
126            $(newsYear + '>ul>li a').click(function (e) {
127                e.preventDefault();
128                e.stopPropagation();
129                location.href = $(this).attr('href');
130            });
131        }
132
133        var st = '.scroll-top';
134        $(st).click(function (e) {
135            e.preventDefault();
136            $('html,body').stop(true, false).animate({
137                scrollTop: 0
138            }, 500);
139        });
140
141        var sn = '.scroll-next';
142        $(sn).click(function (e) {
143            e.preventDefault();
144            $('html,body').stop(true, false).animate({
145                scrollTop: $(banner).height() + 10
146            }, 500);
147        });
148
149        var links = ['.ic-external-arrow', '.ic-download-arrow'];
150        $.each(links, function (i, o) {
151            if ($(o).length) {
152                $('<span></span>').appendTo($(o));
153            }
154        });
155
156        var config = {
157            viewFactor: 0.15,
158            duration: 500,
159            distance: "4rem",
160            scale: 0.9,
161            afterReveal: function (domEl) {
162                if ($(domEl).find('.cols2-equals').length) {
163                    $.fn.matchHeight._update();
164                    matchHeightObj = $(domEl);
165                }
166
167                if ($(domEl).find('.news-list-wrapper').length === 1) {
168                    $.fn.matchHeight._update();
169                }
170                if ($(domEl).find('.news-list-wrapper').length === 2) {
171                    $(domEl).find('.news-list-wrapper').eq(0).find('.owl-item').height($(domEl).find('.news-list-wrapper').eq(1).height());
172                    if(winWidth < 992) {
173                        $('.news-list-view.owl-carousel .owl-item').css({height:''});
174                    }
175                }
176
177                if ($(domEl).find('[data-mh="cols2-column"]').length) {
178                    $.fn.matchHeight._update();
179                    $(domEl).find('[data-mh="cols2-column"]').css('overflow', 'hidden');
180                }
181                if($(domEl).find('.cols-3')) {
182                    syncImageCaption();
183                }
184            }
185        };
186        window.sr = new ScrollReveal(config);
187
188        $.fn.matchHeight._afterUpdate = function (event, groups) {
189            if (matchHeightObj != null) {
190                /*if (matchHeightObj.find('.tx-house').length) {
191                    var _houseWrap = matchHeightObj.find('.tx-house').parent().parent();
192                    _houseWrap.height(_houseWrap.height() - _houseWrap.next().find('p:last').height());
193                }*/
194            }
195            matchHeightObj = null;
196        };
197
198
199        /** jcarousel */
200        var jcarousel = $('.jcarousel');
201        jcarousel.on('jcarousel:reload jcarousel:create', function () {
202            var carousel = $(this),
203                width = carousel.innerWidth();
204            if (width >= 600) {
205                width = width / 4;
206            } else if (width >= 350) {
207                width = width / 3;
208            }
209            //carousel.jcarousel('items').css('width', Math.ceil(width) + 'px');
210        }).jcarousel({
211            wrap: 'circular'
212        });
213        $('.jcarousel-control-prev').jcarouselControl({
214            target: '-=1'
215        });
216        $('.jcarousel-control-next').jcarouselControl({
217            target: '+=1'
218        });
219
220        var houseItem = '.house-item';
221        if ($(houseItem).length > 0) {
222            var _r = Math.floor($(houseItem).length / 2);
223            $(houseItem).css('height', 'auto');
224            for (var i = 0; i < _r; i++) {
225                var _maxH = Math.max($(houseItem).eq(2 * i).height(), $(houseItem).eq(2 * i + 1).height());
226                $(houseItem).eq(2 * i).height(_maxH);
227                $(houseItem).eq(2 * i + 1).height(_maxH);
228            }
229        }
230
231        var block = {
232            reset: false,
233            viewOffset: {top: 64}
234        };
235        sr.reveal("#content > .section > div:not(.wrapper-arrow-top):not(.wrapper-arrow-bottom):not(.no-reveal)", block);
236
237        var count = function (options) {
238            var $this = $(this);
239            options = $.extend({}, options || {}, $this.data('countToOptions') || {});
240            $this.countTo(options);
241        };
242
243        var numberCount = '.number-counters';
244        if ($(numberCount).length) {
245            $(numberCount).appear(function () {
246                $('.counter-price').each(function () {
247                    $(this).data('countToOptions', {
248                        formatter: function (value, options) {
249                            return value.toFixed(options.decimals).replace(/\./g, ',');
250                        }
251                    });
252                });
253                $('.counter-pm').each(function () {
254                    $(this).data('countToOptions', {
255                        formatter: function (value, options) {
256                            return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, '.');
257                        }
258                    });
259                });
260
261                $(numberCount + " [data-to]").each(count);
262            });
263        }
264
265        /* faq */
266        var _faq = '.panel-group';
267        if ($(_faq).length > 0) {
268            $(_faq).each(function () {
269                $(this).find('.collapse').on('shown.bs.collapse', function () {
270                    $(this).find('.panel.open').removeClass('open');
271                    $(this).parent().addClass('open');
272                    $(this).prev().find('.fa').removeClass('fa-angle-down').addClass('fa-angle-up');
273                }).on('hidden.bs.collapse', function () {
274                    $(this).parent().removeClass('open');
275                    $(this).prev().find('.fa').removeClass('fa-angle-up').addClass('fa-angle-down');
276                });
277            });
278
279        }
280
281        $(navToggle).bind('click', function (e) {
282            console.log(winHeight);
283            if (winHeight) {
284                $(navbar).css({
285                    height: winHeight
286                });
287            }
288            $(this).toggleClass('collapsed');
289            $(navbar).toggleClass('collapsed in');
290        });
291
292
293        var syncWH = function () {
294            if (self.innerHeight) {// all except Explorer
295                winWidth = self.innerWidth;
296                winHeight = self.innerHeight;
297            } else if (document.documentElement && document.documentElement.clientHeight) {// Explorer 6 Strict Mode
298                winWidth = document.documentElement.clientWidth;
299                winHeight = document.documentElement.clientHeight;
300            } else if (document.body) {// other
301                winWidth = document.body.clientWidth;
302                winHeight = document.body.clientHeight;
303            }
304        };
305
306        var syncBanner = function () {
307            $('.body-bg-top').css('padding-top', $('header').outerHeight(true));
308            if ($(banner).length) {
309                if ($('#p429').length || $('#p428').length) {
310                    var lessHeight = winHeight - parseInt($('.navbar.navbar-top').outerHeight(true));
311                    $(banner).css({height: lessHeight + 'px'});
312                    if(winWidth > 640 && winWidth < 992) {
313                        var _boxes = $(banner + ' .teaser-box'),
314                            _h = _boxes.eq(0).height();
315                        _h = Math.max(_h, _boxes.eq(1).height());
316                        _h = Math.max(_h, _boxes.eq(2).height());
317
318                        _boxes.css({height: _h + 'px'});
319                    } else {
320                        $(banner + ' .teaser-box').css({height:''});
321                    }
322                }
323            }
324        };
325
326        var syncNews = function () {
327            if ($('.row .news-list-wrapper').length === 2) {
328                if (winWidth > 991) {
329                    $('.row .news-list-wrapper').eq(0).find('.owl-item').height($('.row .news-list-wrapper').eq(1).height());
330                } else {
331                    $('.news-list-view.owl-carousel .owl-item').css({height:''});
332                }
333            }
334        };
335
336        var syncImageCaption = function(){
337            if($('.cols-3').length) {
338                $('.cols-3 [data-mh="bg-column"]').children('a').css('height', 'auto');
339                if(winWidth > 767) {
340                    $('.cols-3').each(function(){
341                        var cols = $(this).find('[data-mh="bg-column"]');
342                        var _1col = cols.eq(1),
343                            _2col = cols.eq(2);
344                        if(_1col.children('a').height() > _2col.children('a').height()) {
345                            _2col.children('a').height(_1col.children('a').height());
346                        } else {
347                            _1col.children('a').height(_2col.children('a').height());
348                        }
349                    });
350                }
351            }
352        };
353
354
355        var syncHouseHeight = function() {
356            if ($(houseItem).length) {
357                $(houseItem).css('height', 'auto');
358                if(winWidth > 768) {
359                    var _r = Math.floor($(houseItem).length / 2);
360                    for (var i = 0; i < _r; i++) {
361                        var _maxH = Math.max($(houseItem).eq(2 * i).height(), $(houseItem).eq(2 * i + 1).height());
362                        $(houseItem).eq(2*i).height(_maxH);
363                        $(houseItem).eq(2*i+1).height(_maxH);
364                    }
365                }
366            }
367        };
368
369        var afterResizeWindow = (function () {
370            var timers = {};
371            return function (callback, ms, uniqueId) {
372                if (!uniqueId) {
373                    uniqueId = "Don't call this twice without a uniqueId";
374                }
375                if (timers[uniqueId]) {
376                    if (timers[uniqueId] % 5 === 0) {
377                        callback();
378                    }
379                    clearTimeout(timers[uniqueId]);
380                }
381                timers[uniqueId] = setTimeout(callback, ms);
382            };
383        })();
384
385        $(window).bind('resize', function () {
386            afterResizeWindow(function () {
387                syncWH();
388                syncImageCaption();
389                if (winWidth > 1170) {
390                    $(navbar).removeAttr('style');
391                }
392                syncNews();
393                syncBanner();
394                syncHouseHeight();
395            }, 200, 'after window resize');
396        }).bind('scroll', function (e) {
397        }).trigger('resize');
398
399        syncWH();
400        syncBanner();
401        syncNews();
402
403        if(winWidth < 992 && winWidth > 767) {
404            if($('.equals4').length) {
405                $('.equals4').each(function(){
406                    $(this).children().css({height:'auto'});
407                    if($(this).children().eq(0).height() > $(this).children().eq(1).heigth()) {
408                        $(this).children().eq(1).heigth($(this).children().eq(0).height());
409                    } else {
410                        $(this).children().eq(0).heigth($(this).children().eq(1).height());
411                    }
412                    if($(this).children().eq(2).height() > $(this).children().eq(3).heigth()) {
413                        $(this).children().eq(3).heigth($(this).children().eq(2).height());
414                    } else {
415                        $(this).children().eq(2).heigth($(this).children().eq(3).height());
416                    }
417                });
418            }
419        }
420    });
421
422    $(document).ready(function () {
423        var dataMH = '[data-mh]';
424        if ($(dataMH).length) {
425            $.fn.matchHeight._maintainScroll = true;
426            var columns2 = '.cols2-equals > .row > .col-xs-12' + dataMH;
427            if ($(columns2).length) {
428                $(columns2).each(function () {
429                    if ($(this).children('.frame').length === 1) {
430                        $(this).children('.frame').css({minHeight: '100%'});
431                    }
432                });
433            }
434        }
435
436        $('img').not($('#banner img')).each(function () {
437            if ($(this).attr('width') !== undefined) {
438                if($(this).hasClass('exc')) {
439                $(this).css({maxWidth: $(this).attr('width') + 'px'});
440                  $(this).css({width: $(this).attr('width') + 'px'});
441                } else if(!$(this).hasClass('excl')){
442                  $(this).css({maxWidth: $(this).attr('width') + 'px'});
443                  $(this).removeAttr('width');
444                }
445                $(this).removeAttr('height');
446            }
447        });
448
449
450        var _hash = location.hash;
451        var gotohash = function (hash) {
452
453            if (hash && $(hash).length) {
454                var _sTop = $(hash).offset().top - parseInt($('header.navbar').height(), 10) - 30;
455                $('html,body').stop().animate({
456                    scrollTop: _sTop
457                }, 500);
458                if ($(hash).hasClass('panel')) {
459                    if (!$(hash).hasClass('open')) {
460                        $(hash).parent().find('.panel.open').removeClass('open');
461                        $(hash).addClass('open');
462                        $(hash).find('.panel-title a').trigger('click');
463                    }
464                }
465            }
466        };
467        $(window).on('hashchange', function () {
468            gotohash(location.hash);
469        });
470        gotohash(_hash);
471        $('#navbar a').click(function (e) {
472            if ($(this).attr('href') != '#' && $(this).attr('href').indexOf('#') > -1) {
473                if ($(this).attr('href').split('#')[0] != location.href.split('#')[0]) {
474                    location.href = $(this).attr('href');
475                } else {
476                    var hash = '#' + $(this).attr('href').split('#')[1];
477                    if (location.hash == hash)
478                        return false;
479                    location.hash = hash;
480                    $(window).trigger('hashchange');
481                    e.preventDefault();
482                }
483
484            }
485        });
486    });
487
488    $(".accordion-header button").click(function() {
489        $(".accordion-item").delay(1000).removeClass('active');
490        $(".accordion-collapse").delay(1000).removeClass('show');
491        $(".accordion-button").delay(1000).addClass('collapsed');
492
493        $(this).parent().parent().toggleClass('active');
494        $(this).delay(1000).toggleClass('collapsed');
495    });
496})(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.