PageSourceSearch

https://realmarka.com.br/wp-content/themes/realhomes/assets/modern/scripts/js/custom.js?ver=3.13.1

js realmarka.com.br collected 2026-09-29 12:20:53 UTC 53,020 bytes, 1,333 lines download raw bytes

1(function ($) {
2    "use strict";
3    $(document).ready(function () {
4
5        /*-----------------------------------------------------------------------------------*/
6        /*  Navigation menu.
7         /*-----------------------------------------------------------------------------------*/
8        $('.rh_menu ul.rh_menu__main > li').on({
9            mouseenter: function () {
10                var menu_link = $(this).children('a');
11                $(menu_link).addClass('rh_menu--hover');
12            },
13            mouseleave: function () {
14                var menu_link = $(this).children('a');
15                $(menu_link).removeClass('rh_menu--hover');
16            }
17        });
18
19        // Responsive Menu.
20        // First level
21        $('.rh_menu__hamburger').on('click', function () {
22            $('ul.rh_menu__responsive').toggleClass('rh_menu__responsive_show');
23        });
24
25        var sub_menu_parent = $('.rh_menu__responsive ul.sub-menu').parent();
26        sub_menu_parent.prepend('<i class="fas fa-caret-down rh_menu__indicator"></i>');
27
28        // Second Level
29        $('ul.rh_menu__responsive > li .rh_menu__indicator').on('click', function (e) {
30            e.preventDefault();
31            $(this).parent().children('ul.sub-menu').slideToggle();
32            $(this).toggleClass('rh_menu__indicator_up');
33        });
34
35        function moveUserMenuRes() {
36            var largeUserMenu = $('.rh_user_menu_wrapper_large').find('.rh_menu__user_profile');
37            var smallUserMenu = $('.rh_user_menu_wrapper_responsive').find('.rh_menu__user_profile');
38            var largeUserMenuWrapper = $('.rh_user_menu_wrapper_large');
39            var smallUserMenuWrapper = $('.rh_user_menu_wrapper_responsive');
40            if ($(window).width() < 1140) {
41                largeUserMenu.appendTo(smallUserMenuWrapper);
42            } else {
43                smallUserMenu.appendTo(largeUserMenuWrapper);
44            }
45        }
46
47        moveUserMenuRes();
48        $(window).on('resize', function () {
49            moveUserMenuRes();
50        });
51
52        // header variation standard
53        $('.rh_menu__hamburger_standard').on('click', function () {
54            $(this).siblings('.menu-container-standard-responsive').toggleClass('rh_menu__responsive_show');
55            // $('ul.rh_menu__responsive_plain').toggleClass('rh_menu__responsive_show');
56        });
57
58        var sub_menu_parent_plain = $('.rh_menu__responsive_plain ul.sub-menu').parent();
59        sub_menu_parent_plain.prepend('<i class="fas fa-caret-down rh_menu__indicator"></i>');
60
61        $('ul.rh_menu__responsive_plain > li .rh_menu__indicator').on('click', function (e) {
62            e.preventDefault();
63            $(this).parent().children('ul.sub-menu').slideToggle();
64            $(this).toggleClass('rh_menu__indicator_up');
65        });
66
67        // Sticky Header
68
69        $(function () {
70            var sticky = $('.rh_mod_sticky_header');
71            var headerHeight = $('.rh_temp_header_large_screens').height();
72
73            $(document).on('scroll', function () {
74                if ($(window).width() > 1139) {
75                    if ($(this).scrollTop() > headerHeight) {
76                        sticky.fadeIn(300);
77                    } else {
78                        sticky.fadeOut(100);
79                    }
80                }
81            });
82        });
83
84
85        /*-----------------------------------------------------------------------------------*/
86        /*	Scroll to Top
87         /*-----------------------------------------------------------------------------------*/
88        $(function () {
89            var scroll_anchor = $('#scroll-top');
90
91            $(window).on('scroll', function () {
92                // if ($(window).width() > 980) {
93                    if ($(this).scrollTop() > 250) {
94                        scroll_anchor.fadeIn('fast');
95                        return;
96                    }
97                // }
98                scroll_anchor.fadeOut('fast');
99            });
100
101            scroll_anchor.on('click', function (event) {
102                event.preventDefault();
103                $('html, body').animate({scrollTop: 0}, 'slow');
104            });
105        });
106
107        /*-----------------------------------------------------------------------------------*/
108        /*  Hover Fix For Listings
109         /*-----------------------------------------------------------------------------------*/
110
111        var mobileHover = function (thumbFigure) {
112            $(thumbFigure).each(function () {
113                $(this).on('touchstart', function () {
114                    return true;
115                });
116                $(this).parents('body').on('touchstart', function () {
117                    return true;
118                });
119            });
120
121        };
122
123        mobileHover('.rh_prop_card__thumbnail');
124        mobileHover('.rh_list_card__thumbnail');
125
126        // $('.rh_prop_card__thumbnail').attr("onclick","return true");
127
128        /*-----------------------------------------------------------------------------------*/
129
130        /*	Login Menu Open/Close
131         /*-----------------------------------------------------------------------------------*/
132        function logInMenu() {
133
134            $(".rh_menu__user_profile").on(' mouseover', function () {
135                if ($(window).width() > 1023 || $(this).find('.add-favorites-without-login').length) {
136                    if (!$(this).hasClass('open-login')) {
137                        $(this).addClass('open-login');
138                    }
139                }
140            });
141
142            $(".rh_menu__user_profile").on('mouseout', function () {
143                if ($(window).width() > 1023 || $(this).find('.add-favorites-without-login').length) {
144                    if ($(this).hasClass('open-login')) {
145                        $(this).removeClass('open-login');
146                    }
147                }
148            });
149
150            $("body").on('click', '.rh_menu__user_profile', function () {
151                if ($(window).width() < 1024) {
152                    $(this).toggleClass('open-login');
153
154                    $('.rh_modal').on('click', function (e) {
155                        e.stopPropagation();
156                    });
157                }
158            });
159        }
160
161        logInMenu();
162
163        /*-----------------------------------------------------------------------------------*/
164        /*	Auto Focus on login
165         /*-----------------------------------------------------------------------------------*/
166        $(function () {
167            $('.rh_menu__user_profile').on('mouseover', function () {
168                if ($(this).find('#username').hasClass('focus-class')) {
169                    var userFocus = $('.focus-class');
170                    var fieldVal = userFocus.val();
171                    var fieldLength = fieldVal.length;
172                    if (fieldLength === 0) {
173                        $(userFocus).focus();
174                    }
175                }
176            });
177        });
178
179        /*-----------------------------------------------------------------------------------*/
180        /*  Flex Slider
181         /*-----------------------------------------------------------------------------------*/
182        if (jQuery().flexslider) {
183
184            // Flex Slider for Homepage.
185            $('#rh_slider__home .flexslider').flexslider({
186                animation: "fade",
187                slideshowSpeed: 7000,
188                animationSpeed: 1500,
189                slideshow: true,
190                directionNav: true,
191                controlNav: false,
192                keyboardNav: true,
193                customDirectionNav: $(".rh_flexslider__nav_main a"),
194                start: function (slider) {
195                    slider.removeClass('loading');
196                    slider.removeClass('rh_home_load_height');
197                }
198            });
199
200            // Flex Slider for Property Single Videos.
201            $('.rh_wrapper_property_videos_slider').flexslider({
202                animation: "slide",
203                slideshow: false,
204                directionNav: true,
205                controlNav: false,
206                start: function (slider) {
207                    slider.resize();
208                },
209            });
210
211            // Featured Properties slider for Homepage.
212            $('#rh_section__featured_slider .flexslider').flexslider({
213                animation: "fade",
214                slideshowSpeed: 7000,
215                animationSpeed: 1500,
216                slideshow: false,
217                directionNav: true,
218                controlNav: false,
219                keyboardNav: true,
220                customDirectionNav: $(".rh_flexslider__nav a"),
221                start: function (slider) {
222                    slider.removeClass('loading');
223                }
224            });
225
226
227            // Flex Slider for Detail Page
228            var $sliderItemCurrent = $(".slider-item-current");
229            $('#property-detail-flexslider .flexslider').flexslider({
230                animation: "slide",
231                slideshow: false,
232                directionNav: true,
233                controlNav: false,
234                start: function (slider) {
235                    slider.resize();
236                    slider.removeClass('rh_property_load_height');
237                },
238                after: function (slider) {
239                    $sliderItemCurrent.text(slider.currentSlide + 1);
240
241                },
242            });
243
244            /* Property detail page slider variation two */
245            $('#property-detail-slider-carousel-nav').flexslider({
246                animation: "slide",
247                controlNav: false,
248                animationLoop: false,
249                directionNav: true,
250                prevText: "",
251                nextText: "",
252                slideshow: false,
253                itemWidth: 130,
254                itemMargin: 5,
255                minItems: 8,
256                maxItems: 8,
257                asNavFor: '#property-detail-slider-two'
258            });
259            $('#property-detail-slider-two').flexslider({
260                animation: "slide",
261                controlNav: false,
262                animationLoop: false,
263                slideshow: false,
264                directionNav: true,
265                // smoothHeight: true,
266                prevText: "",
267                nextText: "",
268                sync: "#property-detail-slider-carousel-nav",
269                start: function (slider) {
270                    slider.removeClass('rh_property_load_height');
271                },
272            });
273
274            // Flex Slider for Child Properties on property detail page.
275            $('#rh_property__child_slider .flexslider').flexslider({
276                animation: "slide",
277                slideshow: false,
278                directionNav: true,
279                controlNav: false,
280                start: function (slider) {
281                    slider.resize();
282                }
283            });
284
285            // Remove Flex Slider Navigation for Smaller Screens Like IPhone Portrait
286            $('.slider-wrapper, .listing-slider').on({
287                mouseenter: function () {
288                    var mobile = $('body').hasClass('probably-mobile');
289                    if (!mobile) {
290                        $('.flex-direction-nav').stop(true, true).fadeIn('slow');
291                    }
292                },
293                mouseleave: function () {
294                    $('.flex-direction-nav').stop(true, true).fadeOut('slow');
295                }
296            });
297
298            // Flex Slider Gallery Post
299            $('.listing-slider').each(function () {
300                $(this).flexslider({
301                    animation: "slide",
302                    slideshow: false,
303                    controlNav: false,
304                    // directionNav: false,
305                    // customDirectionNav: $(".rh_flexslider__nav_main_gallery .nav-mod"),
306                    customDirectionNav: $(this).next('.rh_flexslider__nav_main_gallery').find('.nav-mod'),
307                });
308            });
309
310
311        }
312
313
314        var sfoiB1 = $('.rh_open_sfoi_advance').outerWidth();
315        var sfoiB2 = $('.rh_sfoi_search_btn').outerWidth();
316
317        if (sfoiB1 > sfoiB2) {
318            $('.rh_sfoi_search_btn').css('min-width', sfoiB1 + "px");
319            $('.rh_mod_sfoi_wrapper_inner .rh_prop_search__option:nth-of-type(1)').css('min-width', sfoiB1 + "px");
320        } else {
321            $('.rh_open_sfoi_advance').css('min-width', sfoiB2 + "px");
322            $('.rh_mod_sfoi_wrapper_inner .rh_prop_search__option:nth-of-type(1)').css('min-width', sfoiB2 + "px");
323
324        }
325
326        $('.rh_mod_sfoi_advanced_expander').on('click', function () {
327            $(this).toggleClass('rh_sfoi_is_open');
328            if ($(this).hasClass('rh_sfoi_is_open')) {
329                $('.rh_mod_sfoi_advance_fields_wrapper').stop().slideDown(500);
330            } else {
331                $('.rh_mod_sfoi_advance_fields_wrapper').stop().slideUp(500);
332            }
333        });
334
335        $('.rh_sfoi_features .more-option-trigger a').on('click',function (e) {
336            e.preventDefault();
337            $(this).toggleClass('rh_sfoi_feature_open');
338            if($(this).hasClass('rh_sfoi_feature_open')){
339                $('.more-options-wrapper').stop().slideDown(500);
340            }else{
341                $('.more-options-wrapper').stop().slideUp(500);
342            }
343        });
344
345
346        function moveFormToHeader() {
347            var screenWidth = $(window).width();
348            if (screenWidth <= 1139) {
349                $('.inspiry_mod_header_variation_three .rh_prop_search_form_header').detach().prependTo(".rh_prop_search");
350                $('.inspiry_mod_header_variation_three .rh_prop_search').show();
351            } else if (screenWidth >= 1139) {
352                $('.inspiry_mod_header_variation_three .rh_prop_search_form_header').detach().prependTo(".rh_prop_search_in_header");
353                $('.inspiry_mod_header_variation_three .rh_prop_search').hide();
354            }
355        }
356
357        moveFormToHeader();
358
359        var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false;
360
361        if (!isMobile) {
362            $(window).on('resize', moveFormToHeader);
363        }
364
365
366        function slideElementDisplay() {
367            var getDataTopBar = $('#rh_fields_search__wrapper').data('top-bar');
368            var slideElementsDisplay = $('.rh_prop_search__form .rh_prop_search__fields .rh_prop_search__option');
369
370            var setDataTopBar = 0;
371            if (window.matchMedia('(max-width: 767px)').matches) {
372                if (getDataTopBar == 3) {
373                    setDataTopBar = 4;
374                } else {
375                    setDataTopBar = getDataTopBar;
376                }
377            } else if (window.matchMedia('(min-width: 768px)').matches) {
378                setDataTopBar = getDataTopBar;
379
380            }
381
382            var slideElements = $('.rh_prop_search__form .rh_prop_search__fields .rh_prop_search__option:not(.hide-fields):nth-of-type(n+' + (setDataTopBar + 1) + ')');
383
384            if (!slideElements.hasClass('show')) {
385                // slideElements.css('max-width','25%');
386                slideElements.addClass('show').slideDown(100).animate(
387                    {opacity: 1},
388                    {queue: false, duration: 300}
389                );
390
391            } else {
392                slideElements.removeClass('show').slideUp(100).animate(
393                    {opacity: 0},
394                    {queue: false, duration: 100}
395                );
396            }
397        }
398
399        $('.rh_prop_search__buttons .rh_prop_search__advance_btn').on('click', function (e) {
400
401            e.preventDefault();
402
403            // Toggle search icon.
404            $(this).find('#rh_icon__search').toggle('400');
405
406            // Open advance search fields.
407            $('#rh_prop_search__dropdown').toggleClass('rh_prop_search__ddActive');
408
409
410            var thisParent = $(this).parents('.rh_prop_search_init');
411
412            if (!(thisParent).hasClass('rh_open_form')) {
413                thisParent.addClass('rh_open_form');
414                $('.rh_form_fat_collapsed_fields_wrapper').slideDown(400);
415            } else {
416                thisParent.removeClass('rh_open_form');
417                // thisParent.find('.more-options-wrapper-mode').slideUp(200);
418                // thisParent.find('.open_more_features').removeClass('featured-open');
419                $('.rh_form_fat_collapsed_fields_wrapper').slideUp(400)
420            }
421
422
423            // slideElementDisplay();
424
425        });
426
427        $('.rh_prop_search__buttons_smart .rh_prop_search__advance_btn').on('click', function (e) {
428            e.preventDefault();
429
430            $(this).find('#rh_icon__search').toggle('400');
431
432            $(this).toggleClass('rh_smart_form_open');
433
434            if ($(this).hasClass('rh_smart_form_open')) {
435                $('.rh_form_smart_collapsed_fields_wrapper').slideDown(400);
436            } else (
437                $('.rh_form_smart_collapsed_fields_wrapper').slideUp(400)
438            )
439
440        });
441
442        function topBarFieldsHeight() {
443            if ($('.advance-search-form').hasClass('rh_prop_search__form')) {
444                var getDataTopBar = $('#rh_fields_search__wrapper').data('top-bar');
445                var topElementsReset = $('.rh_prop_search__form .rh_prop_search__fields .rh_prop_search__option');
446
447                var showDataTopBar = 0;
448                if (window.matchMedia('(max-width: 767px)').matches) {
449                    if (getDataTopBar == '3') {
450                        showDataTopBar = 4;
451                        topElementsReset.removeClass('default-show');
452                    } else {
453                        showDataTopBar = getDataTopBar;
454                    }
455                } else if (window.matchMedia('(min-width: 768px)').matches) {
456                    showDataTopBar = getDataTopBar;
457                    topElementsReset.removeClass('default-show');
458                }
459                var topElements = $('.rh_prop_search__form .rh_prop_search__fields .rh_prop_search__option:not(.hide-fields):nth-of-type(-n+' + showDataTopBar + ')');
460                topElements.addClass('default-show');
461                if (window.matchMedia('(min-width: 768px)').matches) {
462                    topElements.css({'max-width': (100 / showDataTopBar) + '%', 'width': 100 + '%'});
463                }
464                if (window.matchMedia('(max-width: 767px)').matches) {
465                    if (getDataTopBar == 1) {
466                        topElements.css({'max-width': 'none', 'width': '100%'});
467                    } else {
468                        topElements.css({'max-width': 'none', 'width': (100 / 2) + '%'});
469                    }
470                }
471            }
472        }
473
474        // topBarFieldsHeight();
475        //
476        // $(window).on('resize',function(){
477        //     topBarFieldsHeight();
478        // });
479
480
481        $('.rh_prop_search__selectwrap').on('click', function (e) {
482            e.preventDefault();
483            var search_select = $(this).find('.ajax-location-field');
484            // var search_select = $(this).find('.rh_select2, .ajax-location-field');
485
486            if (e.target.classList[0] === 'select2-selection' || e.target.classList[0] === 'select2-selection__rendered') return;
487
488
489
490            // search_select.select2("open");
491        });
492
493        $('.inspiry_select_picker_trigger,.ajax-location-field').each(function () {
494        // $('.rh_select2, .ajax-location-field').each(function () {
495
496            var thisParent = $(this).parents('.rh_prop_search__select');
497
498            var thisCurrentValue = $(this).children("option:selected").val();
499
500
501            if(thisCurrentValue !== 'any' && typeof thisCurrentValue !== 'undefined'){
502                thisParent.addClass('rh_sfoi_field_selected');
503            }else{
504                thisParent.removeClass('rh_sfoi_field_selected');
505            }
506
507            $(this).on('change', function() {
508                var thisAnyValue = this.value;
509
510
511                if (thisAnyValue !== 'any' && thisAnyValue.length !== 0) {
512
513                    thisParent.addClass('rh_sfoi_field_selected');
514                } else {
515                    thisParent.removeClass('rh_sfoi_field_selected');
516                }
517            });
518        });
519
520        $('.rh_mod_text_field').each(function () {
521            var thisParent = $(this).not('.rvr_check_in,.rvr_check_out');
522            var thisTextField = $(this).find('input');
523
524            thisTextField.on("focus", function () {
525                thisParent.addClass('rh_mod_text_field_focused');
526            });
527
528            thisTextField.on("blur", function () {
529
530                setTimeout(function () {
531                    if (!$(thisTextField).val()) {
532                        thisParent.removeClass('rh_mod_text_field_focused');
533                    } else {
534                        thisParent.addClass('rh_mod_text_field_focused');
535                    }
536                }, 100);
537
538            });
539        });
540
541
542
543        //Open Search Form More Features fields
544        $('.open_more_features').on('click', function (e) {
545            e.preventDefault();
546            $(this).toggleClass('featured-open');
547            $('.more-options-wrapper-mode').slideToggle(200);
548
549        });
550
551        $('.advance-search-form ').each(function () {
552            var getDataTopBar = $(this).find('.rh_prop_search_data').data('top-bar');
553
554            var advanceSearch = $(this).find('.rh_search_top_field_common .rh_prop_search__option');
555
556            var prePendTo = $(this).find('.rh_search_fields_prepe
556nd_to');
557
558            var j = 0;
559
560            var i = 0;
561
562            advanceSearch.each(function () {
563                if (i < getDataTopBar) {
564                    if ($(this).hasClass('hide-fields')) {
565                        j = 2;
566                    }
567                }
568                i++;
569            });
570
571
572            var advanceElements = getDataTopBar + j + 1;
573
574
575            if (advanceElements > 0) {
576                var advanceFieldsSmart = $(this).find('.rh_search_top_field_common .rh_prop_search__option:nth-of-type(n+' + advanceElements + ')');
577
578                advanceFieldsSmart.detach().prependTo(prePendTo);
579
580            }
581        });
582
583
584        var rhSFOIModFields = function(){
585        $('.rh_sfoi_advance_search_form').each(function () {
586            var getDataTopBar = $(this).find('.rh_top_sfoi_fields').data('sfoi-top');
587
588            var advanceSearch = $(this).find('.rh_top_sfoi_fields .rh_prop_search__option');
589
590            var prePendTo = $(this).find('.rh_mod_sfoi_advance_fields');
591
592            var j = 0;
593
594            var i = 0;
595
596            advanceSearch.each(function () {
597                if (i < getDataTopBar) {
598                    if ($(this).hasClass('hide-fields')) {
599                        j = 2;
600                    }
601                }
602                i++;
603            });
604
605
606            var advanceElements = getDataTopBar + j + 1;
607
608
609            if (advanceElements > 0) {
610                var advanceFieldsSmart = $(this).find('.rh_top_sfoi_fields .rh_prop_search__option:nth-of-type(n+' + advanceElements + ')');
611
612                advanceFieldsSmart.detach().prependTo(prePendTo);
613
614            }
615        });};
616
617        var removeFadedFields = function () {
618          $('.rh_mod_sfoi_content').removeClass('rh_sfoi_faded');
619        };
620
621        var disableSfoiAdvance = function () {
622            // if( $('.rh_mod_sfoi_advance_fields').contents().length == 0) {
623                if( !$.trim( $('.rh_mod_sfoi_advance_fields').html() ).length ) {
624                $('.rh_top_sfoi_fields').addClass('rh_sfoi_hide_advance_fields');
625            }
626        };
627
628        var SfoiCallbacks = $.Callbacks();
629
630        SfoiCallbacks.add( rhSFOIModFields );
631        SfoiCallbacks.fire( rhSFOIModFields );
632
633        SfoiCallbacks.add( disableSfoiAdvance );
634        SfoiCallbacks.fire( disableSfoiAdvance );
635
636        SfoiCallbacks.add( removeFadedFields );
637        SfoiCallbacks.fire( removeFadedFields );
638
639
640
641        // $(function () {
642        //
643        //     var getDataTopBar = $('.rh_prop_search_data').data('top-bar');
644        //
645        //     var advanceSearch = $('.rh_search_top_field_common .rh_prop_search__option');
646        //
647        //     var j = 0;
648        //
649        //     var i = 0;
650        //
651        //     advanceSearch.each(function () {
652        //         if (i < getDataTopBar) {
653        //             if ($(this).hasClass('hide-fields')) {
654        //                 j = 2;
655        //             }
656        //         }
657        //         i++;
658        //     });
659        //
660        //
661        //     var advanceElements = getDataTopBar+j+1;
662        //
663        //
664        //     if(advanceElements > 0){
665        //         var advanceFieldsSmart = $('.rh_search_top_field_common .rh_prop_search__option:nth-of-type(n+'+advanceElements+')');
666        //
667        //         advanceFieldsSmart.detach().prependTo('.rh_search_fields_prepend_to');
668        //
669        //     }
670
671
672        // $('.rh_form_smart_top_fields :input').each(function () {
673        //
674        //         var label = $(this).parents(".rh_prop_search__option").find("label");
675        //
676        //     var  labelText = '';
677        //         if (label.find('span').hasClass('label')){
678        //             labelText = label.find('span').text();
679        //         }else{
680        //              labelText = label.text();
681        //         }
682        //
683        //
684        //     $(this).attr('placeholder',labelText);
685        // });
686
687        // $('.rh_form_smart_top_fields .rh_prop_search__option input').attr('placeholder','test')
688        // $('.rh_form_smart_top_fields .rh_prop_search__option input').attr('placeholder',function () {
689        //     $(this).text('test');
690        // });
691
692
693        // $(".rh_form_smart_top_fields :input").each(function(index, elem) {
694        //     var eId = $(elem).attr("id");
695        //     var label = null;
696        //     if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) {
697        //         $(elem).attr("placeholder", $(label).text());
698        //         $(label).remove();
699        //     }
700        // });
701
702
703        // var advanceFieldsSmart = $('.rh_form_smart_top_fields .rh_prop_search__option:nth-of-type(n+'+advanceElements+')');
704
705        // });
706
707
708        // var advanceFieldsSFOI = $('.rh_mod_sfoi_wrapper .rh_prop_search__option:nth-of-type(n+3)');
709        // advanceFieldsSFOI.detach().prependTo('.rh_moved_mod_advance_fields');
710
711
712        /*-----------------------------------------------------------------------------------*/
713
714        /* Properties Sorting
715         /*-----------------------------------------------------------------------------------*/
716        function insertParam(key, value) {
717            key = encodeURI(key);
718            value = encodeURI(value);
719
720            var kvp = document.location.search.substr(1).split('&');
721
722            var i = kvp.length;
723            var x;
724            while (i--) {
725                x = kvp[i].split('=');
726
727                if (x[0] == key) {
728                    x[1] = value;
729                    kvp[i] = x.join('=');
730                    break;
731                }
732            }
733
734            if (i < 0) {
735                kvp[kvp.length] = [key, value].join('=');
736            }
737
738            //this will reload the page, it's likely better to store this until finished
739            document.location.search = kvp.join('&');
740        }
741
742        $('#sort-properties').on('change', function () {
743            var key = 'sortby';
744            var value = $(this).val();
745            insertParam(key, value);
746        });
747
748        /*-----------------------------------------------------------------------------------*/
749        /* Properties Listing Map Height Fix
750         /*-----------------------------------------------------------------------------------*/
751        var fixMapHeight = function () {
752            var height = ($('.rh_page__map_properties')) ? $('.rh_page__map_properties').outerHeight() : false;
753            var screenWidth = $(document).width();
754            if (height && (1024 < screenWidth)) {
755                $('.rh_page__listing_map').css({'height': height});
756            }
757        };
758
759        /*----------------------------------------------------------------------------------*/
760        /* Contact Form AJAX validation and submission
761         /* Validation Plugin : http://bassistance.de/jquery-plugins/jquery-plugin-validation/
762         /* Form Ajax Plugin : http://www.malsup.com/jquery/form/
763         /*---------------------------------------------------------------------------------- */
764        if (jQuery().validate && jQuery().ajaxSubmit) {
765
766            var submitButton = $('#submit-button'),
767                ajaxLoader = $('#ajax-loader'),
768                messageContainer = $('#message-container'),
769                errorContainer = $("#error-container");
770
771            var formOptions = {
772                beforeSubmit: function () {
773                    submitButton.attr('disabled', 'disabled');
774                    ajaxLoader.fadeIn('fast');
775                    messageContainer.fadeOut('fast');
776                    errorContainer.fadeOut('fast');
777                },
778                success: function (ajax_response, statusText, xhr, $form) {
779                    var response = $.parseJSON(ajax_response);
780                    ajaxLoader.fadeOut('fast');
781                    submitButton.removeAttr('disabled');
782                    if (response.success) {
783                        $form.resetForm();
784                        messageContainer.html(response.message).fadeIn('fast');
785
786                        setTimeout(function () {
787                            messageContainer.fadeOut('slow')
788                        },5000);
789
790                        // call reset function if it exists
791                        if (typeof inspiryResetReCAPTCHA == 'function') {
792                            inspiryResetReCAPTCHA();
793                        }
794
795                        if( typeof CFOSData !== 'undefined' ){
796                            setTimeout(function(){
797                                window.location.replace(CFOSData.redirectPageUrl);
798                            },1000);
799                        }
800
801                        if( typeof contactFromData !== 'undefined' ){
802                            setTimeout(function(){
803                                window.location.replace(contactFromData.redirectPageUrl);
804                            },1000);
805                        }
806                    } else {
807                        errorContainer.html(response.message).fadeIn('fast');
808                    }
809                }
810            };
811
812            // Contact page form
813            $('#contact-form .contact-form').validate({
814                errorLabelContainer: errorContainer,
815                submitHandler: function (form) {
816                    $(form).ajaxSubmit(formOptions);
817                }
818            });
819
820            // Contact Form Over Slider
821            $('.cfos_contact_form').validate({
822                errorLabelContainer: errorContainer,
823                submitHandler: function (form) {
824                    $(form).ajaxSubmit(formOptions);
825                }
826            });
827
828            // Agent single page form
829            $('#agent-single-form').validate({
830                errorLabelContainer: errorContainer,
831                submitHandler: function (form) {
832                    $(form).ajaxSubmit(formOptions);
833                }
834            });
835        }
836        
837        /*-----------------------------------------------------------------------------------*/
838        /* Swipe Box Lightbox
839        /*-----------------------------------------------------------------------------------*/
840	    if ($().swipebox) {
841		    $('.clone .swipebox').removeClass('swipebox');
842		    $('.swipebox').swipebox();
843	    }
844
845        /*-----------------------------------------------------------------*/
846        /* Property Floor Plans
847         /*-----------------------------------------------------------------*/
848        $('.floor-plans-accordions .floor-plan:first-child').addClass('current')
849            .children('.floor-plan-content').css('display', 'block').end()
850            .find('i.fa').removeClass('fa-plus').addClass('fa-minus');
851
852        $('.floor-plan-title').on('click', function () {
853            var parent_accordion = $(this).closest('.floor-plan');
854            if (parent_accordion.hasClass('current')) {
855                $(this).find('i.fa').removeClass('fa-minus').addClass('fa-plus');
856                parent_accordion.removeClass('current').children('.floor-plan-content').slideUp(300);
857            } else {
858                $(this).find('i.fa').removeClass('fa-plus').addClass('fa-minus');
859                parent_accordion.addClass('current').children('.floor-plan-content').slideDown(300);
860            }
861            var siblings = parent_accordion.siblings('.floor-plan');
862            siblings.find('i.fa').removeClass('fa-minus').addClass('fa-plus');
863            siblings.removeClass('current').children('.floor-plan-content').slideUp(300);
864        });
865
866        /*-----------------------------------------------------------------------------------*/
867        /* Pretty Photo Lightbox
868         /*-----------------------------------------------------------------------------------*/
869        if (typeof customData !== "undefined" && jQuery().prettyPhoto) {
870            $(".pretty-photo").prettyPhoto({
871                allow_resize: true,
872                default_width: customData.video_width,
873                default_height: customData.video_height,
874                animation_speed: 'normal',
875                deeplinking: false,
876                social_tools: false,
877                theme: 'default',
878                show_title: false,
879                iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no" allowfullscreen="true"></iframe>'
880            });
881
882            $('a[data-rel]').each(function () {
883                $(this).attr('rel', $(this).data('rel'));
884            });
885
886            $("a[rel^='prettyPhoto']").prettyPhoto({
887                overlay_gallery: false,
888                social_tools: false,
889                theme: 'dark_square',
890                show_title: false
891            });
892        }
893
894        /**
895         * forEach implementation for Objects/NodeLists/Arrays, automatic type loops and context options
896         *
897         * @private
898         * @author Todd Motto
899         * @link https://github.com/toddmotto/foreach
900         * @param {Array|Object|NodeList} collection - Collection of items to iterate, could be an Array, Object or NodeList
901         * @callback requestCallback      callback   - Callback function for each iteration.
902         * @param {Array|Object|NodeList}
902 scope=null - Object/NodeList/Array that forEach is iterating over, to use as the this value when executing callback.
903         * @returns {}
904         */
905        var forEach = function (t, o, r) {
906            if ("[object Object]" === Object.prototype.toString.call(t)) for (var c in t) Object.prototype.hasOwnProperty.call(t, c) && o.call(r, t[c], c, t); else for (var e = 0, l = t.length; l > e; e++) o.call(r, t[e], e, t)
907        };
908
909        var hamburgers = document.querySelectorAll(".hamburger");
910        if (hamburgers.length > 0) {
911            forEach(hamburgers, function (hamburger) {
912                hamburger.addEventListener("click", function () {
913                    this.classList.toggle("is-active");
914                }, false);
915            });
916        }
917
918        /* ---------------------------------------------------- */
919        /*  Close Hamburger Menu on modern when click outside
920         /* ---------------------------------------------------- */
921        $(document).on('mouseup', function (e) {
922            var container = $(".main-menu");
923
924            var innerContainer = container.find('ul.rh_menu__responsive');
925
926            // If the target of the click isn't the container
927
928            if (!container.is(e.target) && container.has(e.target).length === 0) {
929                if (innerContainer.hasClass('rh_menu__responsive_show')) {
930                    innerContainer.removeClass('rh_menu__responsive_show');
931                }
932                if ($(hamburgers).hasClass('is-active')) {
933                    $(hamburgers).removeClass("is-active");
934                }
935            }
936        });
937
938        /* ---------------------------------------------------- */
939        /*  Gallery Hover Effect
940         /* ---------------------------------------------------- */
941        $('.rh_gallery__item figure').on({
942            mouseenter: function () {
943                var $currentFigure = $(this);
944                var $mediaContainer = $currentFigure.find('.media_container');
945                var $media = $mediaContainer.find('a');
946                var $margin = -($media.first().height() / 2);
947                $media.css('margin-top', $margin);
948                var linkWidth = $media.first().width();
949                var targetPosition = ($mediaContainer.width() / 2) - (linkWidth + 2);
950                $mediaContainer.stop().fadeIn(300);
951                $mediaContainer.find('a.link').stop().animate({'right': targetPosition}, 300);
952                $mediaContainer.find('a.zoom').stop().animate({'left': targetPosition}, 300);
953            },
954            mouseleave: function () {
955                var $currentFigure = $(this);
956                var $mediaContainer = $currentFigure.find('.media_container');
957                $mediaContainer.stop().fadeOut(300);
958                $mediaContainer.find('a.link').stop().animate({'right': '0'}, 300);
959                $mediaContainer.find('a.zoom').stop().animate({'left': '0'}, 300);
960            }
961        });
962
963        /*-----------------------------------------------------------------------------------*/
964        /* Sticky-kit
965         /* URL: https://github.com/leafo/sticky-kit
966         /*-----------------------------------------------------------------------------------*/
967        var makeSticky = function () {
968            var screenWidth = $(window).width();
969            if (1024 <= screenWidth) {
970                $('.rh_prop_compare__column .property-thumbnail').stick_in_parent()
971                    .on("sticky_kit:stick", function (e) {
972                        $('.rh_prop_compare__column > p:nth-child(odd)').css({
973                            'background': '#F7F7F7'
974                        });
975                        $('.rh_prop_compare__column > p:nth-child(even)').css({
976                            'background': '#ffffff'
977                        });
978                        var heightThumbnail = $('.rh_prop_compare__column .property-thumbnail').height();
979                        $('.rh_prop_compare__column > div:nth-child(2)').css({
980                            'height': heightThumbnail
981                        });
982                    })
983                    .on("sticky_kit:unstick", function (e) {
984                    });
985            } else {
986                $('.rh_prop_compare__column .property-thumbnail').trigger("sticky_kit:detach");
987            }
988        };
989
990        makeSticky();
991        // Execute again when browser resizes.
992        $(window).on('resize', function () {
993            makeSticky();
994        });
995
996        /*-----------------------------------------------------------------------------------*/
997        /* Hide the note
998         /*-----------------------------------------------------------------------------------*/
999        $('.icon-remove').on('click', function (e) {
1000            e.preventDefault();
1001            $(this).parent().fadeOut(200);
1002        });
1003
1004        /*-----------------------------------------------------------------------------------*/
1005        /* Homepage - CTA Buttons Width
1006         /*-----------------------------------------------------------------------------------*/
1007        if ($('.rh_cta__btns .rh_btn--blackBG').length > 0 || $('.rh_cta__btns .rh_btn--whiteBG').length > 0) {
1008            var w1 = $('.rh_cta__btns .rh_btn--blackBG').outerWidth();
1009            var w2 = $('.rh_cta__btns .rh_btn--whiteBG').outerWidth();
1010
1011            if (w1 > w2) {
1012                $('.rh_cta__btns .rh_btn--whiteBG').css('width', w1 + "px");
1013            } else {
1014                $('.rh_cta__btns .rh_btn--blackBG').css('width', w2 + "px");
1015            }
1016        }
1017        if ($('.rh_cta__btns .rh_btn--secondary').length > 0 || $('.rh_cta__btns .rh_btn--greyBG').length > 0) {
1018            var w1 = $('.rh_cta__btns .rh_btn--secondary').outerWidth();
1019            var w2 = $('.rh_cta__btns .rh_btn--greyBG').outerWidth();
1020
1021            if (w1 > w2) {
1022                $('.rh_cta__btns .rh_btn--greyBG').css('width', w1 + "px");
1023            } else {
1024                $('.rh_cta__btns .rh_btn--secondary').css('width', w2 + "px");
1025            }
1026        }
1027
1028        /*-----------------------------------------------------------------------------------*/
1029        /* Optima Express IDX Support
1030         /*-----------------------------------------------------------------------------------*/
1031        $('.ihf-grid-result-mlsnum-proptype').parent().parent().find('.col-xs-9').toggleClass('col-xs-12');
1032        $('#ihf-main-container .ihf-detail-back-to-results a').html('<span class="fas fa-angle-left"></span><span class="rh_back-link"> Back to Results</span>');
1033
1034        /*-----------------------------------------------------------------------------------*/
1035        /*  Post Nav Support
1036         /*-----------------------------------------------------------------------------------*/
1037        $(function () {
1038            var post_nav = $('.inspiry-post-nav');
1039            $(window).on('scroll', function () {
1040                if ($(window).width() > 980) {
1041                    if ($(this).scrollTop() > 650) {
1042                        post_nav.fadeIn('fast');
1043                        return;
1044                    }
1045                }
1046                post_nav.fadeOut('fast');
1047            });
1048        });
1049
1050        /*-----------------------------------------------------------------------------------*/
1051        /*  Property Ratings
1052         /*-----------------------------------------------------------------------------------*/
1053        if (jQuery().barrating) {
1054            $('#rate-it').barrating({
1055                theme: 'fontawesome-stars',
1056                initialRating: 5,
1057            });
1058        }
1059
1060        /*-----------------------------------------------------------------------------------*/
1061        /* Home page properties pagination
1062         /*-----------------------------------------------------------------------------------*/
1063        var homePropertiesSection = $('#home-properties-section');
1064
1065        // if homepage
1066        if (homePropertiesSection.length && homePropertiesSection.hasClass('ajax-pagination')) {
1067
1068            $(document).on('click', '#home-properties-section .pagination > a', function (e) {
1069                e.preventDefault();
1070                var homePropertiesContainer = $('#home-properties-section-wrapper', homePropertiesSection);
1071                var paginationLinks = $('.pagination > a', homePropertiesSection);
1072                var svgLoader = $('.svg-loader', homePropertiesSection);
1073                var currentButton = $(this);
1074                svgLoader.slideDown('fast');
1075                homePropertiesContainer.fadeTo('slow', 0.5);
1076                paginationLinks.removeClass('current');
1077                currentButton.addClass('current');
1078                homePropertiesContainer.load(
1079                    currentButton.attr('href') + ' ' + '#home-properties-section-inner',
1080                    function (response, status, xhr) {
1081                        if (status == 'success') {
1082                            homePropertiesContainer.fadeTo(100, 1, function () {
1083                            });
1084                            svgLoader.slideUp('fast');
1085
1086                            $('html, body').animate({
1087                                scrollTop: homePropertiesSection.find('.rh_section__properties').offset().top-32
1088                            }, 1000);
1089
1090                        } else {
1091                            homePropertiesContainer.fadeTo('slow', 1);
1092                        }
1093                    }
1094                );
1095            });
1096        }
1097
1098        $(window).on('load', function () {
1099
1100            $('.rh_prop_compare__row').fadeTo(600, 1);
1101
1102            // Add equal heights to all the rows of all the columns
1103            var screenWidth = $(window).width();
1104            var rowHeight = -1;
1105
1106            $('.rh_prop_compare__details .rh_prop_compare__column p').each(function () {
1107                rowHeight = rowHeight > $(this).outerHeight() ? rowHeight : $(this).outerHeight();
1108            });
1109
1110            $('.rh_prop_compare__details .rh_prop_compare__column > p').css({
1111                height: rowHeight
1112            });
1113
1114            $('.rh_prop_compare__details .rh_prop_compare__column .property-thumbn
1114ail').each(function () {
1115                rowHeight = rowHeight > $(this).outerHeight() ? rowHeight : $(this).outerHeight();
1116            });
1117
1118            $('.rh_prop_compare__details .rh_prop_compare__column > .property-thumbnail').css({
1119                height: rowHeight
1120            });
1121
1122            /*-------------------------------------------------------*/
1123            /*  Isotope
1124             /*------------------------------------------------------*/
1125            if (jQuery().isotope) {
1126                var container = $('.isotope'),
1127                    filterLinks = $('#filter-by a');
1128
1129                /* to fix floating bugs due to variation in height */
1130                setTimeout(function () {
1131                    container.isotope({
1132                        filter: "*",
1133                        layoutMode: 'fitRows',
1134                        itemSelector: '.isotope-item',
1135                        animationEngine: 'best-available'
1136                    });
1137                }, 1000);
1138
1139                filterLinks.on('click', function (e) {
1140                    var selector = $(this).attr('data-filter');
1141                    container.isotope({filter: '.' + selector});
1142                    filterLinks.removeClass('active');
1143                    $('#filter-by li').removeClass('current-cat');
1144                    $(this).addClass('active');
1145                    e.preventDefault();
1146                });
1147            }
1148        });
1149
1150        //Scoll effect
1151        function isInViewport(node) {
1152            var rect = node.getBoundingClientRect()
1153            return (
1154                (rect.height > 0 || rect.width > 0) &&
1155                rect.bottom >= 0 &&
1156                rect.right >= 0 &&
1157                rect.top <= (window.innerHeight || document.documentElement.clientHeight) &&
1158                rect.left <= (window.innerWidth || document.documentElement.clientWidth)
1159            )
1160        }
1161
1162        function scrollParallax(selector) {
1163            var scrolled = $(window).scrollTop();
1164            $(selector).each(function (index, element) {
1165                var initY = $(this).offset().top;
1166                var height = $(this).height();
1167                var endY = initY + $(this).height();
1168
1169                // Check if the element is in the viewport.
1170                var visible = isInViewport(this);
1171                if (visible) {
1172                    var diff = -scrolled + initY;
1173                    var ratio = Math.round((diff / height) * 100);
1174                    $(this).css('background-position', 'center ' + parseInt(-(ratio)) + 'px')
1175                }
1176
1177            })
1178        }
1179
1180        function parallaxBanner(selector, unit, speed) {
1181            var docHeight = $(document).height();
1182            var scrolled = $(window).scrollTop();
1183
1184            var parallaxSpeed = (0 + (speed * (scrolled / docHeight)));
1185
1186            $(selector).css('background-position', 'center ' + parallaxSpeed + unit);
1187        }
1188
1189        function parallaxBannerReverse(selector, unit, speed) {
1190            var docHeight = $(document).height();
1191            var scrolled = $(window).scrollTop();
1192
1193            var parallaxSpeed = (0 - (speed * (scrolled / docHeight)));
1194
1195            $(selector).css('background-position', 'center ' + parallaxSpeed + unit);
1196        }
1197
1198        $(window).on('scroll', function () {
1199            // scrollParallax('.rh_mod_parallax_sfoi');
1200            scrollParallax('.rh_parallax_cta');
1201            scrollParallax('.rh_parallax');
1202            parallaxBanner('.rh_banner__image', '%', 150);
1203            parallaxBannerReverse('.rh_mod_parallax_sfoi', '%', 300);
1204
1205
1206
1207        });
1208
1209        //mobile dives user nav menu position
1210        function userNavPosition(selector) {
1211            if (window.matchMedia('(max-width: 767px)').matches) {
1212                var getHeaderHeight = $('.rh_header__wrap').height();
1213                var getBarHeight = $('.rh_menu__user').height();
1214                var getTopHeight = getHeaderHeight - getBarHeight;
1215                $(selector).css('top', getTopHeight / 2 + 'px');
1216            } else {
1217                $(selector).css('top', 'auto');
1218            }
1219        }
1220
1221        userNavPosition('.rh_header_advance .user_menu_wrapper');
1222        userNavPosition('.rh_header_advance .rh_menu .main-menu');
1223
1224        $(window).on('resize', function () {
1225            userNavPosition('.rh_header_advance .user_menu_wrapper');
1226            userNavPosition('.rh_header_advance .rh_menu .main-menu');
1227        });
1228
1229        //Function to add Whatsapp sharing
1230        function decorateWhatsAppLink() {
1231            //set up the url
1232            var url = 'https://api.whatsapp.com/send?text=';
1233
1234            var thisShareData = $('.share-this');
1235
1236            //get property title
1237            var name = thisShareData.data('property-name');
1238
1239            //get property permalink
1240            var permalink = thisShareData.data('property-permalink');
1241
1242            //encode the text
1243            var encodedText = encodeURIComponent(name + ' ' + permalink);
1244
1245            //find the link
1246            var whatsApp = $(".inspiry_whats_app_share_link");
1247            //set the href attribute on the link
1248            whatsApp.attr('href', url + encodedText);
1249        }
1250
1251        decorateWhatsAppLink();
1252    });
1253
1254    /*-------------------------------------------------------*/
1255    /*  Stick Half Map
1256     /*------------------------------------------------------*/
1257    function setHalfMapFixed( bodyClass) {
1258
1259        if($('body').hasClass(bodyClass)){
1260
1261            var parentBodyClass = $('.'+bodyClass); // body class
1262
1263            var getHeaderHeight = parentBodyClass.find('.inspiry_half_map_header_wrapper').height(); // get banner height
1264
1265            var getSearchForm  = parentBodyClass.find('.rh_prop_search').outerHeight();
1266
1267
1268            thisContentHeight = 0;
1269            if ($( ".rh_content_above_footer" ) && $( ".rh_content_above_footer" ).length ) {
1270                var thisContentHeight = $('.rh_content_above_footer').outerHeight(true);
1271            }
1272
1273            var adminbarMargin = 0;
1274            if($('body').hasClass('admin-bar')){
1275                 adminbarMargin = 32;
1276            }
1277
1278            var thisMapWrapper = parentBodyClass.find('#map-head');// map wrapper
1279
1280            var getLoadOffSet = $(document).scrollTop(); // get header offset on time of document load
1281
1282
1283
1284            thisMapWrapper.css('top',adminbarMargin + Math.max(0 ,getHeaderHeight - getLoadOffSet));
1285
1286            var thisStickyFooter = parentBodyClass.find('.rh_sticky_wrapper_footer'); // footer wrapper
1287
1288            var getFooterHeight = thisStickyFooter.height(); //get footer height
1289
1290            var footerFromTop = thisStickyFooter.offset().top - window.innerHeight; // get offset of footer from top
1291            
1292            $(document).on('scroll',function () {
1293                var getOffSet = $(document).scrollTop(); // get scroll off set
1294
1295                var currentOffSet = getHeaderHeight - getOffSet;
1296
1297                currentOffSet =  Math.max(0,currentOffSet); //set current offset of the map to scroll till map reached top
1298
1299
1300                thisMapWrapper.css('top',adminbarMargin+currentOffSet);
1301
1302                var footerOffSet =  - getFooterHeight + thisContentHeight + getOffSet; // get current offset value of footer on scroll
1303
1304
1305                if(footerOffSet > footerFromTop){
1306                    thisMapWrapper.css('top',footerFromTop - footerOffSet + getSearchForm);
1307                }
1308
1309            });
1310
1311        }
1312    }
1313
1314    $(document).on('ready',  setHalfMapFixed('inspiry_half_map_fixed'));
1315
1316
1317    /*-------------------------------------------------------*/
1318
1319    /*  Stick Footer Bottom
1320    /*------------------------------------------------------*/
1321
1322    function footerStick() {
1323        var footerHeight = $('.rh_sticky_wrapper_footer').outerHeight();
1324        $('.rh_wrap_stick_footer').css('padding-bottom', footerHeight + 'px')
1325    }
1326
1327    $(document).on('ready', footerStick);
1328    $(window).on('load ', function () {
1329        setTimeout(footerStick, 500);
1330    });
1331    $(window).on('resize', footerStick);
1332
1333})(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.