PageSourceSearch

https://avonexpert.pl/wp-content/plugins/wpb-accordion-menu-or-category/assets/js/accordion-init.js?ver=1.0

js avonexpert.pl collected 2026-10-08 12:04:14 UTC 4,732 bytes, 137 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    /**
5     * Navgoco Init Function
6     */
7    function wpbInitNavgoco($wrapper) {
8        $wrapper.each(function () {
9            var $this = $(this);
10
11            // Prevent Double Init
12            if ($this.hasClass("navgoco-initialized")) {
13                return;
14            }
15
16            var accordion = $this.data("accordion"),
17                indicator_icon = $this.data("indicator_icon"),
18                iconclass = $this.data("iconclass"),
19                caretHtml = iconclass
20                    ? '<i class="' + iconclass + '"></i>'
21                    : indicator_icon;
22
23            $this.find(".wpb_category_n_menu_accordion_list").navgoco({
24                caretHtml: caretHtml,
25                accordion: accordion,
26                openClass: "wpb-submenu-indicator-minus",
27                save: true,
28                cookie: {
29                    name: "navgoco",
30                    expires: false,
31                    path: "/",
32                },
33                slide: {
34                    duration: 400,
35                    easing: "swing",
36                },
37            });
38
39            $this.addClass("navgoco-initialized");
40        });
41    }
42
43    /**
44     * Global Init for Non-Elementor Popup Menus
45     */
46    wpbInitNavgoco(
47        $(".wpb_category_n_menu_accordion").filter(function () {
48            return (
49                $(this).closest(".wpb-wamc-elementor-widget-show-in-popup")
50                    .length === 0
51            );
52        })
53    );
54
55    /**
56     * Elementor Specific Init
57     */
58    var WPB_Accordion_Menu_Elementor = function ($scope, $) {
59        var $wrapper = $scope.find(".wpb_category_n_menu_accordion");
60
61        wpbInitNavgoco($wrapper);
62
63        $(".wpb-submenu-indicator").click(function (e) {
64            e.preventDefault();
65        });
66    };
67
68    $(window).on("elementor/frontend/init", function () {
69        elementorFrontend.hooks.addAction(
70            "frontend/element_ready/wpb-accordion-categories.default",
71            WPB_Accordion_Menu_Elementor
72        );
73        elementorFrontend.hooks.addAction(
74            "frontend/element_ready/wpb-accordion-menu.default",
75            WPB_Accordion_Menu_Elementor
76        );
77        elementorFrontend.hooks.addAction(
78            "frontend/element_ready/wpb-accordion-menu-or-category-pro.default",
79            WPB_Accordion_Menu_Elementor
80        );
81    });
82
83    /**
84     * Keyboard Accessibility
85     */
86
87    $('document').ready(function(){
88        // Adding the focus class to the parest li
89        $( '.wpb_wmca_keyboard_accessibility_yes a' ).on( 'focus', function(){
90            $( '.wpb_wmca_keyboard_accessibility_yes li' ).removeClass( 'wpb-wmca-focus' );
91            $(this).closest( 'li' ).addClass( 'wpb-wmca-focus' );
92        } );
93
94        $(window).click(function() {
95            //remove the focus is click outside
96            $( '.wpb_wmca_keyboard_accessibility_yes li' ).removeClass( 'wpb-wmca-focus' );
97            $( '.wpb_wmca_keyboard_accessibility_yes' ).removeClass( 'wpb_wmca_link_tabbed' );
98        });
99
100        // Opening and closing the accordion on keyboard enter
101        $('.wpb_wmca_keyboard_accessibility_yes').each(function(index){
102
103            const wrapper = $(this);
104            const link    = $(this).find('.cat-item-have-child > a, .menu-item-has-children > a');
105
106            $('.wpb_wmca_keyboard_accessibility_yes').keyup(function (e) {
107                wrapper.removeClass('wpb_wmca_link_tabbed');
108                if ( link.is(":focus") ) {
109                    wrapper.addClass('wpb_wmca_link_tabbed');
110                }else{
111                    wrapper.removeClass('wpb_wmca_link_tabbed');
112                }
113            });
114            
115            link.on( 'click', function( e ){
116                
117                var link       = $(this),
118                    closest_li = link.closest( 'li' ),
119                    child_ul   = closest_li.find('ul').first(),
120                    a_href     = link.attr('href'),
121                    wrapper     = link.closest('.wpb_wmca_keyboard_accessibility_yes');
122
123                    if ( a_href.indexOf('#') === -1 && wrapper.hasClass('wpb_wmca_link_tabbed') && closest_li.hasClass('wpb-wmca-focus') ) {
124                        e.preventDefault();
125
126                        if( child_ul.is(':hidden') ){
127                            child_ul.slideDown();
128                            closest_li.addClass('wpb-submenu-indicator-minus');
129                        }else{
130                            child_ul.slideUp();
131                            closest_li.removeClass('wpb-submenu-indicator-minus');
132                        }
133                    }   
134            });
135        });
136    });
137})(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.