PageSourceSearch

https://navodayafoundation.in/wp-content/themes/skillup/js/functions.js?ver=20150330

js navodayafoundation.in collected 2026-10-07 06:11:12 UTC 24,689 bytes, 628 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    if (!$.apusThemeExtensions)
5        $.apusThemeExtensions = {};
6    
7    function ApusThemeCore() {
8        var self = this;
9        // self.init();
10    };
11
12    ApusThemeCore.prototype = {
13        /**
14         *  Initialize
15         */
16        init: function() {
17            var self = this;
18            
19            self.preloadSite();
20
21            self.activeAccordion();
22            
23            // slick init
24            self.initSlick($("[data-carousel=slick]"));
25
26            // isoto
27            self.initIsotope();
28
29            // Unveil init
30            setTimeout(function(){
31                self.layzyLoadImage();
32            }, 200);
33
34            self.initHeaderSticky('main-sticky-header');
35
36            // back to top
37            self.backToTop();
38            
39            // popup image
40            self.popupImage();
41
42            $('[data-bs-toggle="tooltip"]').tooltip();
43
44            self.initMobileMenu();
45
46            self.mainMenuInit();
47
48            self.changePaddingTopContent();
49
50            $(window).resize(function(){
51                setTimeout(function(){
52                    self.changePaddingTopContent();
53                }, 50);
54            });
55            
56            $(document.body).on('click', '.nav [data-toggle="dropdown"]', function(e){
57                e.preventDefault();
58                if ( this.href && this.href != '#' ){
59                    if ( this.target && this.target == '_blank' ) {
60                        window.open(this.href, '_blank');
61                    } else {
62                        window.location.href = this.href;
63                    }
64                }
65            });
66
67            $('.navbar-wrapper .show-navbar-sidebar').on('click', function(){
68                $(this).closest('.navbar-wrapper').find('.navbar-sidebar-wrapper').addClass('active');
69                $(this).closest('.navbar-wrapper').find('.navbar-sidebar-overlay').addClass('active');
70            });
71            
72            $('.close-navbar-sidebar, .navbar-sidebar-overlay').on('click', function(){
73                $(this).closest('.navbar-wrapper').find('.navbar-sidebar-wrapper').removeClass('active');
74                $(this).closest('.navbar-wrapper').find('.navbar-sidebar-overlay').removeClass('active');
75            });
76
77            self.loadExtension();
78        },
79        /**
80         *  Extensions: Load scripts
81         */
82        loadExtension: function() {
83            var self = this;
84            
85            if ($.apusThemeExtensions.quantity_increment) {
86                $.apusThemeExtensions.quantity_increment.call(self);
87            }
88
89            if ($.apusThemeExtensions.shop) {
90                $.apusThemeExtensions.shop.call(self);
91            }
92
93            if ($.apusThemeExtensions.course) {
94                $.apusThemeExtensions.course.call(self);
95            }
96
97        },
98        initSlick: function(element) {
99            var self = this;
100            element.each( function(){
101                var config = {
102                    infinite: false,
103                    arrows: $(this).data( 'nav' ),
104                    dots: $(this).data( 'pagination' ),
105                    slidesToShow: 4,
106                    slidesToScroll: 4,
107                    prevArrow:"<button type='button' class='slick-arrow slick-prev'><i class='fa fa-angle-left'></i></span><span class='textnav'>"+ skillup_opts.previous +"</span></button>",
108                    nextArrow:"<button type='button' class='slick-arrow slick-next'><span class='textnav'>"+ skillup_opts.next +"</span><i class='fa fa-angle-right'></i></button>",
109                };
110            
111                var slick = $(this);
112                if( $(this).data('items') ){
113                    config.slidesToShow = $(this).data( 'items' );
114                    var slidestoscroll = $(this).data( 'items' );
115                }
116                if( $(this).data('infinite') ){
117                    config.infinite = true;
118                }
119                if( $(this).data('autoplay') ){
120                    config.autoplay = true;
121                    config.autoplaySpeed = 2500;
122                }
123                if( $(this).data('disable_draggable') ){
124                    config.touchMove = false;
125                    config.draggable = false;
126                    config.swipe = false;
127                    config.swipeToSlide = false;
128                }
129                if( $(this).data('centermode') ){
130                    config.centerMode = true;
131                }
132                if( $(this).data('vertical') ){
133                    config.vertical = true;
134                }
135                if( $(this).data('rows') ){
136                    config.rows = $(this).data( 'rows' );
137                }
138                if( $(this).data('asnavfor') ){
139                    config.asNavFor = $(this).data( 'asnavfor' );
140                }
141                if( $(this).data('slidestoscroll') ){
142                    var slidestoscroll = $(this).data( 'slidestoscroll' );
143                }
144                if( $(this).data('focusonselect') ){
145                    config.focusOnSelect = $(this).data( 'focusonselect' );
146                }
147                config.slidesToScroll = slidestoscroll;
148
149
150                if ($(this).data('smalldesktop')) {
151                    var smalldesktop = $(this).data('smalldesktop');
152                } else {
153                    var smalldesktop = config.items;
154                }
155                if ($(this).data('large')) {
156                    var large = $(this).data('large');
157                } else {
158                    var large = 4;
159                }
160                if ($(this).data('medium')) {
161                    var medium = $(this).data('medium');
162                } else {
163                    var medium = 3;
164                }
165                if ($(this).data('small')) {
166                    var small = $(this).data('small');
167                } else {
168                    var small = 2;
169                }
170                if ($(this).data('smallest')) {
171                    var smallest = $(this).data('smallest');
172                } else {
173                    if ($(this).data('small')) {
174                        var smallest = $(this).data('small');
175                    } else{
176                        var smallest = 2;
177                    }
178                }
179
180
181                if ($(this).data('slidestoscroll_smalldesktop')) {
182                    var slidestoscroll_smalldesktop = $(this).data('slidestoscroll_smalldesktop');
183                } else {
184                    var slidestoscroll_smalldesktop = config.items;
185                }
186                if ($(this).data('slidestoscroll_large')) {
187                    var slidestoscroll_large = $(this).data('slidestoscroll_large');
188                } else {
189                    var slidestoscroll_large = large;
190                }
191                if ($(this).data('slidestoscroll_medium')) {
192                    var slidestoscroll_medium = $(this).data('slidestoscroll_medium');
193                } else {
194                    var slidestoscroll_medium = medium;
195                }
196                if ($(this).data('slidestoscroll_small')) {
197                    var slidestoscroll_small = $(this).data('slidestoscroll_small');
198                } else {
199                    var slidestoscroll_small = small;
200                }
201                if ($(this).data('slidestoscroll_smallest')) {
202                    var slidestoscroll_smallest = $(this).data('slidestoscroll_smallest');
203                } else {
204                    var slidestoscroll_smallest = smallest;
205                }
206
207                config.responsive = [
208
209                    {
210                        breakpoint: 576,
211                        settings: {
212                            slidesToShow: smallest,
213                            slidesToScroll: slidestoscroll_smallest,
214                        }
215                    },
216                    {
217                        breakpoint: 768,
218                        settings: {
219                            slidesToShow: small,
220                            slidesToScroll: slidestoscroll_small
221                        }
222                    },
223                    {
224                        breakpoint: 992,
225                        settings: {
226                            slidesToShow: medium,
227                            slidesToScroll: slidestoscroll_medium
228                        }
229                    },
230                    {
231                        breakpoint: 1200,
232                        settings: {
233                            slidesToShow: large,
234                            slidesToScroll: slidestoscroll_large
235                        }
236                    },
237                    {
238                        breakpoint: 1400,
239                        settings: {
240                            slidesToShow: smalldesktop,
241                            slidesToScroll: slidestoscroll_smalldesktop
242                        }
243                    }
244                ];
245
246                if ( $('html').attr('dir') == 'rtl' ) {
247                    config.rtl = true;
248                }
249
250                $(this).slick( config );
251
252            } );
253
254            // Fix owl in bootstrap tabs
255            $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
256                var target = $(e.target).attr("href");
257                var $slick = $(".slick-carousel", target);
258
259                if ($slick.length > 0 && $slick.hasClass('slick-initialized')) {
260                    $slick.slick('refresh');
261                }
262                self.layzyLoadImage();
263            });
264
265            // Fix owl in bootstrap 5 tabs
266            $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
267                var target = $(e.target).attr("href");
268                var $slick = $(".slick-carousel", target);
269
270                if ($slick.length > 0 && $slick.hasClass('slick-initialized')) {
271                    $slick.slick('refresh');
272                }
273                self.layzyLoadImage();
274            });
275        },
276        layzyLoadImage: function() {
277            $(window).off('scroll.unveil resize.unveil lookup.unveil');
278            var $images = $('.image-wrapper:not(.image-loaded) .unveil-image'); // Get un-loaded images only
279            if ($images.length) {
280                $images.unveil(1, function() {
281                    $(this).load(function() {
282                        $(this).parents('.image-wrapper').first().addClass('image-loaded');
283                        $(this).removeAttr('data-src');
284                        $(this).removeAttr('data-srcset');
285                        $(this).removeAttr('data-sizes');
286                    });
287                });
288            }
289
290            var $images = $('.product-image:not(.image-loaded) .unveil-image'); // Get un-loaded images only
291            if ($images.length) {
292                $images.unveil(1, function() {
293                    $(this).load(function() {
294                        $(this).parents('.product-image').first().addClass('image-loaded');
295                    });
296                });
297            }
298        },
299        initIsotope: function() {
300            $('.isotope-items').each(function(){  
301                var $container = $(this);
302                
303                $container.imagesLoaded( function(){
304                    $container.isotope({
305                        itemSelector : '.isotope-item',
306                        transformsEnabled: true,         // Important for videos
307                        masonry: {
308                            columnWidth: $container.data('columnwidth')
309                        }
310                    }); 
311                });
312            });
313
314            /*---------------------------------------------- 
315             *    Apply Filter        
316             *----------------------------------------------*/
317            $('.isotope-filter li a').on('click', function(){
318               
319                var parentul = $(this).parents('ul.isotope-filter').data('related-grid');
320                $(this).parents('ul.isotope-filter').find('li a').removeClass('active');
321                $(this).addClass('active');
322                var selector = $(this).attr('data-filter'); 
323                $('#'+parentul).isotope({ filter: selector }, function(){ });
324                
325                return(false);
326            });
327        },
328        initHeaderSticky: function(main_sticky_class) {
329            if ( $('.' + main_sticky_class).length ) {
330                if ( typeof Waypoint !== 'undefined' ) {
331                    if ( $('.' + main_sticky_class) && typeof Waypoint.Sticky !== 'undefined' ) {
332                        var sticky = new Waypoint.Sticky({
333                            element: $('.' + main_sticky_class)[0],
334                            wrapper: '<div class="main-sticky-header-wrapper">',
335                            offset: '-10px',
336                            stuckClass: 'sticky-header'
337                        });
338                    }
339                }
340            }
341        },
342        backToTop: function () {
343            $(window).scroll(function () {
344                if ($(this).scrollTop() > 400) {
345                    $('#back-to-top').addClass('active');
346                } else {
347                    $('#back-to-top').removeClass('active');
348                }
349            });
350            $('#back-to-top').on('click', function () {
351                $('html, body').animate({scrollTop: '0px'}, 800);
352                return false;
353            });
354        },
355            
356        popupImage: function() {
357            // popup
358            $(".popup-image").magnificPopup({type:'image'});
359            $('.popup-video').magnificPopup({
360                disableOn: 700,
361                type: 'iframe',
362                mainClass: 'mfp-fade',
363                removalDelay: 160,
364                preloader: false,
365                fixedContentPos: false
366            });
367
368            $('.widget-gallery').each(function(){
369                var tagID = $(this).attr('id');
370                $('#' + tagID).magnificPopup({
371                    delegate: '.popup-image-gallery',
372                    type: 'image',
373                    tLoading: 'Loading image #%curr%...',
374                    mainClass: 'mfp-img-mobile',
375                    gallery: {
376                        enabled: true,
377                        navigateByImgClick: true,
378                        preload: [0,1] // Will preload 0 - before current, and 1 after the current image
379                    }
380                });
381            });
382        },
383        preloadSite: function() {
384            // preload page
385            setTimeout(function(){
386                if ( $('body').hasClass('apus-body-loading') ) {
387                    $('body').removeClass('apus-body-loading');
388                    $('.apus-page-loading').fadeOut(100);
389                }
390            }, 100);
391        },
392        
393        activeAccordion: function() {
394            $('.panel-collapse').on('show.bs.collapse', function () {
395                $(this).siblings('.panel-heading').addClass('active');
396            });
397
398            $('.panel-collapse').on('hide.bs.collapse', function () {
399                $(this).siblings('.panel-heading').removeClass('active');
400            });
401        },
402
403        initMobileMenu: function() {
404
405            // stick mobile
406            var self = this;
407
408            // mobile menu
409            $('.btn-toggle-canvas,.btn-showmenu').on('click', function (e) {
410                e.stopPropagation();
411                $('.apus-offcanvas').toggleClass('active');           
412                $('.over-dark').toggleClass('active');
413
414                $("#mobile-menu-container").slidingMenu({
415                    backLabel: skillup_opts.menu_back_text
416                });
417            });
418            $('body').on('click', function() {
419                if ($('.apus-offcanvas').hasClass('active')) {
420                    $('.apus-offcanvas').toggleClass('active');
421                    $('.over-dark').toggleClass('active');
422                }
423            });
424            $('.apus-offcanvas').on('click', function(e) {
425                e.stopPropagation();
426            });
427            
428            if ($(window).width() < 992) {
429                if ( $('.apus-offcanvas-body').length ) {
430                    var ps = new PerfectScrollbar('.apus-offcanvas-body', {
431                        wheelPropagation: true
432                    });
433                }
434            }
435
436            // sidebar mobile       
437            $('body').on('click', '.mobile-sidebar-btn.btn-left', function(){
438                $('.sidebar-left').toggleClass('active');
439            });
440            $('body').on('click', '.mobile-sidebar-btn.btn-right', function(){
441                $('.sidebar-right').toggleClass('active');
442            });
443
444            $('body').on('click', '.mobile-sidebar-btn', function(){
445                $('.mobile-sidebar-panel-overlay').toggleClass('active');
446                $('.mobile-sidebar-btn i').toggleClass('ti-menu-alt ti-close');
447            });
448            $('body').on('click', '.mobile-sidebar-panel-overlay, .close-sidebar-btn', function(){
449                $('.sidebar').removeClass('active');
450                $('.mobile-sidebar-panel-overlay').removeClass('active');
451                $('.mobile-sidebar-btn i').toggleClass('ti-menu-alt ti-close');
452            });
453
454
455            if ($(window).width() < 992) {
456                if ( $('.sidebar-wrapper > .sidebar').length ) {
457                    var ps = new PerfectScrollbar('.sidebar-wrapper > .sidebar', {
458                        wheelPropagation: true
459                    });
460                }
461            }
462
463            $(window).scroll(function () {
464                if ($(window).width() <= 600) {
465                    if ( $('#wpadminbar').length ) {
466                        var admin_bar_h = $('#wpadminbar').outerHeight();
467                        var mobile = $('.header-mobile').outerHeight();
468                        var scroll_h = $(this).scrollTop();
469                        if (scroll_h > admin_bar_h) {
470                            $('.admin-bar .header-mobile').css({'top': 0});
471                            $('.admin-bar .wrapper-menu-dashboard').css({'top': mobile });
472                        } else {
473                            var top = admin_bar_h - scroll_h;
474                            $('.admin-bar .header-mobile').css({'top': top});
475                            $('.admin-bar .wrapper-menu-dashboard').css({'top': top + mobile });
476                        }
477                    }
478                }
479            });
480        },
481        mainMenuInit: function() {
482            $('.apus-megamenu .megamenu .has-mega-menu.aligned-fullwidth').each(function(e){
483                var $this = $(this),
484                    i = $this.closest(".elementor-container"),
485                    a = $this.closest('.apus-megamenu');
486                $this.on('hover', function(){
487                    var m = $(this).find('> .dropdown-menu .dropdown-menu-inner'),
488                        w = i.width();
489
490                    m.css({
491                        width: w,
492                        marginLeft: i.offset().left - a.offset().left
493                    });
494                });
495
496                $this.find('.elementor-element').addClass('no-transparent');
497            });
498        },
499
500        changePaddingTopContent: function() {
501            var admin_bar_h = 0;
502            var header_h = 0;
503            var menu_dashboard = 0;
504            var header_main_content_h = header_h - admin_bar_h;
505            if ( $('#wpadminbar').length ){
506                var admin_bar_h = $('#wpadminbar').outerHeight();
507            }
508
509            if ( $('.wrapper-menu-dashboard').length ){
510                var menu_dashboard = $('.wrapper-menu-dashboard').outerHeight();
511            }
512
513            if ($(window).width() >= 992) {
514                if ( $('#apus-header').length ) {
515                    var header_h = $('#apus-header').outerHeight();
516                }
517                $('#apus-main-content').css({ 'padding-top': 0 });
518                
519                if ( $('.main-sticky-header-wrapper').length ) {
520                    $('.sidebar.sticky-top').css({
521                        top: header_h + 30
522                    });
523                }
524            } else {
525                if ( $('#apus-header-mobile').length ) {
526                    var header_h = $('#apus-header-mobile').outerHeight();
527                }
528                $('#apus-main-content').css({ 'padding-top': header_h + menu_dashboard });
529            }
530            
531        },
532
533        setCookie: function(cname, cvalue, exdays) {
534            var d = new Date();
535            d.setTime(d.getTime() + (exdays*24*60*60*1000));
536            var expires = "expires="+d.toUTCString();
537            document.cookie = cname + "=" + cvalue + "; " + expires+";path=/";
538        },
539        getCookie: function(cname) {
540            var name = cname + "=";
541            var ca = document.cookie.split(';');
542            for(var i=0; i<ca.length; i++) {
543                var c = ca[i];
544                while (c.charAt(0)==' ') c = c.substring(1);
545                if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
546            }
547            return "";
548        }
549    }
550
551    $.apusThemeCore = ApusThemeCore.prototype;
552
553    $(document).ready(function() {
554        // Initialize script
555        var apusthemecore_init = new ApusThemeCore();
556        apusthemecore_init.init();
557    });
558
559    jQuery(window).on("elementor/frontend/init", function() {
560        
561        var apusthemecore_init = new ApusThemeCore();
562
563        // General element
564        elementorFrontend.hooks.addAction( "frontend/element_ready/apus_element_brands.default",
565            function($scope) {
566                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
567            }
568        );
569
570        elementorFrontend.hooks.addAction( "frontend/element_ready/apus_element_features_box.default",
571            function($scope) {
572                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
573            }
574        );
575
576        elementorFrontend.hooks.addAction( "frontend/element_ready/apus_element_posts.default",
577            function($scope) {
578                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
579            }
580        );
581
582        elementorFrontend.hooks.addAction( "frontend/element_ready/apus_element_testimonials.default",
583            function($scope) {
584                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
585            }
586        );
587
588        elementorFrontend.hooks.addAction( "frontend/element_ready/apus_element_banners.default",
589            function($scope) {
590                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
591            }
592        );
593
594        // Woo elements
595        
596        elementorFrontend.hooks.addAction( "frontend/element_ready/apus_element_woo_products.default",
597            function($scope) {
598                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
599                apusthemecore_init.layzyLoadImage();
600            }
601        );
602
603        // Course elements
604        
605        elementorFrontend.hooks.addAction( "frontend/element_ready/skillup_learnpress_courses.default",
606            function($scope) {
607                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
608                apusthemecore_init.layzyLoadImage();
609            }
610        );
611
612        elementorFrontend.hooks.addAction( "frontend/element_ready/skillup_learnpress_courses_tabs.default",
613            function($scope) {
614                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
615                apusthemecore_init.layzyLoadImage();
616            }
617        );
618
619        elementorFrontend.hooks.addAction( "frontend/element_ready/skillup_learnpress_
619instructors.default",
620            function($scope) {
621                apusthemecore_init.initSlick($scope.find('.slick-carousel'));
622                apusthemecore_init.layzyLoadImage();
623            }
624        );
625    });
626
627})(jQuery);
628

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.