PageSourceSearch

https://worldliteracyfoundation.org/wp-content/plugins/hopeu-plugin/assets/js/custom-scripts.js?ver=1.0.0

js worldliteracyfoundation.org collected 2026-09-24 08:48:59 UTC 9,572 bytes, 258 lines download raw bytes

1(function($) {
2
3    "use strict";
4
5    /*---------------------------------------------------
6      * Initialize all widget js in elementor init hook
7    ---------------------------------------------------*/
8    $(window).on('elementor/frontend/init', function () {
9
10        // Run these every time Elementor renders (safe/idempotent).
11        elementorFrontend.hooks.addAction('frontend/element_ready/global', function ($scope) {
12            mobileMenu();
13
14            // keep your pattern:
15            causeSlider();
16            eventSlider();
17            textSlider();
18            testiSlider();
19            testiSlider2();
20            mainSlider();
21            thmAnimation()
22        });
23    });
24
25	var timer = $('.counter');
26	if (timer.length) {
27		$('.counter').counterUp({
28			delay: 10,
29			time: 1200,
30		});
31	}
32	
33    function mobileMenu() {
34        const $mobileMenu = $('.mobile-menu');
35        if (!$mobileMenu.length) return;
36
37        $mobileMenu.find('li.menu-item-has-children, li.has-mega__menu').each(function () {
38            if (!$(this).children('.dropdown-btn').length) {
39                $(this).append('<div class="dropdown-btn"><span class="fa fa-angle-down"></span></div>');
40            }
41        });
42
43        $mobileMenu.off('click', '.dropdown-btn').on('click', '.dropdown-btn', function (e) {
44            e.preventDefault();
45            const $parentLi = $(this).parent('li');
46
47            if ($parentLi.hasClass('menu-item-has-children')) {
48                const $submenu = $parentLi.children('ul');
49                if ($submenu.is(':visible')) {
50                    $parentLi.removeClass('open');
51                    $submenu.slideUp(300);
52                } else {
53                    $parentLi.siblings('.menu-item-has-children').removeClass('open').children('ul').slideUp(300);
54                    $parentLi.toggleClass('open');
55                    $submenu.slideToggle(300);
56                }
57            } else if ($parentLi.hasClass('has-mega__menu')) {
58                const $megaContent = $parentLi.children('.hopeu-mega-menu-content');
59                if ($megaContent.is(':visible')) {
60                    $parentLi.removeClass('open');
61                    $megaContent.slideUp(300);
62                } else {
63                    $parentLi.siblings('.has-mega__menu').removeClass('open').children('.hopeu-mega-menu-content').slideUp(300);
64                    $parentLi.addClass('open');
65                    $megaContent.stop(true, true).css('display', 'none').slideDown(300);
66                }
67            }
68        });
69
70        $mobileMenu.off('click', '.navigation li.menu-item-has-children > a')
71            .on('click', '.navigation li.menu-item-has-children > a', function (e) {
72                e.preventDefault();
73            });
74
75        $mobileMenu.off('click', '.navigation li.has-mega__menu > a')
76            .on('click', '.navigation li.has-mega__menu > a', function (e) {
77                e.preventDefault();
78            });
79
80        $('.mobile-nav-toggler').off('click').on('click', function () {
81            $('body').addClass('mobile-menu-visible');
82        });
83
84        $('.mobile-menu .menu-backdrop, .mobile-menu .close-btn').off('click').on('click', function () {
85            closeMobileMenu();
86        });
87
88        $(document).off('keydown.mobileMenu').on('keydown.mobileMenu', function (e) {
89            if (e.key === 'Escape' || e.keyCode === 27) {
90                closeMobileMenu();
91            }
92        });
93
94        function closeMobileMenu() {
95            $('body').removeClass('mobile-menu-visible');
96            $mobileMenu.find('li').removeClass('open');
97            $mobileMenu.find('ul').removeAttr('style');
98        }
99    }
100
101    /* ---------------- SLIDERS (same function names/pattern) ---------------- */
102
103    function causeSlider() {
104        // Causes Slider One
105        $('.causes-slider-one').not('.slick-initialized').each(function () {
106            $(this).slick({
107                dots: true,
108                arrows: false,
109                lazyLoad: 'ondemand',
110                centerPadding: '0px',
111                slidesToShow: 3,
112                slidesToScroll: 1,
113                autoplay: true,
114                autoplaySpeed: 3000,
115                responsive: [
116                    { breakpoint: 1200, settings: { slidesToShow: 2 } },
117                    { breakpoint: 768, settings: { slidesToShow: 1 } }
118                ]
119            });
120        });
121    }
122
123    function eventSlider() {
124        // Event Slider One
125        $('.event-slider-one').not('.slick-initialized').each(function () {
126            $(this).slick({
127                dots: false,
128                arrows: false,
129                lazyLoad: 'ondemand',
130                centerPadding: '0px',
131                slidesToShow: 3,
132                slidesToScroll: 1,
133                autoplay: true,
134                autoplaySpeed: 3000,
135                responsive: [
136                    { breakpoint: 1400, settings: { slidesToShow: 2 } },
137                    { breakpoint: 768, settings: { slidesToShow: 1 } }
138                ]
139            });
140        });
141    }
142
143    function textSlider() {
144        // Event Text Slider One
145        $('.event-text-slider').not('.slick-initialized').each(function () {
146            $(this).slick({
147                dots: false,
148                arrows: false,
149                lazyLoad: 'ondemand',
150                centerPadding: '0px',
151                slidesToShow: 5,
152                slidesToScroll: 1,
153                autoplay: true,
154                autoplaySpeed: 3000,
155                responsive: [
156                    { breakpoint: 1200, settings: { slidesToShow: 4 } },
157                    { breakpoint: 768, settings: { slidesToShow: 2 } }
158                ]
159            });
160        });
161    }
162
163    function testiSlider() {
164        // Feedback Slider One (with arrows A)
165        $('.feedback-slider-one').not('.slick-initialized').each(function () {
166            var $slider = $(this);
167            // Find arrows *near this slider* (inside the same widget/container)
168            var $wrap = $slider.closest('.elementor-widget, .elementor-element, .elementor-widget-container, .slider, .slider-wrapper, .container');
169            var $prev = $wrap.find('.prev_a').first();
170            var $next = $wrap.find('.next_a').first();
171
172            $slider.slick({
173                dots: false,
174                arrows: true,
175                prevArrow: $prev.length ? $prev : undefined,
176                nextArrow: $next.length ? $next : undefined,
177                lazyLoad: 'ondemand',
178                centerPadding: '0px',
179                slidesToShow: 1,
180                slidesToScroll: 1,
181                centerMode: true,
182                autoplay: true,
183                autoplaySpeed: 3000,
184                responsive: [
185                    { breakpoint: 992, settings: { slidesToShow: 1 } }
186                ]
187            });
188        });
189    }
190
191    function testiSlider2() {
192        // Feedback Slider Two (with arrows B)
193        $('.feedback-slider-two').not('.slick-initialized').each(function () {
194            var $slider = $(this);
195            var $wrap = $slider.closest('.elementor-widget, .elementor-element, .elementor-widget-container, .slider, .slider-wrapper, .container');
196            var $prev = $wrap.find('.prev_b').first();
197            var $next = $wrap.find('.next_b').first();
198
199            $slider.slick({
200                dots: false,
201                arrows: true,
202                prevArrow: $prev.length ? $prev : undefined,
203                nextArrow: $next.length ? $next : undefined,
204                lazyLoad: 'ondemand',
205                centerPadding: '0px',
206                slidesToShow: 3,
207                slidesToScroll: 1,
208                autoplay: true,
209                autoplaySpeed: 3000,
210                responsive: [
211                    { breakpoint: 1200, settings: { slidesToShow: 2 } },
212                    { breakpoint: 768, settings: { slidesToShow: 1 } }
213                ]
214            });
215        });
216    }
217
218    function mainSlider() {
219        // Main Banner Slider (with arrows C + animation)
220        $('.banner-slider').not('.slick-initialized').each(function () {
221            var $slider = $(this);
222            var $wrap = $slider.closest('.elementor-widget, .elementor-element, .elementor-widget-container, .slider, .slider-wrapper, .container');
223            var $prev = $wrap.find('.prev_c').first();
224            var $next = $wrap.find('.next_c').first();
225
226            $slider.slick({
227                dots: false,
228                arrows: true,
229                prevArrow: $prev.length ? $prev : undefined,
230                nextArrow: $next.length ? $next : undefined,
231                lazyLoad: 'ondemand',
232                centerPadding: '0px',
233                slidesToShow: 1,
234                slidesToScroll: 1,
235                centerMode: true,
236                fade: true,
237                autoplay: true,
238                autoplaySpeed: 6000,
239                focusOnSelect: true,
240                pauseOnHover: false
241            });
242
243            if (typeof $slider.slickAnimation === 'function') {
244                $slider.slickAnimation();
245            }
246        });
247    }
248    
249    function thmAnimation(){
250		var sall = $ ("[data-sal]");
251		if(sall.length) {
252			sal({
253			threshold: 0.01,
254			});
255		}
256	}
257
258})(window.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.