PageSourceSearch

https://deve-lup.de/wp-content/themes/develup/js/functions.js?ver=20160412

js deve-lup.de collected 2026-10-04 08:18:41 UTC 9,889 bytes, 363 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function(event) {
2
3    const lightbox = GLightbox({
4        touchNavigation: true,
5        loop: true,
6        autoplayVideos: true,
7        selector: '.glightbox',
8        onOpen: () => {
9          document.querySelector('#site-wrapper')?.removeAttribute('aria-hidden');
10        }
11    });
12
13})
14
15jQuery(document).ready(function ($) {
16
17    // Global vars
18    var openmenu = false;
19
20
21
22
23
24    /* ---------------------------------------------------- */
25    /*  ScrollTop
26     /* ---------------------------------------------------- */
27    $(document).on('click', 'a[href^="#"]:not(._brlbs-btn)', function (event) {
28        event.preventDefault();
29
30        const target = $($.attr(this, 'href'));
31        const anchor = target.find('.anchor-point');
32        const scrollTarget = anchor.length ? anchor.offset().top : target.offset()?.top || 0;
33
34        $('html, body').animate({
35          scrollTop: scrollTarget
36        }, 500);
37    });
38    $('a.skip-link').on('click', function (event) {
39      event.preventDefault();
40    
41      const target = $($(this).attr('href'));
42      const offset = target.offset()?.top || 0;
43    
44      $('html, body').animate({
45        scrollTop: offset
46      }, 500, function () {
47        if (!target.is('a, input, button, textarea, select')) {
48          target.attr('tabindex', -1);
49        }
50        target.focus();
51      });
52    });
53
54
55
56    /* ---------------------------------------------------- */
57    /*  IntPopUp
58     /* ---------------------------------------------------- */
59
60    (function () {
61
62        var intPopUp = $('.int_popup_wrapper');
63
64        if( intPopUp.length != 0 ) {
65
66            var init_delay = intPopUp.attr('data-delay'); // Milliseconds
67            var init_once = intPopUp.attr('data-once');
68            console.log(init_once);
69            init_once = ( init_once == 'forget' ) ? true : false;
70
71            if( init_once ) {
72
73                console.log('popup again');
74
75                setTimeout(function(){
76                    intPopUp.addClass('is-visible');
77                }, init_delay);
78
79            } else {
80
81                console.log('popup once');
82
83                var ckie = getCookie('int_cookie');
84                if (!ckie) {
85
86                    setCookie('int_cookie','popup',7);
87
88                    setTimeout(function(){
89                        intPopUp.addClass('is-visible');
90                    }, init_delay);
91
92                }
93
94            }
95
96            intPopUp.find('.int_popup-close').on('click', function(event){
97                event.preventDefault();
98                intPopUp.removeClass('is-visible');
99            });
100
101        }
102
103        function setCookie(name,value,days) {
104            var expires = "";
105            if (days) {
106                var date = new Date();
107                date.setTime(date.getTime() + (days*24*60*60*1000));
108                expires = "; expires=" + date.toUTCString();
109            }
110            document.cookie = name + "=" + (value || "")  + expires + "; path=/";
111        }
112        function getCookie(name) {
113            var nameEQ = name + "=";
114            var ca = document.cookie.split(';');
115            for(var i=0;i < ca.length;i++) {
116                var c = ca[i];
117                while (c.charAt(0)==' ') c = c.substring(1,c.length);
118                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
119            }
120            return null;
121        }
122        function eraseCookie(name) {
123            document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
124        }
125
126    })();
127
128    /* close IntPopUp */
129
130
131
132    /* ---------------------------------------------------- */
133    /*  Sticky Header
134     /* ---------------------------------------------------- */
135
136    (function () {
137
138        var sticky = $('.sticky-header');
139
140        if( sticky.length != 0 ) {
141
142            var stickyIniTop = 200;
143            var stickyNavTop = 600;
144
145            var lastScrollTop = 0;
146
147            var stickyNav = function(){
148                var scrollTop = $(window).scrollTop();
149
150                var st = $(window).scrollTop();
151
152                if (st > lastScrollTop){
153
154                    $("body").addClass('scroll-down');
155
156                } else {
157
158                    $("body").removeClass('scroll-down');
159
160                }
161                lastScrollTop = st;
162
163                if(scrollTop > stickyIniTop) {
164
165                    $("body").addClass('sticky-init');
166
167                } else {
168
169                    $("body").removeClass('sticky-init');
170
171                }
172
173                if (scrollTop > stickyNavTop) {
174
175                    $("body").addClass('sticky');
176
177                } else {
178                    $("body").removeClass('sticky');
179
180                }
181
182            };
183
184            stickyNav();
185
186            $(window).scroll(function() {
187
188                stickyNav();
189
190            });
191
192        }
193
194    })();
195
196    /* close Sticky Header */
197
198
199
200    /* ---------------------------------------------------- */
201    /*  Mobile Navigation
202     /* ---------------------------------------------------- */
203
204    (function () {
205      const $toggle = $("#toggle-mobile-menu");
206      const $menu = $("#mobile-navigation");
207      const $menuLinks = $menu.find('a, button, input, [tabindex]'); // Alle fokussierbaren Elemente
208
209      let openmenu = false;
210
211      function setMenuAccessibility(state) {
212          if (state) {
213              $menu.attr("aria-hidden", "false");
214              $menuLinks.removeAttr("tabindex");
215          } else {
216              $menu.attr("aria-hidden", "true");
217              $menuLinks.attr("tabindex", "-1");
218          }
219      }
220
221      $toggle.on('click', function () {
222          const body = $("body");
223
224          openmenu = !openmenu;
225          body.toggleClass("openmenu", openmenu);
226
227          setMenuAccessibility(openmenu);
228      });
229
230      $("#mobile-bg").on('click', function () {
231          if (openmenu) {
232              openmenu = false;
233              $("body").removeClass("openmenu");
234              setMenuAccessibility(false);
235          }
236      });
237
238      $menu.on('focusout', function () {
239        // Verzögert prüfen, wohin der Fokus als Nächstes geht
240        setTimeout(function () {
241            const focused = document.activeElement;
242            if (!$menu[0].contains(focused) && !$toggle[0].contains(focused)) {
243                // Fokus ist nicht mehr im Menü → Menü schließen
244                openmenu = false;
245                $("body").removeClass("openmenu");
246                setMenuAccessibility(false);
247            }
248        }, 10); // Kurz warten, bis neuer Fokus gesetzt ist
249      });
250
251      // Initialzustand sicherstellen
252      setMenuAccessibility(false);
253    })();
254
255    /* close Mobile Navigation */
256
257
258    /* ---------------------------------------------------- */
259    /*  Image Slider
260     /* ---------------------------------------------------- */
261
262    (function () {
263
264        $image_slider = $('.image-slider');
265
266        if( $image_slider.length ) {
267
268            imageSlider = new Swiper ($image_slider, {
269                effect: "slide",
270                slidesPerView: 1,
271                freeMode: false,
272                centeredSlides: true,
273                spaceBetween: 0,
274                loop: true,
275                autoplay: true,
276                simulateTouch: true,
277                paginationClickable: false,
278
279                breakpoints: {
280                    900: {
281                        slidesPerView: 2,
282                        spaceBetween: 20,
283                    },
284                },
285
286                // If we need pagination
287                /*
288                 pagination: {
289                 el: '.swiper-pagination',
290                 type: 'bullets',
291                 clickable: true,
292                 },
293                 */
294            });
295
296        }
297
298    })();
299
300
301
302    /* ---------------------------------------------------- */
303    /*  Accordion
304     /* ---------------------------------------------------- */
305
306    (function () {
307
308        var $Acc = $('.accordion');
309
310        if( $Acc.length ) {
311
312            $Acc.each(function() {
313
314                var $this = $(this);
315                var $header = $this.find('.card-header');
316                var $collapse = $this.find('.collapse');
317
318                $collapse.each(function() {
319                    var $this = $(this);
320                    var $cardbody = $this.find('.card-body');
321
322                    setTimeout(function(){
323                        bodyHeight = $cardbody.outerHeight();
324                        $this.css('max-height', bodyHeight);
325                    }, 100);
326                });
327
328
329                $header.on('click', function () {
330                    $head = $(this);
331
332                    open = ($head.parent().hasClass('open')) ? true : false;
333                    //$this.find('.card').removeClass("open");
334                    if(!open) {
335                        $head.parent().addClass("open");
336
337                        /*
338                        setTimeout(function(){
339                            $('html, body').animate({
340                                scrollTop: $head.offset().top - 130
341                            }, 500);
342                        }, 10);
343                        */
344                    } else {
345                        $head.parent().removeClass("open");
346                    }
347
348
349                });
350
351            });
352
353        }
354
355    })();
356
357    /* close Accordion */
358
359
360
361    // ##################################################################
362
363});

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.