PageSourceSearch

https://skyrealestate.co/wp-content/themes/homeo/js/functions.js?ver=20150330

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

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.