/** * Javascript to handle Google Map for contact pages. */ ( function ( $ ) { "use strict"; const mapContainer = document.getElementById( "map_canvas" ); if ( typeof contactMapData === "undefined" && mapContainer === null ) { return; } if ( ! contactMapData.lat && ! contactMapData.lng ) { return; } const officeLocation = new google.maps.LatLng( parseFloat( contactMapData.lat ), parseFloat( contactMapData.lng ) ); let styles, mapZoom = 14; if ( contactMapData.zoom ) { mapZoom = parseInt( contactMapData.zoom ); } if ( rhMapsData.isUltra ) { styles = [{ "featureType" : "landscape.natural", "stylers" : [{ "color" : "#bcddff" }] }, { "featureType" : "road.highway", "elementType" : "geometry.fill", "stylers" : [{ "color" : "#5fb3ff" }] }, { "featureType" : "road.arterial", "stylers" : [{ "color" : "#ebf4ff" }] }, { "featureType" : "road.local", "elementType" : "geometry.fill", "stylers" : [{ "color" : "#ebf4ff" }] }, { "featureType" : "road.local", "elementType" : "geometry.stroke", "stylers" : [{ "visibility" : "on" }, { "color" : "#93c8ff" }] }, { "featureType" : "landscape.man_made", "elementType" : "geometry", "stylers" : [{ "color" : "#c7e2ff" }] }, { "featureType" : "transit.station.airport", "elementType" : "geometry", "stylers" : [{ "saturation" : 100 }, { "gamma" : 0.82 }, { "hue" : "#0088ff" }] }, { "elementType" : "labels.text.fill", "stylers" : [{ "color" : "#1673cb" }] }, { "featureType" : "road.highway", "elementType" : "labels.icon", "stylers" : [{ "saturation" : 58 }, { "hue" : "#006eff" }] }, { "featureType" : "poi", "elementType" : "geometry", "stylers" : [{ "color" : "#4797e0" }] }, { "featureType" : "poi.park", "elementType" : "geometry", "stylers" : [{ "color" : "#209ee1" }, { "lightness" : 49 }] }, { "featureType" : "transit.line", "elementType" : "geometry.fill", "stylers" : [{ "color" : "#83befc" }] }, { "featureType" : "road.highway", "elementType" : "geometry.stroke", "stylers" : [{ "color" : "#3ea3ff" }] }, { "featureType" : "administrative", "elementType" : "geometry.stroke", "stylers" : [{ "saturation" : 86 }, { "hue" : "#0077ff" }, { "weight" : 0.8 }] }, { "elementType" : "labels.icon", "stylers" : [{ "hue" : "#0066ff" }, { "weight" : 1.9 }] }, { "featureType" : "poi", "elementType" : "geometry.fill", "stylers" : [{ "hue" : "#0077ff" }, { "saturation" : -7 }, { "lightness" : 24 }] }, { "featureType" : "water", "elementType" : "all", "stylers" : [{ "color" : contactMapData.mapWaterColor }, { "visibility" : "on" }] }]; } else if ( rhMapsData.isModern ) { styles = [{ "featureType" : "administrative", "elementType" : "labels.text", "stylers" : [{ "color" : "#000000" }] }, { "featureType" : "administrative", "elementType" : "labels.text.fill", "stylers" : [{ "color" : "#444444" }] }, { "featureType" : "administrative", "elementType" : "labels.text.stroke", "stylers" : [{ "visibility" : "off" }] }, { "featureType" : "administrative", "elementType" : "labels.icon", "stylers" : [{ "visibility" : "on" }, { "color" : "#380d0d" }] }, { "featureType" : "landscape", "elementType" : "all", "stylers" : [{ "color" : "#f2f2f2" }] }, { "featureType" : "poi", "elementType" : "all", "stylers" : [{ "visibility" : "off" }] }, { "featureType" : "road", "elementType" : "all", "stylers" : [{ "saturation" : -100 }, { "lightness" : 45 }] }, { "featureType" : "road", "elementType" : "geometry", "stylers" : [{ "visibility" : "on" }, { "color" : "#dedddb" }] }, { "featureType" : "road", "elementType" : "labels.text", "stylers" : [{ "color" : "#000000" }] }, { "featureType" : "road", "elementType" : "labels.text.fill", "stylers" : [{ "color" : "#1f1b1b" }] }, { "featureType" : "road", "elementType" : "labels.text.stroke", "stylers" : [{ "visibility" : "off" }] }, { "featureType" : "road", "elementType" : "labels.icon", "stylers" : [{ "visibility" : "on" }, { "hue" : "#ff0000" }] }, { "featureType" : "road.highway", "elementType" : "all", "stylers" : [{ "visibility" : "simplified" }] }, { "featureType" : "road.arterial", "elementType" : "labels.icon", "stylers" : [{ "visibility" : "off" }] }, { "featureType" : "transit", "elementType" : "all", "stylers" : [{ "visibility" : "off" }] }, { "featureType" : "water", "elementType" : "all", "stylers" : [{ "color" : contactMapData.mapWaterColor }, { "visibility" : "on" }] }]; } const contactMapOptions = { center : officeLocation, zoom : mapZoom, scrollwheel : false, styles : styles }; // Map Styles if ( undefined !== contactMapData.styles ) { contactMapOptions.styles = JSON.parse( contactMapData.styles ); } // Setting Google Map Type switch ( contactMapData.type ) { case 'satellite': contactMapOptions.mapTypeId = google.maps.MapTypeId.SATELLITE; break; case 'hybrid': contactMapOptions.mapTypeId = google.maps.MapTypeId.HYBRID; break; case 'terrain': contactMapOptions.mapTypeId = google.maps.MapTypeId.TERRAIN; break; default: contactMapOptions.mapTypeId = google.maps.MapTypeId.ROADMAP; } let iconURL = ""; if ( contactMapData.iconURL ) { iconURL = contactMapData.iconURL; } const contactMap = new google.maps.Map( mapContainer, contactMapOptions ), contactMarker = new google.maps.Marker( { position : officeLocation, map : contactMap, icon : iconURL } ); } )( jQuery );; /** * JavaScript Related to Search Form */ (function ($) { "use strict"; /** * Change Min and Max Price fields based on selected status for rent */ if ( localizedSearchParams.rent_slug !== undefined) { var property_status_changed = function (new_status) { var price_for_others = $('.advance-search-form .price-for-others'); var price_for_rent = $('.advance-search-form .price-for-rent'); if (price_for_others.length > 0 && price_for_rent.length > 0) { if (new_status == localizedSearchParams.rent_slug) { price_for_others.addClass('hide-fields').find('select').prop('disabled', true); price_for_rent.removeClass('hide-fields').find('select').prop('disabled', false); } else { price_for_rent.addClass('hide-fields').find('select').prop('disabled', true); price_for_others.removeClass('hide-fields').find('select').prop('disabled', false); } } } $('.advance-search-form #select-status').change(function (e) { var selected_status = $(this).val(); property_status_changed(selected_status); }); /* On page load ( as on search page ) */ var selected_status = $('.advance-search-form #select-status').val(); if (selected_status == localizedSearchParams.rent_slug) { property_status_changed(selected_status); } } /** * Max and Min Price * Shows red outline if min price is bigger than max price */ /* for normal prices */ $('#select-min-price,#select-max-price').change(function (obj, e) { var min_text_val = $('#select-min-price').val(); var min_int_val = (isNaN(min_text_val)) ? 0 : parseInt(min_text_val); var max_text_val = $('#select-max-price').val(); var max_int_val = (isNaN(max_text_val)) ? 0 : parseInt(max_text_val); if ((min_int_val >= max_int_val) && (min_int_val != 0) && (max_int_val != 0)) { $('#select-min-price,#select-max-price').siblings('button.dropdown-toggle').css('outline', '1px solid red'); } else { $('#select-min-price,#select-max-price').siblings('button.dropdown-toggle').css('outline', 'none'); } }); /* for rent prices */ $('#select-min-price-for-rent, #select-max-price-for-rent').change(function (obj, e) { var min_text_val = $('#select-min-price-for-rent').val(); var min_int_val = (isNaN(min_text_val)) ? 0 : parseInt(min_text_val); var max_text_val = $('#select-max-price-for-rent').val(); var max_int_val = (isNaN(max_text_val)) ? 0 : parseInt(max_text_val); if ((min_int_val >= max_int_val) && (min_int_val != 0) && (max_int_val != 0)) { $('#select-min-price-for-rent, #select-max-price-for-rent').siblings('button.dropdown-toggle').css('outline', '1px solid red'); } else { $('#select-min-price-for-rent, #select-max-price-for-rent').siblings('button.dropdown-toggle').css('outline', 'none'); } }); /** * Max and Min Area * To show red outline if min is bigger than max */ $('#min-area,#max-area').change(function (obj, e) { var min_text_val = $('#min-area').val(); var min_int_val = (isNaN(min_text_val)) ? 0 : parseInt(min_text_val); var max_text_val = $('#max-area').val(); var max_int_val = (isNaN(max_text_val)) ? 0 : parseInt(max_text_val); if ((min_int_val >= max_int_val) && (min_int_val != 0) && (max_int_val != 0)) { $('#min-area,#max-area').css('outline', '1px solid red'); } else { $('#min-area,#max-area').css('outline', 'none'); } }); /** * Disable empty values on submission to reduce query string size */ $('.advance-search-form').submit(function (event) { var searchFormElements = $(this).find(':input'); $.each(searchFormElements, function (index, element) { if (element.value == '' || element.value == 'any') { if (!element.disabled) { element.disabled = true; } } }); }); /** * Add to compare -- Search Page */ function removeBorder () { let screenWidth = $(window).width(); let isRtl = $('body').hasClass('rtl'); if ((979 < screenWidth && 1200 > screenWidth) || (767 >= screenWidth && 500 <= screenWidth)) { if (!isRtl) { let addToCompareSpan = $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').length; if (addToCompareSpan) { $('.page-template-template-search .property-item .compare-meta span').css({ 'border': 'none' }); $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').css({ 'margin-right': '-20px', 'border-left': 'none' }); } } else { let addToCompareSpan = $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').length; if (addToCompareSpan) { $('.page-template-template-search .property-item .compare-meta span').css({ 'border-left': 'none' }); $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').css({ 'margin-left': '-20px', 'border-right': 'none', 'float': 'left' }); } } } else if (500 <= screenWidth) { if (!isRtl) { let addToCompareSpan = $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').length; if (addToCompareSpan) { $('.page-template-template-search .property-item .compare-meta span:nth-last-child(2)').css({ 'border': 'none' }); $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').css({ 'margin-right': '-20px', 'border-left': '1px solid #dedede' }); } } else { let addToCompareSpan = $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').length; if (addToCompareSpan) { $('.page-template-template-search .property-item .compare-meta span:nth-last-child(2)').css({ 'border': 'none' }); $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').css({ 'margin-left': '-20px', 'border-right': '1px solid #dedede', 'float': 'left' }); } } } else { if (!isRtl) { let addToCompareSpan = $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').length; if (addToCompareSpan) { $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').css({ 'margin-right': '0', 'border-left': 'none' }); } } else { let addToCompareSpan = $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').length; if (addToCompareSpan) { $('.page-template-template-search .property-item .compare-meta span.add-to-compare-span').css({ 'margin-right': '0', 'border-left': 'none', 'float': 'right' }); } } } } removeBorder(); /* Execute again on window resize. */ $(window).on('resize', function () { removeBorder(); }); /** * Ajax Search for keyword in Search Form */ $(document).ready(function () { $('#keyword-txt').keyup(function () { var words = $(this).val().split(' '); var wordcounts = words.length; if (wordcounts > 1) { $('.rh_sfoi_data_fetch_list').slideDown(); $('.rh_sfoi_ajax_loader').show(); $.ajax({ url: frontEndAjaxUrl.sfoiajaxurl, type: 'POST', data: { action: 'rh_sfoi_data_fetch', keyword: $(this).val() }, success: function (data) { $('.rh_sfoi_data_fetch_list').html(data); $('.rh_sfoi_ajax_loader').hide(); } }); } else { $('.rh_sfoi_data_fetch_list').slideUp(); } }); }); })(jQuery); ; ( function ( $ ) { "use strict"; const $window = $( window ), $body = $( 'body' ), isRtl = $body.hasClass( 'rtl' ); /** * Sticky footer related code. */ function footerStick() { $( '.rh_wrap_stick_footer' ).css( 'padding-bottom', $( '.rh_sticky_wrapper_footer' ).outerHeight() + 'px' ) } /** * Form AJAX validation and submission * Validation Plugin : https://jqueryvalidation.org/ * Form Ajax Plugin : http://www.malsup.com/jquery/form/ * * @since 4.0.0 */ function realhomesValidateForm( form_id ) { const form = $( form_id ); if ( ! form.length ) { return false; } const submitButton = form.find( '.submit-button' ), ajaxLoader = form.find( '.ajax-loader' ), messageContainer = form.find( '.message-container' ), errorContainer = form.find( ".error-container" ), formOptions = { beforeSubmit : function () { submitButton.attr( 'disabled', 'disabled' ); ajaxLoader.fadeIn( 'fast' ); messageContainer.fadeOut( 'fast' ); errorContainer.fadeOut( 'fast' ); }, success : function ( ajax_response, statusText, xhr, $form ) { const response = $.parseJSON( ajax_response ); ajaxLoader.fadeOut( 'fast' ); submitButton.removeAttr( 'disabled' ); if ( response.success ) { form.resetForm(); messageContainer.html( response.message ).fadeIn( 'fast' ); // call reset function if it exists if ( typeof inspiryResetReCAPTCHA == 'function' ) { inspiryResetReCAPTCHA(); } if ( typeof contactFromData !== 'undefined' ) { setTimeout( function () { window.location.replace( contactFromData.redirectPageUrl ); }, 1000 ); } else { setTimeout( function () { messageContainer.fadeOut( 'slow' ) }, 3000 ); } } else { errorContainer.html( response.message ).fadeIn( 'fast' ); } } }; if ( jQuery().validate && jQuery().ajaxSubmit ) { form.validate( { errorLabelContainer : errorContainer, submitHandler : function ( form ) { $( form ).ajaxSubmit( formOptions ); } } ); } } // Contact form realhomesValidateForm( '#contact-form' ); // Agent contact form realhomesValidateForm( '#agent-single-form' ); // Agency contact form realhomesValidateForm( '#agency-single-form' ); // Schedule A Tour form realhomesValidateForm( '#schedule-a-tour' ); /** * Sticky Header * * @since 4.0.0 */ $( function () { const stickyHeader = $( '.rh-sticky-header' ); if ( stickyHeader.length ) { const headerHeight = stickyHeader.height(); $window.on( 'scroll', function () { let $this = $( this ); if ( $this.width() > 1024 ) { if ( $this.scrollTop() > ( headerHeight + 100 ) ) { stickyHeader.addClass( 'sticked' ); } else { stickyHeader.removeClass( 'sticked' ); } } } ); } } ); $( document ).ready( function () { /** * Datepicker for Single Property */ let singleProperty = document.querySelector( '.single-property' ); if ( singleProperty ) { let satForm = document.getElementById( 'schedule-a-tour' ); if ( satForm ) { $( "#sat-date" ).datepicker( { minDate : 0, showAnim : 'slideDown', beforeShow : function ( input, inst ) { inst.dpDiv[0].classList.add( 'schedule-section-wrapper' ); } } ); } } /** * Sliders */ if ( jQuery().flexslider ) { // Gallery Post Slider const galleryPostSlider = $( '.gallery-post-slider' ); if ( galleryPostSlider.length ) { galleryPostSlider.flexslider( { animation : "slide", slideshow : false, controlNav : false, prevText : "", nextText : "", start : function ( slider ) { galleryPostSlider.find( '.clone' ).children().removeAttr( "data-fancybox" ); } } ); } } /** * Single Property Slider */ var singlePropertySlider = $( '.rh-ultra-property-slider' ); var singlePropertyCarousel = $( '.rh-ultra-horizontal-carousel-trigger' ); var singlePropertyVerticalCarousel = $( '.rh-ultra-vertical-carousel-trigger' ); // Responsive Nav $( '.rh-ultra-responsive-nav' ).hcOffcanvasNav( { disableAt : 1139, insertClose : true, insertBack : true, labelClose : mobileNavLabels.labelClose, labelBack : mobileNavLabels.labelBack, levelSpacing : 40, // levelTitleAsBack: true, // pushContent: '.rh_section', customToggle : '.rh-responsive-toggle' } ); // TODO: Dynamic Slides counter in future // if ( singlePropertySlider.length ) { // var currentSlide; // var slidesCount; // var sliderCounter = $( '.rh-slider-item-total' ); // // var rhUpdateSliderCounter = function ( slick, currentIndex ) { // // currentSlide = slick.slickCurrentSlide() + 1; // slidesCount = slick.slideCount; // // jQuery(sliderCounter).text(currentSlide + '/' + slidesCount) // // // if ( currentSlide - slidesCount !== 0 ) { // $( sliderCounter ).text( slidesCount - currentSlide ); // } else { // $( sliderCounter ).text( slidesCount ); // } // }; // // singlePropertySlider.on( 'init', function ( event, slick ) { // // $slider.append(sliderCounter); // rhUpdateSliderCounter( slick ); // } ); // // singlePropertySlider.on( 'afterChange', function ( event, slick, currentSlide ) { // rhUpdateSliderCounter( slick, currentSlide ); // } ); // // } let syncEnable = ''; let centerMode = false; singlePropertyCarousel.on( 'init', function ( event, slick ) { if ( singlePropertyCarousel.data( 'count' ) > singlePropertyCarousel.find( '.slick-active' ).length ) { syncEnable = singlePropertyCarousel; centerMode = true; } } ); singlePropertyVerticalCarousel.on( 'init', function ( event, slick ) { if ( singlePropertyVerticalCarousel.data( 'count' ) > singlePropertyVerticalCarousel.find( '.slick-active' ).length ) { syncEnable = singlePropertyCarousel; centerMode = true; } } ); singlePropertySlider.on( 'init afterChange', function ( event, slick ) { if ( syncEnable === '' ) { singlePropertyCarousel.find( '.slick-slide' ).removeClass( 'slick-current' ); singlePropertyCarousel.find( '.slick-slide' ).eq( slick.currentSlide ).addClass( "slick-current" ); } } ); singlePropertyCarousel.slick( { slidesToShow : 6, slidesToScroll : 1, asNavFor : singlePropertySlider, // dots: false, infinite : true, centerMode : centerMode, focusOnSelect : true, touchThreshold : 200, arrows : false, centerPadding : '0', rtl : isRtl, responsive : [ { breakpoint : 1200, settings : { slidesToShow : 4 } }, { breakpoint : 767, settings : { slidesToShow : 3 } } ] } ); singlePropertyVerticalCarousel.slick( { slidesToShow : 3, vertical : true, verticalSwiping : true, slidesToScroll : 1, asNavFor : singlePropertySlider, // dots: false, infinite : true, centerMode : centerMode, focusOnSelect : true, touchThreshold : 200, arrows : false, centerPadding : '0', responsive : [ { breakpoint : 1200, settings : { slidesToShow : 3, vertical : false, verticalSwiping : false, rtl : isRtl } } ] } ); singlePropertySlider.slick( { slidesToShow : 1, slidesToScroll : 1, arrows : true, fade : true, adaptiveHeight : true, infinite : true, rtl : isRtl, asNavFor : syncEnable // asNavFor: singlePropertyCarousel, } ); /** * Property Ratings */ if ( jQuery().barrating ) { $( '#rate-it' ).barrating( { theme : 'fontawesome-stars', initialRating : 5 } ); } /** * AJAX Pagination for Listing & Archive Pages */ const propertiesSection = $( '#properties-listing' ); if ( propertiesSection.hasClass( 'ajax-pagination' ) ) { const propertiesContainer = propertiesSection.find( '.rh-ultra-list-box, .rh-ultra-grid-box' ), svgLoader = propertiesSection.find( '.svg-loader' ), paginationContainer = $( '.rh_pagination' ), statsContainer = $( '.rh_pagination__stats' ), mapServiceType = localized.mapService.toString(), page_id = statsContainer.data( 'page-id' ); let cards_container = 'rh-ultra-list-box'; if ( propertiesSection.find( '.rh-ultra-grid-box' ).length ) { cards_container = 'rh-ultra-grid-box'; } $( 'body' ).on( 'click', '.rh-ultra-pagination .rh_pagination > a', function ( e ) { e.preventDefault(); let currentButton = $( this ); svgLoader.slideDown( 'fast' ); propertiesContainer.fadeTo( 'slow', 0.5 ); $( '.rh_pagination > a' ).removeClass( 'current' ); currentButton.addClass( 'current' ); let current_page = parseInt( currentButton.attr( 'data-page-number' ) ); statsContainer.attr( 'data-page', current_page ); paginationContainer.load( currentButton.attr( 'href' ) + ' ' + '.rh_pagination' ); statsContainer.load( currentButton.attr( 'href' ) + ' ' + '.rh_pagination__stats' ); let url = currentButton.attr( 'href' ) + ' ' + '.' + cards_container + ' > *'; propertiesContainer.load( url, function ( response, status, xhr ) { if ( status == 'success' ) { propertiesContainer.fadeTo( 100, 1, function () { } ); svgLoader.slideUp( 'fast' ); $( 'html, body' ).animate( { scrollTop : propertiesSection.find( '.' + cards_container ).offset().top - 120 }, 1000 ); inspirySelectPicker( 'body .inspiry_select_picker_trigger' ); rhUltraTooltip( '.rh-ui-tooltip' ); } else { propertiesContainer.fadeTo( 'slow', 1 ); } if ( typeof realhomesInfoboxPopupTrigger === 'function' ) { realhomesInfoboxPopupTrigger(); } // Binding Favorites & Compare Properties Features if ( typeof realhomes_update_favorites === 'function' ) { realhomes_update_favorites(); } if ( typeof realhomes_update_compare_properties === 'function' ) { realhomes_update_compare_properties(); } } ); // If this pagination is for ajax search results if ( propertiesSection.hasClass( 'realhomes_ajax_search' ) ) { realhomes_update_ajax_map_results( current_page ); let currentQueryStrings = statsContainer.data( 'query-strings' ); let searchURL = $( '.rh_page' ).data( 'search-url' ); if ( current_page === 1 ) { window.history.pushState( {}, '', searchURL + currentQueryStrings ); } else { window.history.pushState( {}, '', searchURL + 'page/' + current_page + '/' + currentQueryStrings ); } } else { $.ajax( { url : ajaxurl, type : 'post', data : { action : 'realhomes_map_ajax_search_results', page_id : page_id, page : current_page }, success : ( response ) => { let propertiesMapData = response.data.propertiesData; if ( typeof realhomes_update_open_street_map !== 'undefined' && typeof mapServiceType !== "undefined" && mapServiceType === 'openstreetmaps' ) { realhomes_update_open_street_map( propertiesMapData ); } else if ( typeof realhomes_update_mapbox !== 'undefined' && typeof mapServiceType !== "undefined" && mapServiceType === 'mapbox' ) { $( '#map-head' ).empty().append( '
' ); realhomes_update_mapbox( propertiesMapData ); } else if ( typeof realhomes_update_google_map !== 'undefined' ) { realhomes_update_google_map( propertiesMapData ); } } } ); window.history.pushState( {}, '', currentButton.attr( 'href' ) ); } window.history.pushState( {}, '', currentButton.attr( 'href' ) ); } ); } /** * Property Floor Plans */ $( '.rh-floor-plan-tab' ).click( function ( e ) { e.preventDefault(); if ( ! $( this ).hasClass( 'rh-current-tab' ) ) { $( '.rh-floor-plan-tab' ).removeClass( 'rh-current-tab' ); $( this ).addClass( 'rh-current-tab' ); $( ".rh-floor-plan" ).removeClass( 'rh-active-tab' ); $( ".rh-floor-plan[data-id='" + $( this ).attr( 'data-id' ) + "']" ).addClass( "rh-active-tab" ); } } ); $( '.rh_wrapper_property_videos_slider' ).slick( { slidesToShow : 1, slidesToScroll : 1, arrows : false, dots : true, fade : true } ); /** * Post Nav Support */ $( function () { var post_nav = $( '.inspiry-post-nav' ); $( window ).on( 'scroll', function () { if ( $( window ).width() > 980 ) { if ( $( this ).scrollTop() > 650 ) { post_nav.fadeIn( 'fast' ).css( "display", "flex" ); return; } } post_nav.fadeOut( 'fast' ); } ); } ); /** * Scroll to Top */ $( function () { const scroll_anchor = $( '#scroll-top' ); $( window ).on( 'scroll', function () { if ( $( this ).scrollTop() > 250 ) { scroll_anchor.addClass( 'show' ); return; } scroll_anchor.removeClass( 'show' ); } ); scroll_anchor.on( 'click', function ( event ) { event.preventDefault(); $( 'html, body' ).animate( { scrollTop : 0 }, 'slow' ); } ); } ); /** * Sidebar Properties Sliders */ var ereSideBarSlider = $( '.ere-ultra-properties-slider' ); ereSideBarSlider.each( function () { var thisContainer = $( this ).next( '.rh-ultra-widget-dots' ); $( this ).owlCarousel( { stagePadding : 0, singleItem : true, loop : false, dots : true, nav : true, items : 1, margin : 10, navText : ['', ''], dotsContainer : thisContainer } ); } ); /** * Properties Sorting */ function insertParam( key, value ) { key = encodeURI( key ); value = encodeURI( value ); var kvp = document.location.search.substr( 1 ).split( '&' ); var i = kvp.length; var x; while ( i-- ) { x = kvp[i].split( '=' ); if ( x[0] == key ) { x[1] = value; kvp[i] = x.join( '=' ); break; } } if ( i < 0 ) { kvp[kvp.length] = [key, value].join( '=' ); } //this will reload the page, it's likely better to store this until finished document.location.search = kvp.join( '&' ); } $( '#sort-properties' ).on( 'change', function () { var key = 'sortby'; var value = $( this ).val(); insertParam( key, value ); } ); /** * Properties Gallery Isotope */ if ( $.isFunction( $.fn.isotope ) ) { const container = $( "#properties-gallery-container" ), filterLinks = $( "#filter-by a" ), isotopeOptions = { filter : "*", layoutMode : 'fitRows', itemSelector : '.isotope-item', animationEngine : 'best-available' }; // RTL support if ( isRtl ) { isotopeOptions.originLeft = false; } // To fix floating bugs due to variation in height setTimeout( function () { container.isotope( isotopeOptions ); }, 1000 ); filterLinks.on( 'click', function ( event ) { let self = $( this ), selector = self.data( 'filter' ); container.isotope( { filter : '.' + selector } ); filterLinks.removeClass( 'active' ); self.addClass( 'active' ); event.preventDefault(); } ); } // footerStick - Run on document ready. footerStick(); function rhDecorateWhatsAppLink() { //set up the url var url = 'https://api.whatsapp.com/send?text='; var thisShareData = $( '.share-this' ); //get property title var name = thisShareData.data( 'property-name' ); //get property permalink var permalink = thisShareData.data( 'property-permalink' ); //encode the text var encodedText = encodeURIComponent( name + ' ' + permalink ); //find the link var whatsApp = $( ".inspiry_whats_app_share_link" ); //set the href attribute on the link whatsApp.attr( 'href', url + encodedText ); } rhDecorateWhatsAppLink(); // Scripts to run on window load and resize events. $window.on( 'load resize', function () { footerStick(); } ); } ); } )( jQuery );; /*! jQuery UI - v1.13.3 - 2024-04-26 * https://jqueryui.com * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js * Copyright jQuery Foundation and other contributors; Licensed MIT */ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";var t,e,i,n,W,C,o,s,r,l,a,h,u;function E(t,e,i){return[parseFloat(t[0])*(a.test(t[0])?e/100:1),parseFloat(t[1])*(a.test(t[1])?i/100:1)]}function L(t,e){return parseInt(x.css(t,e),10)||0}function N(t){return null!=t&&t===t.window}x.ui=x.ui||{},x.ui.version="1.13.3", /*! * jQuery UI :data 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.extend(x.expr.pseudos,{data:x.expr.createPseudo?x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}}):function(t,e,i){return!!x.data(t,i[3])}}), /*! * jQuery UI Disable Selection 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}), /*! * jQuery UI Focusable 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(x(t)))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):x(this[0].form)}, /*! * jQuery UI Form Reset Mixin 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},x.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), /*! * jQuery UI Support for jQuery core 1.8.x and newer 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license * */ x.expr.pseudos||(x.expr.pseudos=x.expr[":"]),x.uniqueSort||(x.uniqueSort=x.unique),x.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,i=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},x.escapeSelector=function(t){return(t+"").replace(e,i)}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}), /*! * jQuery UI Keycode 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}, /*! * jQuery UI Labels 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+x.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o
")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthW(C(n),C(o))?s.important="horizontal":s.important="vertical",f.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):h.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;n",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var e=(t.attr("aria-describedby")||"").split(/\s+/);e.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",String.prototype.trim.call(e.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),e=(t.attr("aria-describedby")||"").split(/\s+/),i=r.inArray(i,e);-1!==i&&e.splice(i,1),t.removeData("ui-tooltip-id"),(e=String.prototype.trim.call(e.join(" ")))?t.attr("aria-describedby",e):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=r("
").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=r([])},_setOption:function(t,i){var e=this;this._super(t,i),"content"===t&&r.each(this.tooltips,function(t,i){e._updateContent(i.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var o=this;r.each(this.tooltips,function(t,i){var e=r.Event("blur");e.target=e.currentTarget=i.element[0],o.close(e,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var t=r(this);if(t.is("[title]"))return t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var t=r(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))}),this.disabledTitles=r([])},open:function(t){var e=this,i=r(t?t.target:this.element).closest(this.options.items);i.length&&!i.data("ui-tooltip-id")&&(i.attr("title")&&i.data("ui-tooltip-title",i.attr("title")),i.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&i.parents().each(function(){var t,i=r(this);i.data("ui-tooltip-open")&&((t=r.Event("blur")).target=t.currentTarget=this,e.close(t,!0)),i.attr("title")&&(i.uniqueId(),e.parents[this.id]={element:this,title:i.attr("title")},i.attr("title",""))}),this._registerCloseHandlers(t,i),this._updateContent(i,t))},_updateContent:function(i,e){var t=this.options.content,o=this,n=e?e.type:null;if("string"==typeof t||t.nodeType||t.jquery)return this._open(e,i,t);(t=t.call(i[0],function(t){o._delay(function(){i.data("ui-tooltip-open")&&(e&&(e.type=n),this._open(e,i,t))})}))&&this._open(e,i,t)},_open:function(t,i,e){var o,n,s,l=r.extend({},this.options.position);function a(t){l.of=t,o.is(":hidden")||o.position(l)}e&&((s=this._find(i))?s.tooltip.find(".ui-tooltip-content").html(e):(i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),s=this._tooltip(i),o=s.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(e),this.liveRegion.children().hide(),(s=r("
").html(o.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),s.removeAttr("id").find("[id]").removeAttr("id"),s.appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:a}),a(t)):o.position(r.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(n=this.delayedShow=setInterval(function(){o.is(":visible")&&(a(l.of),clearInterval(n))},13)),this._trigger("open",t,{tooltip:o})))},_registerCloseHandlers:function(t,i){var e={keyup:function(t){t.keyCode===r.ui.keyCode.ESCAPE&&((t=r.Event(t)).currentTarget=i[0],this.close(t,!0))}};i[0]!==this.element[0]&&(e.remove=function(){var t=this._find(i);t&&this._removeTooltip(t.tooltip)}),t&&"mouseover"!==t.type||(e.mouseleave="close"),t&&"focusin"!==t.type||(e.focusout="close"),this._on(!0,i,e)},close:function(t){var i,e=this,o=r(t?t.currentTarget:this.element),n=this._find(o);n?(i=n.tooltip,n.closing||(clearInterval(this.delayedShow),o.data("ui-tooltip-title")&&!o.attr("title")&&o.attr("title",o.data("ui-tooltip-title")),this._removeDescribedBy(o),n.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){e._removeTooltip(r(this))}),o.removeData("ui-tooltip-open"),this._off(o,"mouseleave focusout keyup"),o[0]!==this.element[0]&&this._off(o,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&r.each(this.parents,function(t,i){r(i.element).attr("title",i.title),delete e.parents[t]}),n.closing=!0,this._trigger("close",t,{tooltip:i}),n.hiding)||(n.closing=!1)):o.removeData("ui-tooltip-open")},_tooltip:function(t){var i=r("
").attr("role","tooltip"),e=r("
").appendTo(i),o=i.uniqueId().attr("id");return this._addClass(e,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(t)),this.tooltips[o]={element:t,tooltip:i}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=t.length?t:this.document[0].body},_destroy:function(){var o=this;r.each(this.tooltips,function(t,i){var e=r.Event("blur"),i=i.element;e.target=e.currentTarget=i[0],o.close(e,!0),r("#"+t).remove(),i.data("ui-tooltip-title")&&(i.attr("title")||i.attr("title",i.data("ui-tooltip-title")),i.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==r.uiBackCompat&&r.widget("ui.tooltip",r.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),r.ui.tooltip});; ( function( $ ) { "use strict"; $( document ).ready( function() { var progress_bar = false; var rhLoginMessageBox = $('.rh_login_modal_messages'); var rhLoginMessagesCommon = $('.rh_login_modal_messages .rh_modal__msg'); var rhLoginModalLoader = $('.rh_modal_login_loader'); if ( $('#rh_progress').length ) { progress_bar = new ProgressBar.Line('#rh_progress', { easing: 'easeInOut', color: '#1ea69a', strokeWidth: 0.3, }); } // var modal_switch = $( 'div.switch' ); // var modal_switch_link = modal_switch.find( 'a' ); // modal_switch_link.click( function(e) { // // e.preventDefault(); // Prevent default. // // var switch_to = $( this ).attr( 'data-switch' ); // Switch to modal. // var target = ''; // // if ( 'forgot' === switch_to ) { // // var switch_parent = $( this ).parents( 'div.modal' ); // target = $( 'div.rh_modal__forgot_wrap' ); // switch_parent.slideToggle( 'slow' ); // target.slideToggle( 'slow' ); // // } else if ( 'register' === switch_to ) { // // var switch_parent = $( this ).parents( 'div.modal' ); // // target = $( 'div.rh_modal__register_wrap' ); // switch_parent.slideToggle( 'slow' ); // target.slideToggle( 'slow' ); // // } else if ( 'login' === switch_to ) { // // var switch_parent = $( this ).parents( 'div.modal' ); // // target = $( 'div.rh_modal__login_wrap' ); // switch_parent.slideToggle( 'slow' ); // target.slideToggle( 'slow' ); // // } // } ); if ( jQuery().validate && jQuery().ajaxSubmit ) { /** * AJAX Login Form */ var loginButton = $('#login-button'), // loginAjaxLoader = $('#login-loader'), loginError = $("#login-error" ), loginMessage = $('#login-message'); var loginOptions = { beforeSubmit: function () { if ( progress_bar ) { progress_bar.set(0); progress_bar.animate(1); } loginButton.attr('disabled', 'disabled'); rhLoginModalLoader.removeClass('rh_modal_login_loader_hide'); // loginAjaxLoader.fadeIn( 200 ); }, success: function (ajax_response, statusText, xhr, $form) { var response = $.parseJSON( ajax_response ); // loginAjaxLoader.fadeOut( 100 ); loginButton.removeAttr('disabled'); rhLoginModalLoader.addClass('rh_modal_login_loader_hide'); rhLoginMessagesCommon.fadeOut( 50,'swing',function () { rhLoginMessageBox.slideDown('fast'); } ); if ( response.success ) { loginMessage.html( response.message ).fadeIn( 200 ); if ( window.location.href == response.redirect ) { window.location.reload( true ); } else { window.location.replace( response.redirect ); } } else { loginError.html( response.message ).fadeIn( 200 ); // call reset function if it exists if ( typeof inspiryResetReCAPTCHA == 'function' ) { inspiryResetReCAPTCHA(); } } } }; $('#rh_modal__login_form, #login-form').validate({ submitHandler: function (form) { $(form).ajaxSubmit(loginOptions); } }); /** * AJAX Register Form */ var registerButton = $('#register-button'), registerError = $("#register-error" ), registerMessage = $('#register-message'); var registerOptions = { beforeSubmit: function () { if ( progress_bar ) { progress_bar.set(0); progress_bar.animate(1); } registerButton.attr('disabled', 'disabled'); rhLoginModalLoader.removeClass('rh_modal_login_loader_hide'); }, success: function (ajax_response, statusText, xhr, $form) { var response = $.parseJSON( ajax_response ); // registerAjaxLoader.fadeOut('fast'); registerButton.removeAttr('disabled'); rhLoginMessagesCommon.fadeOut( 50,'swing',function () { rhLoginMessageBox.slideDown('fast'); } ); rhLoginModalLoader.addClass('rh_modal_login_loader_hide'); if ( response.success ) { registerMessage.html( response.message ).fadeIn('fast'); $form.resetForm(); } else { registerError.html( response.message ).fadeIn('fast'); // call reset function if it exists if ( typeof inspiryResetReCAPTCHA == 'function' ) { inspiryResetReCAPTCHA(); } } } }; $('#rh_modal__register_form, #register-form').validate({ rules: { register_username: { required: true }, register_email: { required: true, email: true } }, submitHandler: function (form) { $(form).ajaxSubmit(registerOptions); } }); /** * Forgot Password Form */ var forgotButton = $('#forgot-button'), // forgotAjaxLoader = $('#forgot-loader'), forgotError = $("#forgot-error" ), forgotMessage = $('#forgot-message'); var forgotOptions = { beforeSubmit: function () { if ( progress_bar ) { progress_bar.set(0); progress_bar.animate(1); } forgotButton.attr('disabled', 'disabled'); // forgotAjaxLoader.fadeIn('fast'); // forgotMessage.fadeOut('fast'); // forgotError.fadeOut('fast'); rhLoginModalLoader.removeClass('rh_modal_login_loader_hide'); }, success: function (ajax_response, statusText, xhr, $form) { var response = $.parseJSON( ajax_response ); // forgotAjaxLoader.fadeOut('fast'); forgotButton.removeAttr('disabled'); rhLoginMessagesCommon.fadeOut( 50,'swing',function () { rhLoginMessageBox.slideDown('fast'); } ); rhLoginModalLoader.addClass('rh_modal_login_loader_hide'); if ( response.success ) { forgotMessage.html( response.message ).fadeIn('fast'); $form.resetForm(); } else { forgotError.html( response.message ).fadeIn('fast'); // call reset function if it exists if ( typeof inspiryResetReCAPTCHA == 'function' ) { inspiryResetReCAPTCHA(); } } } }; $('#rh_modal__forgot_form, #forgot-form').validate({ submitHandler: function (form) { $(form).ajaxSubmit(forgotOptions); } }); } /** * Forgot Form */ $('.rh_form #rh_modal__forgot_form').slideUp('fast'); $('.rh_form .toggle-forgot-form').on('click', function(event){ event.preventDefault(); $('.rh_form #rh_modal__forgot_form').slideToggle('fast'); }); /*-----------------------------------------------------------------------------------*/ /* Login Modal /*-----------------------------------------------------------------------------------*/ function rhSetLoginFormHeight(){ var heights = $("div.rh_form_modal").map(function () { return $(this).outerHeight(); }).get(); var maxHeight = Math.max.apply(null, heights); $('.rh_wrapper_login_forms').css('height',maxHeight); } $(window).resize(rhSetLoginFormHeight); $('.rh_login_target').on('click',function () { if(!$(this).hasClass('rh_active')){ $('.rh_login_tab').removeClass('rh_active'); $(this).addClass('rh_active'); $('.rh_form_modal').slideUp(500); $('.rh_login_form').slideDown(500); } }); $('.rh_register_target').on('click',function () { if(!$(this).hasClass('rh_active')){ $('.rh_login_tab').removeClass('rh_active'); $(this).addClass('rh_active'); $('.rh_form_modal').slideUp(500); $('.rh_register_form').slideDown(500); } }); $('.rh_forget_password_trigger').on('click',function () { $('.rh_login_tab').removeClass('rh_active'); $('.rh_form_modal').slideUp(500); $('.rh_password_reset_form').slideDown(500); }); var rhLoginViz = false; $('.rh-ultra-menu-user-profile, .rh_menu__user_profile, .rhea_menu__user_profile svg, .rhea_menu__user_profile > span, .rh-user-account-profile-image .user-icon').on('click',function (e) { // e.preventDefault(); $('.rh_login_modal_wrapper').css("display", "flex").hide().fadeIn(500); rhSetLoginFormHeight(); rhLoginViz = true; }); // A common class to ask for login where needed in the theme. $('.ask-for-login').on('click',function (event) { event.preventDefault(); $('.rh_login_modal_wrapper').css("display", "flex").hide().fadeIn(500); rhSetLoginFormHeight(); rhLoginViz = true; }); $('.rh_login_close').on('click',function () { $('.rh_login_modal_wrapper').fadeOut(500); rhLoginViz = false; $('.rh_modal_field').val(''); }); $('body').on('click','.rh_login_modal_wrapper',function(e) { if (e.target === this){ $(this).fadeOut(500); rhLoginMessageBox.slideUp('fast'); } }); $('body').on('click','.rh_login_modal_box',function(e) { if (e.target !== rhLoginMessageBox){ rhLoginMessageBox.slideUp('fast'); // rhLoginMessageBox.find('p').fadeOut('fast'); } }); $('.rh_login_close_message').on('click',function () { rhLoginMessageBox.slideUp('fast'); }); } ); } )( jQuery ); ; /*! This file is auto-generated */ window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o div' ).length; if ( compare_properties_number !== 0 ) { // Show the compare tray button. wrapperPropertiesCompare.addClass( 'rh_has_compare_children' ); $body.addClass( 'rh-has-compare-properties' ); } else { // Remove active color of compare tray button. wrapperPropertiesCompare.removeClass( 'rh_compare_open' ); // Hide compare tray button. wrapperPropertiesCompare.removeClass( 'rh_has_compare_children' ); $body.removeClass( 'rh-has-compare-properties' ); $( '.rh_fixed_side_bar_compare' ).fadeOut( 0 ); // Hide compare tray. } } // Update compare properties count in compare tray. function update_compare_tray_counter() { let compareCountWrap = $( '.rh_compare_count' ); compareCountWrap.fadeOut( 200, function () { let getDivCount = $( 'body .rh_compare .rh_compare__carousel > div' ).length; $( '.rh_wrapper_properties_compare .rh_compare_count' ).html( ' ( ' + getDivCount + '/4 ) ' ); } ); compareCountWrap.fadeIn( 200 ); } function add_to_compare_btn_placeholder( property_id, placeholder ) { let compareButton = $( '.compare-btn-' + property_id ); // Highlight the add to compare button. if ( placeholder ) { compareButton.find( '.compare-placeholder' ).removeClass( 'hide' ); compareButton.find( 'a.rh_trigger_compare' ).addClass( 'hide' ); } else { compareButton.find( '.compare-placeholder' ).addClass( 'hide' ); compareButton.find( 'a.rh_trigger_compare' ).removeClass( 'hide' ); } } // Compare limit for exceeding more than four properties in compare. function apply_compare_properties_limit() { const notificationBar = $( '#rh_compare_action_notification' ); // Remove the oldest property from the list if number of properties goes above four. let slides_number = $( '.rh_compare__carousel .rh_compare__slide' ).length; if ( slides_number >= 4 ) { $( '.rh_compare__carousel .rh_compare__slide:nth-child(1) a.rh_compare__remove' ).trigger( "click" ); notificationBar.addClass( 'show' ); setTimeout( function () { notificationBar.removeClass( 'show' ); }, 6000 ); } } // Add property card to the properties compare tray. function add_property_to_compare_tray( property_id, property_title, property_img, property_url ) { $( '.rh_compare__carousel' ).append( '
' + '
' + '
' + '' + '' + '' + '' + '' + '
' + '' + property_title + '' + '
' + '
' ); } // Add property to the localStorage. function add_property_to_localStorage( property_id, property_title, property_img, property_url ) { // Prepare property data object. let property_obj = { property_id, property_title, property_url, property_img }; let new_property = JSON.stringify( property_obj ); /** * Add property to the localStorage. */ // Get compare properties data from localStorage. let old_properties = window.localStorage.getItem( comparePropStorageKey ); if ( '' !== old_properties && null !== old_properties ) { window.localStorage.setItem( comparePropStorageKey, old_properties + '||' + new_property ); } else { window.localStorage.setItem( comparePropStorageKey, new_property ); } } // Remove property from localStorage. function remove_property_from_localStorage( property_id ) { // Get compare properties data from localStorage. let properties_array_string = window.localStorage.getItem( comparePropStorageKey ).split( '||' ); // Build an array of array from array of strings. let properties_array = []; properties_array_string.forEach( function ( property ) { properties_array.push( JSON.parse( property ) ); } ); // Prepare properties array except property to remove. let properties_array_filtered = $.grep( properties_array, function ( property ) { return property.property_id != property_id && property.property_id != undefined; } ); let properties_string = ''; properties_array_filtered.forEach( function ( property ) { if ( properties_string !== '' ) { properties_string += '||'; } properties_string += JSON.stringify( property ); } ); window.localStorage.setItem( comparePropStorageKey, properties_string ); } // Update compare properties button url with properties ids. function update_compare_button_url() { const compare_link = $( '.rh_compare__submit' ); if ( ! compare_link.length ) { return false; } let compareLink = compare_link.attr( 'href' ); if ( ! compareLink ) { return false; } let properties_array_string = window.localStorage.getItem( comparePropStorageKey ).split( '||' ); if ( Array.isArray( properties_array_string ) && properties_array_string.length && properties_array_string[0] !== '' ) { let compare_url = new URL( compareLink ); let search_params = compare_url.searchParams; let properties_array = []; properties_array_string.forEach( function ( property ) { properties_array.push( JSON.parse( property ) ); } ); let property_ids = ''; properties_array.forEach( function ( property ) { if ( '' === property_ids ) { property_ids = property.property_id; } else { property_ids += ',' + property.property_id; } } ); search_params.append( 'id', property_ids ); compare_url.search = search_params.toString(); compareLink = compare_url.toString(); } compare_link.attr( 'href', compareLink ); } } ); /** * Adding compare properties list share by email * */ let shareButtonsWrap = $( '.compare-share-buttons' ), shareMailBtn = $( '.compare-share-buttons ul li' ), shareMailWrap = $( '.share-by-mail-wrap' ), compareShareURL = $( '#compare-share-url' ).val(), compareShareNonce = $( '#compare-share-nonce' ).val(), compareShareProgress = $( '.compare-share-progress' ), compareEmailField = $( '#compare-share-email' ), compareLoader = $( '.compare-share-progress .loader' ), compareMessage = $( '.compare-share-progress .message' ); // Triggering email button to open/close email form shareMailBtn.on( 'click', '.email', function ( e ) { e.preventDefault(); if ( $( this ).hasClass( 'active' ) ) { $( this ).removeClass( 'active' ).parent( 'li' ).parent( 'ul' ).css( 'left', '' ).css( 'opacity', '' ); shareMailWrap.fadeOut( 100 ); } else { let shareButtonsWrapLeft = $('body').hasClass('design_ultra') ? '92px' : '86.6px'; $( this ).addClass( 'active' ).parent( 'li' ).parent( 'ul' ).css( 'left', shareButtonsWrapLeft ).css( 'opacity', '1' ); shareMailWrap.fadeIn( 100 ); } } ); // Triggering close button for email form wrap shareMailWrap.on( 'click', '.mail-wrap-close', function () { shareMailBtn.find( '.email' ).removeClass( 'active' ); shareButtonsWrap.find( 'ul' ).css( 'left', '' ).css( 'opacity', '' ); shareMailWrap.hide( 100 ); } ); // Removing error message from email field upon keypress compareEmailField.on( 'keypress', null, function () { $( '.fields .email-error' ).remove(); } ); // Triggering email submit request shareMailWrap.on( 'click', '#compare-mail-submit', function ( e ) { e.preventDefault(); let targetEmail = compareEmailField.val(), emailErrorStatement = compareEmailField.data( 'error-statement' ); // Checking if email is good to go if ( realhomes_is_email( targetEmail ) ) { shareMailWrap.find( '.fields, label' ).fadeOut( 200, function () { compareShareProgress.fadeIn( 200 ); } ); // Email ajax request $.ajax( { type : 'post', dataType : 'html', url : ajaxurl, data : { action : 'realhomes_share_compare_list_by_email', compare_url : compareShareURL, target_email : targetEmail, compare_nonce : compareShareNonce }, success : function ( response ) { // Check if response is already parsed or needs parsing if ( typeof response === 'string' ) { response = JSON.parse( response ); } if ( response.success ) { compareLoader.fadeOut( 200, function () { compareMessage.html( '
' + response.message ) .fadeIn( 200 ); setTimeout( function () { shareMailWrap.fadeOut( 200, function () { // All the form reset process compareMessage.hide(); compareLoader.show(); compareShareProgress.hide(); shareMailBtn.find( '.email' ).removeClass( 'active' ); shareButtonsWrap.find( 'ul' ).css( 'left', '' ).css( 'opacity', '' ); shareButtonsWrap.find( '.share-by-mail-wrap' ).hide(); shareMailWrap.find( '.fields, label' ).show(); compareEmailField.val( '' ); $( '.fields .email-error' ).remove(); } ); }, 1200 ); } ); } } } ); } else { // Error message if wrong email is provided compareEmailField.after( '' ); } } ); } )( jQuery ); /** * To check if field or any variable has valid email ID * In case of multiple emails, it will still verify each one * */ if ( typeof realhomes_is_email !== 'function' ) { function realhomes_is_email( emails ) { // Check if the input is empty or contains only whitespace if ( ! emails.trim() ) { return false; } // Regular expression to match a valid email format let emailReg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; // Split the string by commas, trim each email, and filter out any empty strings let emailList = emails.split( ',' ).map( email => email.trim() ).filter( email => email !== '' ); // Check if every email in the list matches the regex pattern return emailList.every( email => emailReg.test( email ) ); } };