PageSourceSearch

https://primariagaliceamare.ro/js/nav-menu.js

js primariagaliceamare.ro collected 2026-10-03 18:12:48 UTC 4,022 bytes, 100 lines download raw bytes

1(function ($) {
2    "use strict";
3    $.fn.menumaker = function (options) {
4
5        var nav = $(this),
6
7            settings = $.extend({
8                format: "dropdown",
9                sticky: false
10            }, options);
11
12        return this.each(function () {
13
14            $(this).find(".navbar-toggler").on('click', function () {
15                $(this).toggleClass('menu-opened');
16                var mainmenu = $(this).next('ul');
17                if (mainmenu.hasClass('open')) {
18                    mainmenu.slideToggle().removeClass('open');
19                } else {
20                    mainmenu.slideToggle().addClass('open');
21                    if (settings.format === "dropdown") {
22                        mainmenu.find('ul').show();
23                    }
24                }
25            });
26
27            nav.find('.navbar-nav li ul').parent().addClass('has-sub');
28            nav.find('.navbar-nav li ul li').parent().addClass('sub-menu');
29            var multiTg = function () {
30
31                // For First Level
32                nav.find(".has-sub").prepend('<span class="submenu-button"></span>');
33                nav.find('.navbar-nav > li.has-sub > .submenu-button').on('click', function () {
34                    $(this).next('.sub-menu').slideToggle();
35                    $(this).siblings('ul').addClass('open').slideToggle();
36                    $(this).parents('.navbar-nav > li.has-sub').toggleClass('active').siblings('.has-sub').children('.sub-menu').slideUp().removeClass('open').parents('li').removeClass('active');
37                });
38
39                // For Second Level
40                nav.find('.sub-menu > li.has-sub > .submenu-button').on('click', function () {
41                    $(this).next('.sub-menu').slideToggle();
42                    $(this).siblings('ul').addClass('open').slideToggle();
43                    $(this).parents('.sub-menu > li').toggleClass('active').siblings('.has-sub').children('.sub-menu').slideUp().removeClass('open').parents('li').removeClass('active');
44                    if ($(this).siblings('ul').hasClass('open')) {
45                        $(this).parents('li').eq(1).addClass('active');
46                    }
47                });
48
49            };
50
51            if (settings.format === 'multitoggle') multiTg();
52            else nav.addClass('dropdown');
53            if (settings.sticky === true) nav.css('position', 'fixed');
54            var resizeFix = function () {
55                var mediasize = 991;
56                if ($(window).width() > mediasize) {
57                    nav.find('ul').show();
58                }
59            };
60
61            resizeFix();
62            return $(window).on('resize', resizeFix);
63
64        });
65    };
66
67    $(document).ready(function () {
68
69        $("nav").menumaker({
70            format: "multitoggle"
71        });
72
73        /*------------------------------------
74            Menu Selector
75        --------------------------------------*/
76
77        var urlparam = window.location.pathname.split('/');
78        var menuselctor = window.location.pathname;
79        if (urlparam[urlparam.length - 1].length > 0) menuselctor = urlparam[urlparam.length - 1];
80        else menuselctor = urlparam[urlparam.length - 2];
81        $('.navbar-nav li').find('a[href="' + menuselctor + '"]').closest('li').addClass('active').parents().eq(1).addClass('current');
82        $('.navbar-nav li.has-sub ul li').find('a[href="' + menuselctor + '"]').parents().eq(4).addClass('current');
83    });
84
85    /*------------------------------------
86            Toggle Search
87    --------------------------------------*/
88
89    $(".navbar-default .attr-nav").each(function () {
90        $("li.search > a", this).on("click", function (e) {
91            e.preventDefault();
92            $(".top-search").slideToggle();
93        });
94    });
95
96    $(".input-group-addon.close-search").on("click", function () {
97        $(".top-search").slideUp();
98    });
99
100})(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.