PageSourceSearch

https://lecafedigital.fr/wp-content/themes/edubin/assets/js/init.js?ver=9.5.14

js lecafedigital.fr collected 2026-10-07 04:21:25 UTC 11,820 bytes, 268 lines download raw bytes

1(function($) {
2    "use strict";
3    //===== Preloader
4    $(window).on('load', function(event) {
5        $('.preloader').delay(500).fadeOut(500);
6        $('#preloader_two').fadeOut();
7        $(".edubin_image_preloader").fadeOut("slow");
8    });
9    //===== Header Sticky & Headroom.js
10    jQuery(function($) {
11        var header = $(".header-get-sticky");
12        var topHeader = $(".tpc-header-top-bar");
13        var topHeaderHeight = topHeader.length ? topHeader.outerHeight() : 0;
14        var topHeaderHidden = false;
15        var stickyMode = typeof edubin_sticky_data !== 'undefined' ? edubin_sticky_data.mode : 'smart';
16        if (header.length) {
17            if (stickyMode === 'always') {
18                $(window).on("scroll", function() {
19                    var scrollTop = $(this).scrollTop();
20                    if (scrollTop > 100) {
21                        header.addClass("top-header-removed");
22                    } else {
23                        header.removeClass("top-header-removed");
24                    }
25                    if (scrollTop > topHeaderHeight && !topHeaderHidden) {
26                        topHeader.slideUp(200);
27                        topHeaderHidden = true;
28                    } else if (scrollTop === 0 && topHeaderHidden) {
29                        topHeader.slideDown(200);
30                        topHeaderHidden = false;
31                    }
32                });
33            } else if (stickyMode === 'smart') {
34                var options = {
35                    offset: {
36                        up: 100,
37                        down: 200
38                    },
39                    tolerance: {
40                        up: 5,
41                        down: 0
42                    },
43                    classes: {
44                        pinned: "headroom--pinned",
45                        unpinned: "headroom--unpinned",
46                        top: "headroom--top",
47                        notTop: "headroom--not-top"
48                    }
49                };
50                var myElement = document.querySelector(".header-get-sticky");
51                var headroom = new Headroom(myElement, options);
52                headroom.init();
53            }
54        }
55    });
56    //===== Login/Register Popup Modal
57    $('.tpc-login-register-popup-trigger').on('click', function(e) {
58        e.preventDefault();
59        $('.edubin-login-form-popup').toggleClass('login-popup-visible');
60        $('.edubin-login-popup-overlay').toggleClass('active');
61    });
62    const login_btn = document.querySelector(".login-item");
63    const register_btn = document.querySelector(".register-item");
64    $(".register-form").css("display", "none");
65    $(function() {
66        $('.login-item, #edubin-login-form-trigger').on('click', function() {
67            login_btn.classList.add("active");
68            $(".register-form").css("display", "none");
69            if (register_btn.classList.contains("active")) {
70                register_btn.classList.remove("active");
71                $(".login-form").removeAttr("style");
72            }
73        });
74        $('.register-item, #edubin-register-form-trigger').on('click', function() {
75            register_btn.classList.add("active");
76            $(".login-form").css("display", "none");
77            if (login_btn.classList.contains("active")) {
78                login_btn.classList.remove("active");
79                $(".register-form").removeAttr("style");
80            }
81        });
82    });
83    //===== Close Login/Register Modal on Click Outside
84    $('.edubin-custom-login-wrapper').on('click', function() {
85        console.log("clicked");
86    });
87    //===== Close Login Modal on Close Button Click
88    $('.edubin-login-popup-close .close-trigger').on('click', function() {
89        $('.edubin-login-form-popup').removeClass('login-popup-visible');
90        $('.edubin-login-popup-overlay').removeClass('active');
91    });
92    //===== Course Filter Auto Select
93    $('.edubin-course-filtering input').on('change', function() {
94        $('.edubin-course-filtering').submit();
95    });
96    //===== Course Filter shorting 
97    $(document).ready(function() {
98        $('.course-orderby').on('change', function() {
99            $('.course-top-filter').submit();
100        });
101    });
102    //===== Mobile Menu
103    $('.edubin-mobile-hamburger-menu > a').on('click', function(e) {
104        e.preventDefault(); // Prevent page scroll
105        $(this).toggleClass('edubin-mobile-menu-close--active');
106        $(".edubin-mobile-menu-nav-wrapper").toggleClass('edubin-mobile-menu-visible');
107        $('body').toggleClass('edubin-mobile-menu-active');
108    });
109    $('.edubin-mobile-menu-close > a').on('click', function(e) {
110        e.preventDefault();
111        $('.edubin-mobile-hamburger-menu > a').removeClass('edubin-mobile-menu-close--active');
112        $('.edubin-mobile-menu-nav-wrapper').removeClass('edubin-mobile-menu-visible');
113        $('body').removeClass('edubin-mobile-menu-active');
114    });
115    $('.edubin-mobile-menu-overlay').on('click', function(e) {
116        e.preventDefault();
117        $('.edubin-mobile-hamburger-menu > a').removeClass('edubin-mobile-menu-close--active');
118        $('.edubin-mobile-menu-nav-wrapper').removeClass('edubin-mobile-menu-visible');
119        $('body').removeClass('edubin-mobile-menu-active');
120    });
121    //===== Accordion Menu for Mobile
122    $.fn.extend({
123        accordionMenu: function(options) {
124            var defaults = {
125                speed: 400
126            };
127            var options = $.extend(defaults, options);
128            return this.each(function() {
129                $(this).addClass('edubin-mobile-menu-item');
130                var menuItems = $(this).children('li');
131                menuItems.find('.edubin-mobile-menu-item > .edubin-dropdown-menu').parent().addClass('menu-item-has-children');
132                $('.edubin-mobile-menu-item .menu-item-has-children .edubin-dropdown-menu').hide();
133                $('.edubin-mobile-menu-item .menu-item-has-children > a .edubin-menu-icon').on('click', function(e) {
134                    e.preventDefault();
135                    e.stopPropagation();
136                    $(this).parent().siblings('.edubin-dropdown-menu').slideToggle(options.speed);
137                    $(this).parent().siblings('.edubin-mega-menu').slideToggle(options.speed);
138                });
139            });
140        }
141    });
142    $('#edubin-mobile-menu-item').accordionMenu();
143    //===== Elementor Mobile Menu
144    $('.edubin-elementor-mobile-hamburger-menu > a').on('click', function(e) {
145        e.preventDefault();
146        $(this).toggleClass('edubin-mobile-menu-close--active');
147        $(".edubin-elementor-mobile-menu-nav-wrapper").toggleClass('edubin-mobile-menu-visible');
148        $('body').toggleClass('edubin-mobile-menu-active');
149    });
150    $('.edubin-elementor-mobile-menu-close > a').on('click', function(e) {
151        e.preventDefault();
152        $('.edubin-elementor-mobile-hamburger-menu > a').removeClass('edubin-mobile-menu-close--active');
153        $('.edubin-elementor-mobile-menu-nav-wrapper').removeClass('edubin-mobile-menu-visible');
154        $('body').removeClass('edubin-mobile-menu-active');
155    });
156    $('.edubin-elementor-mobile-menu-overlay').on('click', function(e) {
157        e.preventDefault();
158        $('.edubin-elementor-mobile-hamburger-menu > a').removeClass('edubin-mobile-menu-close--active');
159        $('.edubin-elementor-mobile-menu-nav-wrapper').removeClass('edubin-mobile-menu-visible');
160        $('body').removeClass('edubin-mobile-menu-active');
161    });
162    //===== Accordion Menu for Elementor Mobile
163    $.fn.extend({
164        accordionMenu: function(options) {
165            var defaults = {
166                speed: 400
167            };
168            var options = $.extend(defaults, options);
169            return this.each(function() {
170                $(this).addClass('edubin-elementor-mobile-menu-item');
171                var menuItems = $(this).children('li');
172                menuItems.find('.edubin-elementor-mobile-menu-item > .edubin-dropdown-menu').parent().addClass('menu-item-has-children');
173                $('.edubin-elementor-mobile-menu-item .menu-item-has-children .edubin-dropdown-menu').hide();
174                $('.edubin-elementor-mobile-menu-item .menu-item-has-children > a .edubin-menu-icon').on('click', function(e) {
175                    e.preventDefault();
176                    e.stopPropagation();
177                    $(this).parent().siblings('.edubin-dropdown-menu').slideToggle(options.speed);
178                    $(this).parent().siblings('.edubin-mega-menu').slideToggle(options.speed);
179                });
180            });
181        }
182    });
183    $('#edubin-elementor-mobile-menu-item').accordionMenu();
184    //===== WooCommerce Helper
185    function edubin_woocommerce_helper() {
186        $('.product-over-info ul li.add-to-cart a.add_to_cart_button.ajax_add_to_cart').on("click", function() {
187            $(this).closest('li').addClass('added_to_cart_item');
188        });
189    }
190    //===== SAL Animation
191    sal();
192    //===== Video Popup
193    $(function() {
194        $("a.bla-1").YouTubePopUp();
195        $("a.bla-2").YouTubePopUp({
196            autoplay: 0
197        });
198    });
199    //===== Search
200    $('#search').on('click', function() {
201        $(".edubin-search-box").fadeIn(600);
202    });
203    $('.top-search').on('click', function() {
204        $(".edubin-search-box").fadeIn(600);
205    });
206    $('.edubin-closebtn').on('click', function() {
207        $(".edubin-search-box").fadeOut(600);
208    });
209    //===== Like/Wishlist button for blog page
210    jQuery(document).ready(function($) {
211        if (typeof edubin_like_ajax === 'undefined') {
212            return; // Exit if wp_localize_script is disabled
213        }
214        $('.edubin-like-btn').on('click', function(event) {
215            event.preventDefault();
216            var button = $(this);
217            var postID = button.data('postid');
218            $.ajax({
219                type: 'POST',
220                url: edubin_like_ajax.ajaxurl,
221                data: {
222                    action: 'edubin_like',
223                    post_id: postID
224                },
225                success: function(response) {
226                    if (response.success) {
227                        button.find('.like-count').text(response.data);
228                    }
229                }
230            });
231        });
232    });
233    //===== Add to cart animation
234    jQuery(function($) {
235        // Woo Add-to-Cart Animation
236        if (typeof edubin_cart !== 'undefined' && edubin_cart.animate) {
237            $(document).on("click", ".add_to_cart_button", function(e) {
238                let t = $(".edubin-woo-mini-cart-total-item");
239                if (!t.length) return;
240                let fly = $('<span class="flying-number">+1</span>').appendTo("body");
241                fly.css({
242                    top: e.pageY,
243                    left: e.pageX,
244                    position: "absolute",
245                    fontWeight: "bold",
246                    zIndex: 9999
247                });
248                fly.animate({
249                    top: t.offset().top,
250                    left: t.offset().left,
251                    opacity: 0
252                }, 800, () => fly.remove());
253                setTimeout(() => t.text(parseInt(t.text()) + 1), 300);
254            });
255        }
256        // Tutor Add > reload count
257        $(document).on("click", ".tutor-native-add-to-cart", () => setTimeout(() => location.reload(), 500));
258        // Tutor remove from cart
259        $(document).on("click", ".tutor-cart-remove-button", function(e) {
260            e.preventDefault();
261            let id = $(this).data("course-id");
262            $.post(edubin_cart.ajax, {
263                action: "tutor_delete_course_from_cart",
264                course_id: id
265            }, () => location.reload());
266        });
267    });
268})(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.