PageSourceSearch

https://hgosteliag.ch/core/assets/64c74a2e91/assets/js/bsnav.min.js

js hgosteliag.ch collected 2026-10-04 22:35:34 UTC 13,785 bytes, 253 lines download raw bytes

1! function(n) {
2    "use strict";
3    var a = {
4        initialize: function() { this.event(), this.toggler(), this.dropdown(), this.sideMenu(), this.navbarSticky(), this.scrollspy() },
5        event: function() {},
6        toggler: function() {
7            n(".navbar-toggler").each(function() {
8                var a = n(this);
9                a.on("click", function() { a.toggleClass("active") }), n(window).resize(function() { n(".navbar-toggler").removeClass("active") })
10            })
11        },
12        dropdown: function() { n(".bsnav .nav-item.dropdown").on("mouseenter", function() { n(this).find("> .dropdown-menu").addClass("in") }).on("mouseleave", function() { n(this).find("> .dropdown-menu").removeClass("in") }) },
13        mobileMenu: function() {
14            n(".bsnav .navbar-mobile")[0] && n(".bsnav-mobile")[0] && (n(".bsnav .navbar-mobile").closest(".bsnav-dark")[0] && n(".bsnav-mobile .navbar").addClass("bsnav-dark"), n(".bsnav .navbar-mobile").closest(".bsnav-light")[0] && n(".bsnav-mobile .navbar").addClass("bsnav-dark"), n(".bsnav .navbar-mobile").each(function() {
15                var a = n(this).clone();
16                a.find(".dropdown").removeClass("dropdown"), a.appendTo(".bsnav-mobile .navbar")
17            }), n(".navbar-toggler").attr("data-target") || n(".navbar-toggler").on("click", function() { n(".bsnav-mobile").toggleClass("in") }), n(".bsnav-mobile .bsnav-mobile-overlay").on("click", function() { n(".bsnav-mobile").removeClass("in"), n(".navbar-toggler").removeClass("active") }), this.sideMenuNavigation(n(".bsnav-mobile")), n(window).resize(function() { n(".bsnav-mobile").removeClass("in") }))
18        },
19        sideMenu: function() { n(".bsnav-sidebar")[0] && (this.sideMenuNavigation(n(".bsnav-sidebar")), n(".bsnav-sidebar-left")[0] && n("body").addClass("bsnav-has-left-sidebar"), n(".bsnav-sidebar-right")[0] && n("body").addClass("bsnav-has-right-sidebar"), n(".bsnav-sidebar-condensed")[0] && n("body").addClass("bsnav-has-condensed-sidebar"), n(".bsnav-sidebar .nav-item > .dropdown-menu").parent().addClass("menu-item-has-children")) },
20        sideMenuNavigation: function(a) {
21            a.find(".nav-link").each(function() {
22                var link = n(this);
23                var dropdownMenu = link.next(".dropdown-menu");
24                var menuIndicator = link.find('.menu-indicator');
25        
26                if (dropdownMenu.length > 0) {
27                    if (link.parent().hasClass("menu-item-has-children")) {
28                        // Add a span element to the link
29                        link.append('<span class="menu-indicator"></span>');
30        
31                        // Update menuIndicator reference
32                        menuIndicator = link.find('.menu-indicator');
33        
34                        // Click event for menu-indicator
35                        menuIndicator.on("click", function(s) {
36                            s.preventDefault(); // Prevent default behavior for menu-indicator
37        
38                            if (link.parent().hasClass("in")) {
39                                link.parent().removeClass("in");
40                                link.parent().find(".in").removeClass("in");
41                                dropdownMenu.stop(!0).slideUp(300);
42                            } else {
43                                link.closest(".in")[0] || (a.find(".nav-item.in .dropdown-menu").stop(!0).slideUp(300), a.find(".nav-item.in").removeClass("in"));
44                                link.parent().addClass("in");
45                                link.parent().siblings(".in").find(".dropdown-menu").stop(!0).slideUp(300);
46                                link.parent().siblings(".in").removeClass("in");
47                                dropdownMenu.stop(!0).slideDown(300);
48                            }
49                        });
50        
51                        // Click event for .nav-link
52                        link.on("click", function(s) {
53                            if (!n(s.target).is(menuIndicator)) {
54                                // Allow the default behavior only if the click target is not the menu-indicator
55                                return true;
56                            }
57                            s.preventDefault(); // Prevent default behavior only if the click target is not the menu-indicator
58                        });
59                    }
60                }
61            });
62        }, 
63        
64        navbarSticky: function() {
65            var a = function(n, a, s) { s > a && n.addClass("sticked"), s >
65 a + 30 && n.addClass("in"), 0 == s && n.removeClass("sticked").removeClass("in") };
66            if (n(".bsnav-sticky")[0]) {
67                var s = n(".bsnav-sticky").outerHeight(),
68                    i = n(window).scrollTop();
69                a(n(".bsnav-sticky"), s, i), n(window).on("scroll", function() { i = n(window).scrollTop(), a(n(".bsnav-sticky"), s, i) })
70            }
71        },
72        scrollspy: function() {
73            var a = n(".bsnav-scrollspy"),
74                s = a.outerHeight(),
75                i = [];
76            if (a.length) {
77                a.find("[data-scrollspy]").each(function(a) { i.push(n(this).data("scrollspy")) }), n(window).scroll(function() {
78                    ! function() {
79                        if (!a.hasClass("spying")) {
80                            var e = n(window).scrollTop();
81                            i.map(function(i, o) {
82                                var t = n("#" + i).offset().top - s,
83                                    l = t + n("#" + i).outerHeight();
84                                e >= t && e <= l && (a.find(".nav-item").removeClass("active"), n("[data-scrollspy=" + i + "]").parent().addClass("active"))
85                            })
86                        }
87                    }()
88                }), a.find("[data-scrollspy]").click(function(i) {
89                    i.preventDefault(), a.addClass("spying");
90                    var e = n(this).data("scrollspy");
91                    a.find(".nav-item").removeClass("active"), n(this).parent().addClass("active"), n("html,body").animate({ scrollTop: n("#" + e).offset().top - s }, 800, function() { a.removeClass("spying") })
92                })
93            }
94        }
95    };
96    n(document).ready(function() { a.initialize() }), n(window).on("load", function() { a.mobileMenu() })
97}(jQuery);
98
99
100// Custom Mobile Menu JavaScript
101// Add this to your main JS file or create a separate file
102 /**
103 * Custom Mobile Menu JavaScript
104 * Fixed: header_area and sticky_header_area are fully independent.
105 * Each toggle button only controls the mobile menu inside its own header wrapper.
106 *
107 * Wrapper containers: .header_area  /  .sticky_header_area
108 */
109
110jQuery(document).ready(function ($) {
111    'use strict';
112
113    // ─── Shared close helper ────────────────────────────────────────────────
114    // Closes the mobile menu that lives inside `$wrapper` only.
115    function closeMobileMenuIn($wrapper) {
116        $wrapper.find('.custom-mobile-toggle').removeClass('active');
117        $wrapper.find('.custom-mobile-menu').removeClass('active');
118        $('body').removeClass('mobile-menu-open').css('overflow', '');
119    }
120
121    // ─── Boot one menu instance per header wrapper ──────────────────────────
122    var $wrappers = $('.header_area, .sticky_header_area');
123
124    $wrappers.each(function () {
125        var $wrapper = $(this);
126
127        var $toggle  = $wrapper.find('.custom-mobile-toggle');
128        var $menu    = $wrapper.find('.custom-mobile-menu');
129        var $close   = $wrapper.find('.custom-mobile-close');
130        var $overlay = $wrapper.find('.custom-mobile-overlay');
131
132        // Nothing to do if this wrapper has no mobile menu
133        if (!$menu.length) { return; }
134
135        // ── Open ────────────────────────────────────────────────────────────
136        $toggle.on('click', function (e) {
137            e.preventDefault();
138            $(this).addClass('active');
139            $menu.addClass('active');
140            $('body').addClass('mobile-menu-open').css('overflow', 'hidden');
141        });
142
143        // ── Close: button ───────────────────────────────────────────────────
144        $close.on('click', function (e) {
145            e.preventDefault();
146            closeMobileMenuIn($wrapper);
147        });
148
149        // ── Close: overlay ──────────────────────────────────────────────────
150        $overlay.on('click', function (e) {
151            e.preventDefault();
152            closeMobileMenuIn($wrapper);
153        });
154
155        // ── Close: Escape key ───────────────────────────────────────────────
156        // Use a namespaced event so each wrapper binds independently
157        $(document).on('keydown.mobileMenu', function (e) {
158            if (e.keyCode === 27 && $menu.hasClass('active')) {
159                closeMobileMenuIn($wrapper);
160            }
161        });
162
163        // ── Close: desktop resize ───────────────────────────────────────────
164        $(window).on('resize.mobileMenu', function () {
165            if ($(window).width() > 991) {
166                closeMobileMenuIn($wrapper);
167            }
168        });
169
170        // ── Dropdown: scoped to THIS panel ──────────────────────────────────
171        // Iterating each panel inside this wrapper (supports multiple panels).
172        $wrapper.find('.custom-mobile-panel').each(function () {
173            var $panel = $(this);
174
175            $panel.find('.menu-item-has-children > a').on('click', function (e) {
176                e.preventDefault();
177                e.stopPropagation();
178
179                var $parentLi       = $(this).parent();
180                var $dropdown       = $parentLi.find('> .dropdown-menu');
181                var isCurrentlyOpen = $parentLi.hasClass('active');
182
183                // Close all other open items inside THIS panel
184                $panel.find('.menu-item-has-children').not($parentLi).removeClass('active');
185                $panel.find('.menu-item-has-children > .dropdown-menu').not($dropdown).slideUp(300);
186
187                // Toggle current item
188                if (isCurrentlyOpen) {
189                    $parentLi.removeClass('active');
190                    $dropdown.slideUp(300);
191                } else {
192                    $parentLi.addClass('active');
193                    $dropdown.slideDown(300);
194                }
195            });
196
197            // Close menu when a leaf link is tapped
198            $panel.find('.dropdown-menu a').on('click', function () {
199                setTimeout(function () { closeMobileMenuIn($wrapper); }, 100);
200            });
201
202            // Close menu when a plain top-level link is tapped
203            $panel.find('.mobile-nav-menu > li > a')
204                .not('.menu-item-has-children > a')
205                .on('click', function () {
206                    setTimeout(function () { closeMobileMenuIn($wrapper); }, 100);
207                });
208        });
209
210        // ── Smooth scroll for in-page anchors ────────────────────────────────
211        $wrapper.find('.custom-mobile-panel a[href^="#"]').on('click', function (e) {
212            var target = $(this).attr('href');
213            if (target !== '#' && $(target).length) {
214                e.preventDefault();
215                closeMobileMenuIn($wrapper);
216                $('html, body').animate({ scrollTop: $(target).offset().top - 100 }, 800);
217            }
218        });
219
220        // ── Stagger animations ───────────────────────────────────────────────
221        $wrapper.find('.custom-mobile-panel .mobile-nav-menu li').each(function (i) {
222            $(this).css('animation-delay', (i * 0.1) + 's');
223        });
224        $wrapper.find('.custom-mobile-panel .contact-item').each(function (i) {
225            $(this).css('animation-delay', (0.5 + i * 0.1) + 's');
226        });
227        $wrapper.find('.custom-mobile-panel .mobile-social-media').css('animation-delay', '1s');
228    });
229
230}); // end document.ready
231
232
233// ─── Global utility functions (unchanged public API) ────────────────────────
234(function ($) {
235    'use strict';
236
237    window.isMobileMenuOpen = function () {
238        return $('.custom-mobile-menu').hasClass('active');
239    };
240
241    window.closeMobileMenu = function () {
242        $('.custom-mobile-toggle').removeClass('active');
243        $('.custom-mobile-menu').removeClass('active');
244        $('body').removeClass('mobile-menu-open').css('overflow', '');
245    };
246
247    window.openMobileMenu = function () {
248        $('.custom-mobile-toggle').addClass('active');
249        $('.custom-mobile-menu').addClass('active');
250        $('body').addClass('mobile-menu-open').css('overflow', 'hidden');
251    };
252
253})(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.