PageSourceSearch

https://www.cfea.com/wp-content/themes/cfea-webosmotic/assets/js/main.js?1791398566&ver=1.0.0

js cfea.com collected 2026-10-07 18:43:38 UTC 6,778 bytes, 200 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3        // Search open
4        jQuery('.cfea_search').on('click', function () {
5            jQuery('.cfea_search_input_wrapper').slideDown(200);
6            jQuery('.cfea_search_input_wrapper input').focus();
7        });
8
9         jQuery('.cfea_nav .main-menu .menu-item-has-children').on('click', function (e) {
10                const $parent = jQuery(this); // .menu-item-has-children
11                const $submenu = $parent.find('.sub-menu').first();
12
13                // Toggle active class
14                $parent.toggleClass('active_dropdwon');
15
16                // Toggle submenu
17                $submenu.slideToggle(200);
18        });
19
20        jQuery('.ww_search_trigger').on('click', function(e) {
21            e.preventDefault(); // prevent default action if it's a button or link
22
23            var search = jQuery('.cfea_search_input_wrapper input').val().trim();
24            if (search !== '') {
25                var newUrl = window.location.origin + '/?s=' + encodeURIComponent(search);
26                window.location.href = newUrl;
27            }
28        });
29
30        jQuery('.cfea_search_input_wrapper input').on('keydown', function(e) {
31           
32            if (e.key === 'Enter' || e.keyCode === 13) {
33                console.log('haha');
34                var search = jQuery(this).val().trim();
35                if (search !== '') {
36                    var newUrl = window.location.origin + '/?s=' + encodeURIComponent(search);
37                    window.location.href = newUrl;
38                }
39            }
40        });
41
42        // Search close
43        jQuery('.cfea_search_close').on('click', function () {
44            jQuery('.cfea_search_input_wrapper').slideUp(200);
45        });
46
47        // Sidebar open
48        jQuery('.cfea_hamburger').on('click', function () {
49            jQuery('.cfea_nav').addClass('active');
50            jQuery('body').addClass('body_active');
51        });
52
53        // Sidebar close
54        jQuery('.cfea_sidebar_close').on('click', function () {
55            jQuery('.cfea_nav').removeClass('active');
56                jQuery('body').removeClass('body_active');
57        });
58
59        jQuery(window).on('scroll', function () {
60            if (jQuery(window).scrollTop() > 60) {
61                jQuery('.cfea_header').addClass('cfea_header_active');
62                jQuery('.cfea_search_input_wrapper').addClass('active_search');
63            } else {
64                jQuery('.cfea_header').removeClass('cfea_header_active');
65                jQuery('.cfea_search_input_wrapper').removeClass('active_search');
66            }
67        });
68
69
70    // Counter animation logic
71    let hasAnimated = false;
72
73    function counterUp($el, target) {
74        let count = 0;
75        let speed = 20; // smaller = faster
76        let increment = Math.ceil(target / 50);
77
78        function updateCounter() {
79            count += increment;
80            if (count >= target) {
81                $el.text(target + "+");
82            } else {
83                $el.text(count);
84                requestAnimationFrame(updateCounter);
85            }
86        }
87
88        updateCounter();
89    }
90
91    if ($('.cfea_stats').length) {
92        let observer = new IntersectionObserver((entries, observer) => {
93            entries.forEach(entry => {
94                if (entry.isIntersecting && !hasAnimated) {
95                    $('.count').each(function () {
96                        let target = parseInt($(this).data('number'));
97                        counterUp($(this), target);
98                    });
99                    hasAnimated = true;
100                    observer.unobserve(entry.target);
101                }
102            });
103        }, { threshold: 0.5 });
104
105        observer.observe(document.querySelector('.cfea_stats'));
106    }
107    if ($('.cfea-accordion-toggle').length) {
108        $('.cfea-accordion-toggle').on('click', function () {
109            var $button = $(this);
110            var $parent = $button.closest('.cfea-accordion-item');
111            var contentId = $button.attr('aria-controls');
112            var $content = $('#' + contentId);
113            var isExpanded = $button.attr('aria-expanded') === 'true';
114
115            // Collapse all others
116            $('.cfea-accordion-item').removeClass('active');
117            $('.cfea-accordion-toggle').attr('aria-expanded', 'false');
118            $('.cfea-accordion-content').attr('hidden', true);
119
120            // Expand only if it was not already expanded
121            if (!isExpanded) {
122                $parent.addClass('active');
123                $button.attr('aria-expanded', 'true');
124                $content.attr('hidden', false);
125            }
126        });
127    }
128    
129    // Swiper Sliders Initialization with element check
130    if ($('.cfea_social_slider').length) {
131        new Swiper('.cfea_social_slider', {
132            slidesPerView: 4,
133            spaceBetween: 0,
134            loop: true,
135            speed: 4000,
136            autoplay: {
137                delay: 0,
138                disableOnInteraction: false,
139            },
140            allowTouchMove: false,
141            breakpoints: {
142                0: { slidesPerView: 2 },
143                768: { slidesPerView: 2 },
144                1024: { slidesPerView: 3 },
145                1440: { slidesPerView: 4 }
146            }
147        });
148    }
149    $('.main-menu li.menu-item.menu-item-has-children').hover(
150        function() {
151            $(this).addClass('active-parent').parents('li.menu-item').addClass('active-parent');
152        },
153        function() {
154            $(this).removeClass('active-parent').parents('li.menu-item').removeClass('active-parent');
155        }
156    );
157    if ($('.cfea_testimonials-slider').length) {
158        new Swiper('.cfea_testimonials-slider', {
159            spaceBetween: 30,
160            navigation: {
161                nextEl: ".cfea_next",
162                prevEl: ".cfea_prev",
163            },
164            pagination: {
165                el: ".swiper-pagination",
166                clickable: true,
167            },
168            loop: false,
169        });
170    }
171
172    if ($('.cfea_members-slider').length) {
173        new Swiper('.cfea_members-slider', {
174            slidesPerView: "auto",
175            spaceBetween: 30,
176            loop: true,
177            speed: 4000,
178            autoplay: {
179                delay: 0,
180                disableOnInteraction: false,
181            },
182            allowTouchMove: false,
183            centeredSlides: true,
184        });
185    }
186
187    if ($('.cfea_about-slider').length) {
188        new Swiper('.cfea_about-slider', {
189            effect: 'fade',
190            loop: true,
191            autoplay: {
192                delay: 3000,
193                disableOnInteraction: false,
194            },
195            fadeEffect: {
196                crossFade: true,
197            },
198        });
199    }
200});

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.