PageSourceSearch

https://dreamjobsafrica.com/wp-content/themes/superio/js/functions.js?ver=20150330

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

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.