1/*global $,Modernizr, jQuery, ajaxcalls_vars,wpestate_custom_search_start_filtering_ajax,imagesLoaded,wpestate_restart_js_after_ajax, panorama,wpestate_toggleStreetView,wpestate_start_filtering_ajax,map,google,wpestate_new_open_close_map,document,initialGeop,placeCircle,wpestate_custom_search_start_filtering_ajax,first_time_wpestate_show_inpage_ajax_half,wpestate_show_pins, wpestate_load_stats,wpestate_enable_half_map_pin_action,wpestate_change_map_type,wpestate_load_stats_tabs,control_vars,mapfunctions_vars, wpestate_map_shortcode_function,grecaptcha,window*/ 2var width,height; 3width = jQuery(window).width(); 4height = jQuery(window).height(); 5var scroll_trigger = 0; 6var scroll_modal_save,scroll_modal; 7var modal_url = window.location.href; 8var modal_title = document.getElementsByTagName("title")[0]; 9var slider_counter = 0; 10 11 12 13jQuery(window).bind("load", function() { 14 wpestate_lazy_load_carousel_property_unit(); 15}); 16 17 18if(document.getElementById("search_wrapper")){ 19 var searchbar = document.getElementById("search_wrapper"); 20 var sticky_search = searchbar.offsetTop; 21} 22 23 24 25var switch_logo; 26switch_logo = jQuery('.header_wrapper_inside').attr('data-sticky-logo'); 27 28if(jQuery('.header5_top_row').length > 0){ 29 switch_logo = jQuery('.header5_top_row').attr('data-sticky-logo'); 30} 31if(wpestate_isRetinaDisplay()){ 32 switch_logo=wpestate_get_custom_retina_pin(switch_logo); 33 34} 35 36 37var switch_logo_original = jQuery('.header_wrapper_inside').attr('data-logo'); 38if(jQuery('.header5_top_row').length > 0){ 39 switch_logo_original = jQuery('.header5_top_row').attr('data-logo'); 40} 41 42if(wpestate_isRetinaDisplay()){ 43 switch_logo_original=wpestate_get_custom_retina_pin(switch_logo_original); 44} 45 46function wpestate_get_custom_retina_pin(custom_img){ 47 "use strict"; 48 49 if(typeof(custom_img) === "undefined"){ 50 return; 51 } 52 var custom_img_retina; 53 custom_img_retina=custom_img.replace(".png","_2x.png"); 54 55 jQuery.get(custom_img_retina) 56 .done(function() { 57 custom_img = custom_img_retina; 58 }).fail(function() { 59 }); 60 return custom_img; 61} 62 63 64 65 66jQuery(window).scroll(function () { 67 "use strict"; 68 var scroll =scroll_modal= jQuery(window).scrollTop(); 69 70 if(control_vars.stiky_search==='yes'){ 71 wpestate_adv_search_sticky(scroll); 72 }else{ 73 wpestate_header_sticky(scroll); 74 } 75 76 77 if (scroll >= control_vars.scroll_trigger) { 78 jQuery('.contact-box').addClass('islive'); 79 jQuery('.backtop').addClass('islive'); 80 }else{ 81 jQuery('.contact-box ').removeClass('islive'); 82 jQuery('.backtop').removeClass('islive'); 83 jQuery('.contactformwrapper').addClass('hidden'); 84 } 85 jQuery('.contact_close_button').on( 'click', function(event) { 86 event.preventDefault(); 87 jQuery('.contactformwrapper').addClass('hidden'); 88 }); 89 90}); 91 92 93 94 95 96 97var sticky_search_local = document.getElementById("search_wrapper") ? document.getElementById("search_wrapper").offsetTop : 0; 98var search_height = jQuery('#search_wrapper').height(); 99 100 101 102/* 103* When we advanced search sticky 104* 105* 106*/ 107// Global variable to store the scroll position at which the searchbar 108// should be considered as "exiting" the viewport 109var searchbarExitingThreshold; 110 111/** 112 * Calculates the threshold at which the searchbar is considered to be exiting the viewport. 113 * This function should be called on page load and window resize to ensure accuracy. 114 */ 115function calculateSearchbarThreshold() { 116 "use strict"; 117 var searchbar = jQuery('.search_wrapper_sticky_search'); 118 if (searchbar.length > 0) { 119 // Get the initial top position of the searchbar 120 var searchbarInitialPosition = searchbar.offset().top; 121 // Get the height of the searchbar 122 var searchbarHeight = searchbar.outerHeight(); 123 // Calculate the threshold by adding the initial position and height 124 searchbarExitingThreshold = searchbarInitialPosition + searchbarHeight; 125 126 } 127} 128 129/** 130 * Main function to handle the sticky behavior of the advanced search bar. 131 * This function is called on scroll events. 132 * 133 * @param {number} scroll - The current scroll position of the window. 134 */ 135function wpestate_adv_search_sticky(scroll) { 136 "use strict"; 137 138 // Early return if the search wrapper doesn't exist 139 if (!document.getElementById("search_wrapper")) { 140 return; 141 } 142 // Early return for mobile devices (screens smaller than 1024px) 143 if (screen.width < 1024) { 144 return; 145 } 146 147 var searchbar = jQuery('.search_wrapper_sticky_search.with_search_form_float'); 148 // Early return if the searchbar doesn't exist 149 if (searchbar.length === 0) { 150 return; 151 } 152 153 if (scroll >= searchbarExitingThreshold) { 154 // The searchbar is exiting or has exited the screen 155 if (!searchbar.hasClass('sticky_adv_anime')) { 156 // Add the class only if it's not already present 157 searchbar.addClass('sticky_adv_anime'); 158 159 } 160 } else { 161 // The searchbar is visible on the screen 162 if (searchbar.hasClass('sticky_adv_anime')) { 163 // Remove the class only if it's present 164 searchbar.removeClass('sticky_adv_anime'); 165 166 } 167 } 168} 169 170 171 172 173 174 175 176 177 178function wpestate_header_sticky(scroll){ 179 180 "use strict"; 181 182 var sticky_class="master_header_sticky"; 183 var control_vars_scroll_trigger=parseInt(control_vars.scroll_trigger); 184
185 if(control_vars.content_type!='' && control_vars.content_type!=='tabs' && jQuery('.wpestate_top_property_navigation_link').length!==0){ 186 sticky_class=sticky_class+" "+"sticky_property_menu" 187 } 188 189 190 if(jQuery('.admin-bar').length>0){ 191 control_vars_scroll_trigger=control_vars_scroll_trigger+32; 192 } 193 194 if (scroll >= control_vars_scroll_trigger) { 195 if (!Modernizr.mq('only all and (max-width: 1023px)')) { 196 197 jQuery(".master_header").addClass(sticky_class); 198 jQuery('.logo').addClass('miclogo'); 199 if( switch_logo!=='' ){ 200 jQuery('#logo_image').attr('src',switch_logo); 201 } 202 203 if( !jQuery(".header_wrapper").hasClass('header_type4') ){ 204 jQuery(".header_wrapper").addClass("navbar-fixed-top"); 205 206 } 207 208 jQuery('#user_menu_open').hide(); 209 jQuery('.navicon-button').removeClass('opensvg'); 210 jQuery('#wpestate_header_shoping_cart').hide(); 211 212 jQuery('.wpestate_top_property_navigation').addClass('sticky_property_menu_visible'); 213 214 } 215 216 } else { 217 jQuery(".master_header").removeClass(sticky_class); 218 jQuery(".header_wrapper").removeClass("navbar-fixed-top"); 219 220 221 222 jQuery('#user_menu_open').hide(); 223 jQuery('#wpestate_header_shoping_cart').hide(); 224 jQuery('.logo').removeClass('miclogo'); 225 226 jQuery('.wpestate_top_property_navigation').removeClass('sticky_property_menu_visible'); 227 228 229 if( switch_logo!=='' ){ 230 231 jQuery('#logo_image').attr('src',switch_logo_original); 232 } 233 } 234} 235 236 237 238function wpestate_isRetinaDisplay() { 239 "use strict"; 240 if (window.matchMedia) { 241 var mq = window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)"); 242 return (mq && mq.matches || (window.devicePixelRatio > 1)); 243 } 244} 245 246 247/** 248 * Property Navigation Scroll Handler 249 * 250 * Manages smooth scrolling to property sections and highlights 251 * active navigation items based on scroll position. 252 * 253 * Dependencies: 254 * - jQuery 255 * - .wpestate_top_property_navigation element with anchor links 256 * - .property-panel elements with matching IDs 257 */ 258 259function wpestate_property_sticky() { 260 'use strict'; 261 262 const SCROLL_OFFSET = 80; 263 const SCROLL_DURATION = 500; 264 const $navigation = jQuery('.wpestate_top_property_navigation a'); 265 266 // Handle navigation click events 267 $navigation.on('click', function(event) { 268 event.preventDefault(); 269 270 // Get target section 271 const targetId = jQuery(this).attr('href'); 272 const $targetElement = jQuery(targetId); 273 274 // Update active state 275 $navigation.removeClass('item_active'); 276 jQuery(this).addClass('item_active'); 277 278 // Smooth scroll to target 279 jQuery('html, body').animate({ 280 scrollTop: $targetElement.offset().top - SCROLL_OFFSET 281 }, SCROLL_DURATION); 282 }); 283 284 // Handle scroll events 285 jQuery(window).on('scroll', function() { 286 const scrollTop = jQuery(window).scrollTop() + SCROLL_OFFSET; 287 let currentSection = null; 288 289 // Find the current section 290 jQuery('.property-panel').each(function() { 291 const sectionTop = jQuery(this).offset().top; 292 const sectionBottom = sectionTop + jQuery(this).outerHeight(); 293 294 if (scrollTop >= sectionTop && scrollTop < sectionBottom) { 295 currentSection = this.id; 296 return false; // Break the loop when found 297 } 298 }); 299 300 // Update active state only if a section is found 301 $navigation.removeClass('item_active'); 302 jQuery('.wpestate_top_property_navigation a').removeClass('item_active'); 303 304 if (currentSection) { 305 $navigation.filter(`[href="#${currentSection}"]`).addClass('item_active'); 306 307 } 308 }); 309} 310 311 312jQuery(window).resize(function() { 313 "use strict"; 314 if(jQuery(window).width() != width ){ 315 jQuery('#mobile_menu').hide('10'); 316 } 317 wpestate_adjustMegaMenuPosition(); 318 wpestate_half_map_responsive(); 319 wpestat_resize_wpestate_property_slider_v2(); 320 321}); 322 323function wpestate_half_map_responsive(){ 324 if (Modernizr.mq('only screen and (min-width: 640px)') && Modernizr.mq('only screen and (max-width: 1025px)')) { 325 var half_map_header = jQuery('.master_header ').height(); 326 } 327 328} 329 330function wpestate_half_map_controls(){ 331 332 jQuery('.half_mobile_toggle_listings').on('click',function(){ 333 334 jQuery('.half_map_controllers_wrapper div').removeClass('half_control_visible'); 335 jQuery(this).addClass('half_control_visible'); 336 jQuery('#google_map_prop_list_wrapper').removeAttr('style'); 337 jQuery('#google_map_prop_list_sidebar').show(); 338 jQuery('.half_mobile_hide').hide(); 339 }); 340 341 342 jQuery('.half_mobile_toggle_map').on('click',function(){ 343 344 jQuery('.half_map_controllers_wrapper div').removeClass('half_control_visible'); 345 jQuery(this).addClass('half_control_visible'); 346 jQuery('#google_map_prop_list_sidebar').hide(); 347 jQuery('#google_map_prop_list_wrapper').css('height','100%'); 348 jQuery('.half_mobile_hide').show(); 349
350 wpresidence_map_general_fit_to_bounds(1); 351 if(wp_estate_kind_of_map===1){ 352 353 }else if(wp_estate_kind_of_map===2){ 354 map.invalidateSize(); 355 map.fitBounds(bounds_list); 356 } 357 }); 358} 359 360 361 362 363 364Number.prototype.format = function(n, x) { 365 var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\.' : '$') + ')'; 366 return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&'+control_vars.price_separator); 367}; 368 369function wpestate_element_hide(item){ 370 "use strict"; 371 jQuery(document).on( 'click', function(event) { 372 if (!jQuery(item).is(event.target) && jQuery(item).has(event.target).length === 0 ){ 373 jQuery('#results').fadeOut(); 374 375 } 376 }); 377} 378wpestate_element_hide('.search_wrapper'); 379 380function wpestate_lazy_load_carousel_property_unit(){ 381 "use strict"; 382 383 jQuery('.property_unit_carousel img').each(function(event){ 384 var new_source=''; 385 new_source=jQuery(this).attr('data-lazy-load-src'); 386 if(typeof (new_source)!=='undefined' && new_source!==''){ 387 388 jQuery(this).attr('src',new_source); 389 } 390 }); 391} 392 //recaptha 393 394 395function wpestate_card_unit_contact_actions(){ 396 397 398 jQuery('.wpestate_property_card_contact_wrapper_phone').on('click',function(event){ 399 event.stopPropagation(); 400 401 var prop_id = jQuery(this).attr('data-item-id'); 402 var parent = jQuery(this).parent().parent(); 403 404 parent.find('.wpestate_card_unit_call_'+prop_id).appendTo("body"); 405 jQuery('body> .wpestate_card_unit_call_'+prop_id).first().modal("show"); 406 }); 407 408 jQuery('.wpestate_property_card_contact_wrapper_email').on('click',function(event){ 409 event.stopPropagation(); 410 var prop_id = jQuery(this).attr('data-item-id'); 411 var parent = jQuery(this).parent().parent(); 412 parent.find('.wpestate_card_unit_email_'+prop_id).appendTo("body"); 413 jQuery('body> .wpestate_card_unit_email_'+prop_id).first().modal("show"); 414 }); 415 416 jQuery('.wpestate_property_card_contact_wrapper_whatsupp').on('click',function(event){ 417 event.stopPropagation(); 418 419 }); 420 421} 422 423 424 425 426 427 428wpestate_advnced_filters_bars(); 429 430function wpresidence_advanced_searc_6_actions(){ 431 ////////// adv serach 6 432 jQuery('.adv6_tab_head,.elementor_search_tab_head').on( 'click', function(event) { 433 434 435 436 var tab_controls; 437 var parent=jQuery(this).parent().parent(); 438 parent.find('.adv_search_tab_item').removeClass('active'); 439 jQuery(this).parent().addClass('active'); 440 441 442 tab_controls = jQuery(this).attr('aria-controls'); 443 jQuery('.adv6_price_low').removeClass('price_active'); 444 jQuery('.adv6_price_max').removeClass('price_active'); 445 446 jQuery('#'+tab_controls).find('.adv6_price_low').addClass('price_active'); 447 jQuery('#'+tab_controls).find('.adv6_price_max').addClass('price_active'); 448 449 }); 450 451} 452 453 454 455/** 456 * Trigger Login Modal Open Action 457 * 458 * This function sets up an event listener for the login trigger modal button. 459 * When clicked, it calls the function to open the login modal. 460 * 461 * @since 1.0.0 462 * 463 * @requires jQuery 464 * @requires wpestate_trigger_login_modal_open 465 * 466 * @return {void} 467 */ 468function wpestate_trigger_login_modal_open_action() { 469 jQuery('#login_trigger_modal').on('click', function(event) { 470 wpestate_trigger_login_modal_open(2); 471 }); 472} 473 474/** 475 * Open Login Modal 476 * 477 * This function handles the opening of the login modal. It's used in various scenarios 478 * such as saving to favorites, saving a search, or adding a property when login is required. 479 * The function behaves differently based on the screen size (desktop vs mobile). 480 * 481 * @since 1.0.0 482 * 483 * @requires jQuery 484 * @requires Modernizr 485 * 486 * @return {void} 487 */ 488function wpestate_trigger_login_modal_open(stayOnPage) { 489 // Check if the screen width is greater than 768px (non-mobile devices) 490 // stayOnPage is a flag that indicates if the page should be reloaded after login 1-yes, 0-no will reload page from theme option , 2 - no will reload current page 491 if(!wpestate_isMobileOrTablet()){ 492 // Desktop behavior 493 var login_modal = jQuery('#modal_login_wrapper'); 494 495 // Show the login modal 496 login_modal.show(); 497 // Set focus to the first focusable element in the modal 498 login_modal.find('[autofocus]').focus(); 499 500 // Set the loginpop value to 1 (indicating a popup login) 501 login_modal.find('.loginpop').val(stayOnPage); 502 } else { 503 // Mobile behavior 504 // Trigger the mobile user menu 505 jQuery('.mobile-trigger-user').trigger('click'); 506 507 // Set the loginpop value to 1 in the mobile wrapper 508 jQuery('.mobilewrapper-user .loginpop').val(stayOnPage); 509 } 510} 511 512 513function wpestate_bootstrap53_dropdown(){ 514 jQuery('.wpresidence_dropdown .dropdown-menu li').on('click', function() { 515 // Get the selected value and label 516 var selectedValue = jQuery(this).data('value'); 517 var selectedLabel = jQuery(this).text(); 518 519 // Update the button text 520 jQuery(this).closest('.wpresidence_dropdown').find('.dropdown-toggle').text(selectedLabel); 521 522 // Update the hidden input value 523 jQuery(this).closest('.wpresidence_dropdown').find('input[type="hidden"]').val(selectedValue); 524 525 // Optionally close the dropdown after selection 526 jQuery(this).closest('.dropdown').removeClass('show'); 527 jQuery(this).closest('.dropdown').find('.dropdown-menu').removeClass('show'); 528 }); 529} 530 531 532 533jQuery(document).ready(function () { 534 "use strict"; 535 536 wpestate_bootstrap53_dropdown(); 537 wpestate_initializeTooltips_bootstrap53(); 538 539 // Calculate the initial threshold for advanced search sticky 540 calculateSearchbarThreshold(); 541 // Get the initial scroll position 542 var initialScroll = jQuery(window).scrollTop(); 543 // Call the function to set the correct initial state for advanced search sticky 544 wpestate_adv_search_sticky(initialScroll); 545 546 // trigger login modal open 547 wpestate_trigger_login_modal_open_action(); 548 549 550 jQuery('#login_user_wd').focus({ preventScroll: true }); 551 552 if(jQuery('.wpestate_anime').length>0 ){ 553 jQuery('.wpestate_anime').each( function(){ 554 var element_id = jQuery(this).attr('id'); 555 wpestate_property_list_sh('#'+element_id+' .wpestate_item_list_sh', '#'+element_id+' .control_tax_sh'); 556 }); 557 558 } 559 wpestate_change_currency_dropdown_action(); 560 wpestate_adjustMegaMenuPosition(); 561 wpestate_reposion_dropdowns(); 562 wpestate_beds_baths_component(); 563 wpestate_price_component_item(); 564 wpestate_price_component_item_v3(); 565 566 wpestate_blog_list_widget(); 567 wpestate_get_location(); 568 wpestate_grid_list_controls(); 569 570 wpestate_slider_box(); 571 wpestate_enable_share_unit(); 572 wpestate_control_media_buttons(); 573 wpestate_card_unit_contact_actions(); 574 wpestate_morgate_widget_action(); 575 wpestate_zillow_widget_action(); 576 wpestate_save_search_actions(); 577 wpestate_delete_save_search_actions(); 578 wpestate_overview_map(); 579 wpestate_extended_search_function(); 580 wpresidence_advanced_searc_6_actions(); 581 wpestate_show_hide_search_form_hidden_fields(); 582 wpestate_adjust_sticky_footer(); 583 wpestate_map_types_control(); 584 585
586 //////////////////////////////////////////////////////////////////////////////////////////// 587 ///city-area-selection 588 /////////////////////////////////////////////////////////////////////////////////////////// 589 590 wpestate_filter_city_area('filter_city','filter_area'); 591 wpestate_filter_city_area('sidebar-adv-search-city','sidebar-adv-search-area'); 592 wpestate_filter_city_area('adv-search-city','adv-search-area'); 593 wpestate_filter_city_area('half-adv-search-city','half-adv-search-area'); 594 wpestate_filter_city_area('shortcode-adv-search-city','shortcode-adv-search-area'); 595 wpestate_filter_city_area('mobile-adv-search-city','mobile-adv-search-area'); 596 wpestate_filter_city_area('property_city_submit', 'property_area_submit'); 597 wpestate_filter_city_area('a_filter_cities', 'a_filter_areas'); 598 wpestate_filter_city_area('advanced_city', 'advanced_area'); 599 600 //////////////////////////////////////////////////////////////////////////////////////////// 601 //county-city-selection 602 /////////////////////////////////////////////////////////////////////////////////////////// 603 wpestate_filter_county_city( 'filter_county', 'filter_city' ); 604 wpestate_filter_county_city( 'sidebar-adv-search-countystate', 'sidebar-adv-search-city' ); 605 wpestate_filter_county_city( 'adv-search-countystate', 'adv-search-city' ); 606 wpestate_filter_county_city( 'half-adv-search-countystate', 'half-adv-search-city' ); 607 wpestate_filter_county_city( 'shortcode-adv-search-countystate', 'shortcode-adv-search-city' ); 608 wpestate_filter_county_city( 'mobile-adv-search-countystate', 'mobile-adv-search-city' ); 609 wpestate_filter_county_city( 'a_filter_county', 'a_filter_cities' ); 610 wpestate_filter_county_city( 'county-state', 'advanced_city' ); 611 612 613 614 if(jQuery('.googleMap_shortcode_class').length>0 ){ 615 if( jQuery(".single-estate_property").length==0 ){ 616 wpestate_map_shortcode_function(); 617 }else{ 618 if( jQuery("#googleMap").length==0 && jQuery("#googleMapSlider").length==0 ){ 619 } 620 } 621 } 622 623 624 jQuery('body').on('click', '.add_custom_parameter', function(){ 625 const cloned = ` 626 <div class="cliche_row row"> 627 <div class="col-md-5"> 628 <label for="agent_custom_label">${control_vars.agent_field_name}</label> 629 <input type="text" class="form-control agent_custom_label" value="" name="agent_custom_label[]"> 630 </div> 631 <div class="col-md-5"> 632 <label for="agent_custom_value">${control_vars.agent_field_value}</label> 633 <input type="text" class="form-control agent_custom_value" value="" name="agent_custom_value[]"> 634 </div> 635 <div class="col-md-2"> 636 <button type="button" class="wpresidence_button remove_parameter_button">${control_vars.remove}</button> 637 </div> 638 </div> 639 `; 640 641 jQuery('input', cloned).val(''); 642 jQuery('.wpresidence_button.add_custom_parameter').before( cloned ); 643 }); 644 645 646 647 648 jQuery('body').on('click', '.remove_parameter_button', function(){ 649 var pnt = jQuery(this).parents( '.cliche_row' ); 650 pnt.fadeOut(500, function(){ 651 pnt.replaceWith(''); 652 }); 653 }); 654 655 656 jQuery('.buy_package_sh a').on( 'click', function(event) { 657 if (parseInt(ajaxcalls_vars.userid, 10) === 0 ) { 658 event.preventDefault(); 659 jQuery('#modal_login_wrapper').show(); 660 jQuery('#modal_login_wrapper').find('[autofocus]').focus(); 661 jQuery('.loginpop').val('1'); 662 } 663 }); 664 665 if (typeof wpestate_enable_half_map_pin_action == 'function'){ 666 wpestate_enable_half_map_pin_action(); 667 } 668 669 670 671 var screen_width,screen_height,map_tab; 672 673 jQuery.datepicker.setDefaults( jQuery.datepicker.regional[control_vars.datepick_lang] ); 674 675 676 677 678 estate_splash_slider(); 679 680 681 var new_height; 682 if (jQuery(".full_screen_yes").length) { 683 684 if( jQuery('.header_transparent').length > 0){ 685 new_height = jQuery( window ).height(); 686 }else{ 687 new_height = jQuery( window ).height() - jQuery('.master_header').height(); 688 } 689
690 if( jQuery('.with_search_on_start').length>0 ){ 691 new_height=new_height- jQuery('.search_wrapper.with_search_on_start ').height(); 692 } 693 694 jQuery('.wpestate_header_image,.wpestate_header_video,.theme_slider_wrapper,.theme_slider_classic,.theme_slider_wrapper .item_type2 ').css('height',new_height); 695 } 696 697 698 699 700 701 702 jQuery('.wp-block-residence-gutenberg-block-testimonial-slider').each(function(){ 703 704 if( jQuery(this).find('.type_class_3 ').length>0 ){ 705 jQuery(this).addClass('container_type_3'); 706 } 707 708 }) 709 710 711 712 713 714 715 jQuery('#preview_view_all').on( 'click', function(event) { 716 717 if( (mapfunctions_vars.adv_search_type==='6' || mapfunctions_vars.adv_search_type==='7' || mapfunctions_vars.adv_search_type==='8' || mapfunctions_vars.adv_search_type==='9' ) ){ 718 719 jQuery('.search_wrapper .tab-pane.active .wpresidence_button').trigger('click'); 720 }else{ 721 jQuery('.search_wrapper .wpresidence_button').trigger('click'); 722 } 723 }); 724 725 726 jQuery('.theme_slider_2 .prop_new_details ').on( 'click', function(event) { 727 728 var new_link; 729 new_link = jQuery(this).attr('data-href'); 730 window.open (new_link,'_self',false); 731 }); 732 733 jQuery('.theme_slider_classic').on( 'click', function(event) { 734 735 if (event.target == this) { 736 var new_link; 737 new_link = jQuery(this).attr('data-href'); 738 window.open (new_link,'_self',false); 739 } 740 }); 741 742 setTimeout(function() { wpresidence_list_view_arrange(); }, 300); 743 744 ////////// map shortcode 745 map_tab=0; 746 jQuery('#propmaptrigger').on( 'click', function(event) { 747 if(map_tab===0){ 748 749 wpestate_map_shortcode_function(); 750 map_tab=1; 751 752 } 753 }); 754 755 756 setTimeout(function(){ 757 jQuery('.theme_slider_2 .theme_slider_2_contact_agent').fadeIn(); 758 }, 700); 759 760 761 //////////////////////////// 762 // taxonomy slick slider 763 //////////////////////////// 764 wpestate_half_map_responsive(); 765 wpestate_half_map_controls(); 766 767 jQuery('.show_stats').on( 'click', function(event) { 768 event.preventDefault(); 769 var parent,listing_id; 770 parent = jQuery(this).parent().parent().parent(); 771 listing_id = jQuery(this).attr('data-listingid'); 772 //jQuery('.statistics_wrapper').slideUp(); 773 774 if( parent.find('.statistics_wrapper').hasClass('is_slide') ){ 775 parent.find('.statistics_wrapper').slideUp().removeClass('is_slide'); 776 }else{ 777 parent.find('.statistics_wrapper').slideDown().addClass('is_slide'); 778 wpestate_load_stats(listing_id); 779 } 780 781 782 783 784 }); 785 786 jQuery('.tabs_stats,#1462452319500-8587db8d-e959,#1462968563400-b8613baa-7092').on( 'click', function(event) { 787 var parent,listing_id; 788 listing_id = jQuery(this).attr('data-listingid'); 789 if(typeof(listing_id)==='undefined'){ 790 listing_id = jQuery('.estate_property_first_row').attr('data-prp-listingid'); 791 } 792 793 794 wpestate_load_stats_tabs(listing_id); 795 }); 796 797 798 799 //////////////////////////////////////////////////////////////////////////// 800 //new retina script 801 //////////////////////////////////////////////////////////////////////////// 802 803 jQuery('.retina_ready').dense({ 804 'ping' : true, 805 'dimension' : 'preserve' 806 }); 807 var image_unnit = jQuery('<div data-1x="'+control_vars.path+'/css/css-images/unit.png" data-2x="'+control_vars.path+'/css/css-images/unit_2x.png" />').dense('getImageAttribute'); 808 var image_unnit = jQuery('<div data-1x="'+control_vars.path+'/css/css-images/unitshare.png" data-2x="'+control_vars.path+'/css/css-images/unitshare_2x.png" />').dense('getImageAttribute'); 809 810 //////////////////////////////////////////////////////////////////////////// 811 //invoice filters 812 //////////////////////////////////////////////////////////////////////////// 813 814 815 jQuery(function() { 816 jQuery("#invoice_start_date,#invoice_end_date").datepicker({ 817 dateFormat : "yy-mm-dd", 818 }).datepicker('widget').wrap('<div class="ll-skin-melon"/>'); 819 }); 820 821
822 //////////////////////////////////////////////////////////////////////////// 823 //new mobile menu 1.10 824 //////////////////////////////////////////////////////////////////////////// 825 826 jQuery('.all-elements').animate({ 827 minHeight: 100+'%' 828 }); 829 830 jQuery('.header-tip').addClass('hide-header-tip'); 831 832 wpestate_mobile_menu_slideout(); 833 wpestate_mobile_menu_open_submenu(); 834 wpestate_elementor_mobile_menu_trigger_open(); 835 836 837 838 839 840 841 842 //////////////////////////////////////////////////////////////////////////// 843 // easure unit cookige 844 //////////////////////////////////////////////////////////////////////////// 845 846 jQuery('.list_sidebar_measure_unit li').on( 'click', function(event) { 847 var ajaxurl,value, pick; 848 value = jQuery(this).attr('data-value'); 849 850 var parent_pointer = jQuery(this).parents('.dropdown '); 851 pick = jQuery(this).text(); 852 jQuery('.sidebar_filter_menu', parent_pointer).text(pick).append('<span class="caret caret_sidebar"></span>'); 853 var nonce = jQuery('#wpestate_change_measure').val(); 854 ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php'; 855 jQuery.ajax({ 856 type: 'POST', 857 url: ajaxurl, 858 data: { 859 'action' : 'wpestate_set_cookie_measure_unit', 860 'value' : value, 861 'security' : nonce 862 }, 863 success: function (data) { 864 865 location.reload(); 866 }, 867 error: function (errorThrown) {} 868 });//end ajax 869 870 }); 871 872 873 874 875 876 877 878 879 880 881 //////////////////////////////////////////////////////////////////////////// 882 /// slider price 883 //////////////////////////////////////////////////////////////////////////// 884 885 var price_low_val= parseInt( jQuery('#price_low').val() ); 886 var price_max_val= parseInt( jQuery('#price_max').val() ); 887 var my_custom_curr_symbol = decodeURI ( wpestate_getCookie('my_custom_curr_symbol') ); 888 var my_custom_curr_coef = parseFloat( wpestate_getCookie('my_custom_curr_coef')); 889 var my_custom_curr_pos = parseFloat( wpestate_getCookie('my_custom_curr_pos')); 890 var my_custom_curr_cur_post= wpestate_getCookie('my_custom_curr_cur_post'); 891 892 893 wpestate_enable_slider('slider_price', 'price_low', 'price_max', 'amount', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef); 894 jQuery( "#slider_price" ).slider({ 895 stop: function( event, ui ) { 896 if (typeof (wpestate_show_pins) !== "undefined") { 897 first_time_wpestate_show_inpage_ajax_half=1; 898 899 wpestate_show_pins(); 900 } 901 } 902 }); 903 wpestate_enable_slider('slider_price_sh', 'price_low_sh', 'price_max_sh', 'amount_sh', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef); 904 wpestate_enable_slider('slider_price_widget', 'price_low_widget', 'price_max_widget', 'amount_wd', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef); 905 wpestate_enable_slider('slider_price_mobile', 'price_low_mobile', 'price_max_mobile', 'amount_mobile', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef); 906 907 908 wpestate_enable_slider_elementor(); 909 910 if(control_vars.adv6_taxonomy_term!==''){ 911 control_vars.adv6_taxonomy_term.forEach(wpestate_advtabs_function); 912 } 913 914 915 916 917 918 //////////////////////////////////////////////////////////////////////////// 919 920 921 922 923 924 jQuery('#estate-carousel .slider-content h3 a,#estate-carousel .slider-content .read_more ').on( 'click', function(event) { 925 var new_link; 926 new_link = jQuery(this).attr('href'); 927 window.open (new_link,'_self',false); 928 }); 929 930 931 932 933 934 935 //////////////////////////////////////////////////////////////////////////////////////////// 936 ///mobile 937 /////////////////////////////////////////////////////////////////////////////////////////// 938 939 940 jQuery('#adv-search-header-mobile').on( 'click', function(event) { 941 jQuery('#adv-search-mobile').fadeToggle('300'); 942 943 }); 944 945
946 //////////////////////////////////////////////////////////////////////////////////////////// 947 ///navigational links 948 /////////////////////////////////////////////////////////////////////////////////////////// 949 950 jQuery('.nav-prev,.nav-next ').on( 'click', function(event) { 951 event.preventDefault(); 952 var link = jQuery(this).find('a').attr('href'); 953 window.open (link,'_self',false); 954 }); 955 956 //////////////////////////////////////////////////////////////////////////////////////////// 957 /// featured agent 958 /////////////////////////////////////////////////////////////////////////////////////////// 959 960 961 jQuery('.featured_agent_details_wrapper, .agent-listing-img-wrapper').on( 'click', function(event) { 962 var newl= jQuery( this ).attr('data-link'); 963 window.open (newl,'_self',false); 964 }); 965 966 jQuery('.see_my_list_featured').on( 'click', function(event) { 967 event.stopPropagation(); 968 }); 969 970 //////////////////////////////////////////////////////////////////////////////////////////// 971 /// featuerd property 972 /////////////////////////////////////////////////////////////////////////////////////////// 973 974 jQuery('.featured_cover').on( 'click', function(event) { 975 var newl= jQuery( this ).attr('data-link'); 976 window.open (newl,'_self',false); 977 }); 978 979 980 jQuery( '.agent_face' ) 981 .on('mouseenter', function(){ jQuery(this).find('.agent_face_details').fadeIn('500'); }) 982 .on('mouseleave', function(){ jQuery(this).find('.agent_face_details').fadeOut('500'); }); 983 984 985 //////////////////////////////////////////////////////////////////////////////////////////// 986 /// listings unit navigation 987 /////////////////////////////////////////////////////////////////////////////////////////// 988 jQuery('.places_cover,.agent_unit, .blog_unit , .featured_widget_image,.blog3v .property_listing_blog,.featured_img_type2').on( 'click', function(event) { 989 var link; 990 link = jQuery(this).attr('data-link'); 991 992 window.open(link, '_self'); 993 }); 994 995 996 997 jQuery('.property_listing').on( 'click', function(event) { 998 999 if ( 1000 event.target.classList.contains('demo-icon') || 1001 event.target.classList.contains('carousel-control-next-icon') || 1002 event.target.classList.contains('carousel-control-prev-icon') 1003 ){ 1004 1005 return; 1006 } 1007 1008 if(control_vars.property_modal === '1' && !Modernizr.mq('only all and (max-width: 1024px)') ){ 1009 event.preventDefault(); 1010 event.stopPropagation(); 1011 scroll_modal_save=scroll_modal; 1012 1013 var listing_id = jQuery(this).parent().attr('data-listid'); 1014 var main_img_url= jQuery(this).parent().attr('data-main-modal'); 1015 var main_title = jQuery(this).parent().attr('data-modal-title'); 1016 var link = jQuery(this).parent().attr('data-modal-link'); 1017 wpestate_enable_property_modal(listing_id,main_img_url,main_title,link); 1018 }else{ 1019 1020 if(control_vars.new_page_link==='_blank' && !jQuery(this).hasClass('places_listing')){ 1021 return; 1022 } 1023 var link; 1024 link = jQuery(this).attr('data-link'); 1025 1026 window.open(link, '_self'); 1027 } 1028 }); 1029 1030 1031 1032 1033 1034 1035 jQuery('.share_unit').on( 'click', function(event) { 1036 event.stopPropagation(); 1037 }); 1038 1039 jQuery('.related_blog_unit_image').on( 'click', function(event) { 1040 var link; 1041 link = jQuery(this).attr('data-related-link'); 1042 window.open(link, '_self'); 1043 }); 1044 1045 //////////////////////////////////////////////////////////////////////////////////////////// 1046 /// user menu 1047 /////////////////////////////////////////////////////////////////////////////////////////// 1048 1049 wpestate_open_menu(); 1050 1051 1052 1053 jQuery('#user_menu_u.user_not_loged .submit_action').on( 'click', function(event) { 1054 jQuery('.login-links').show(); 1055 jQuery('#modal_login_wrapper').show(); 1056 jQuery('#modal_login_wrapper').find('[autofocus]').focus(); 1057 }); 1058 1059 1060 1061 jQuery('#property_details_modal_close').on('click',function(event){ 1062 jQuery('.website-wrapper').removeAttr('style'); 1063 window.scrollTo(0, parseInt(scroll_modal_save) ); 1064 jQuery('#property_details_modal_wrapper').hide(); 1065 window.history.pushState("", modal_title,modal_url); 1066 }); 1067 1068 jQuery('#shopping-cart').on('click',function (event) { 1069 1070 jQuery('#user_menu_open').removeClass('iosfixed').fadeOut(400); 1071 if (jQuery('#wpestate_header_shoping_cart').is(":visible")) { 1072 jQuery('#wpestate_header_shoping_cart').fadeOut(400); 1073 } else { 1074 jQuery('#wpestate_header_shoping_cart').fadeIn(400); 1075 } 1076 event.stopPropagation(); 1077 }); 1078 1079 1080 jQuery(document).on( 'click', function(event) { 1081 1082 var clicka = event.target.id; 1083 var clicka2 = jQuery(event.target).attr('share_unit'); 1084 jQuery('#wpestate_header_shoping_cart').fadeOut(400); 1085 if ( !jQuery('#'+clicka).parents('.topmenux').length) { 1086 jQuery('#user_menu_open').removeClass('iosfixed').hide(400); 1087 jQuery('.navicon-button').removeClass('opensvg'); 1088 jQuery('#user_menu_u .navicon-button').removeClass('open'); 1089 } 1090 1091 jQuery('.share_unit').hide(); 1092 1093 1094 if (event.target.id == "header_type3_wrapper" || jQuery(event.target).parents("#header_type3_wrapper").size()) { 1095 1096 } else { 1097 var css_right = parseFloat( jQuery('.header_type3_menu_sidebar').css('right') ); 1098 var css_left = parseFloat( jQuery('.header_type3_menu_sidebar').css('left') ); 1099 if(css_right===0 || css_left===0 ){ 1100 jQuery('.header_type3_menu_sidebar.header_left.sidebaropen').css("right","-300px"); 1101 jQuery('.header_type3_menu_sidebar.header_right.sidebaropen').css("left","-300px"); 1102 jQuery('.container.main_wrapper.has_header_type3').css("padding","0p
1102x"); 1103 jQuery('.elementor-section.elementor-top-section ').css("padding-right","0px"); 1104 jQuery('.elementor-section.elementor-top-section ').css("padding-left","0px"); 1105 jQuery('.master_header').removeAttr('style'); 1106 1107 } 1108 } 1109 }); 1110 1111 1112 jQuery('#header_type3_trigger').on( 'click', function(event) { 1113 1114 event.preventDefault(); 1115 if ( !jQuery('.container').hasClass('is_boxed') ){ 1116 if( jQuery('.header_type3_menu_sidebar').hasClass('header_left') ){ 1117 jQuery(".header_type3_menu_sidebar").css("right","0px"); 1118 jQuery(".container.main_wrapper ").css("padding-right","300px"); 1119 jQuery('.elementor-section.elementor-top-section ').css("padding-right","300px"); 1120 jQuery(".master_header").css("right","150px"); 1121 }else{ 1122 jQuery(".header_type3_menu_sidebar").css("left","0px"); 1123 jQuery(".container.main_wrapper ").css("padding-left","300px"); 1124 jQuery('.elementor-section.elementor-top-section ').css("padding-left","300px"); 1125 jQuery(".master_header").css("left","150px"); 1126 1127 } 1128 jQuery(".header_type3_menu_sidebar").addClass("sidebaropen"); 1129 }else{ 1130 if( jQuery('.header_type3_menu_sidebar').hasClass('header_left') ){ 1131 jQuery(".header_type3_menu_sidebar").css("right","0px"); 1132 1133 }else{ 1134 jQuery(".header_type3_menu_sidebar").css("left","0px"); 1135 1136 } 1137 jQuery(".header_type3_menu_sidebar").addClass("sidebaropen"); 1138 } 1139 }); 1140 1141 1142 //////////////////////////////////////////////////////////////////////////////////////////// 1143 /// new controls for upload pictures 1144 /////////////////////////////////////////////////////////////////////////////////////////// 1145 1146 jQuery('#imagelist i.fa-trash-alt').on( 'click', function(event) { 1147 var curent=''; 1148 jQuery(this).parent().remove(); 1149 1150 jQuery('#imagelist .uploaded_images').each(function(){ 1151 curent=curent+','+jQuery(this).attr('data-imageid'); 1152 }); 1153 jQuery('#attachid').val(curent); 1154 1155 }); 1156 1157 jQuery('#imagelist img').dblclick(function(){ 1158 1159 jQuery('#imagelist .uploaded_images .thumber').each(function(){ 1160 jQuery(this).remove(); 1161 }); 1162 1163 jQuery(this).parent().append('<i class="fa thumber fa-star"></i>'); 1164 jQuery('#attachthumb').val( jQuery(this).parent().attr('data-imageid') ); 1165 }); 1166 1167 1168 1169 1170 1171 jQuery('#switch').on( 'click', function(event) { 1172 jQuery('.main_wrapper').toggleClass('wide'); 1173 }); 1174 1175 1176 jQuery('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features').on('shown.bs.collapse', function () { 1177 jQuery(this).find('h4').removeClass('carusel_closed'); 1178 }); 1179 1180 jQuery('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features').on('hidden.bs.collapse', function () { 1181 jQuery(this).find('h4').addClass('carusel_closed'); 1182 }); 1183 1184 /////////////////////////////////////////////////////////////////////////////////////////// 1185 //////// advanced search filters 1186 //////////////////////////////////////////////////////////////////////////////////////////// 1187 1188 var elems = ['.directory_sidebar','.search_wrapper' , 1189 '#advanced_search_shortcode', '#advanced_search_shortcode_2', '.adv-search-mobile','.advanced_search_sidebar']; 1190 1191 jQuery.each( elems, function( i, elem ) { 1192 1193 jQuery(elem+' li').on( 'click', function(event) { 1194 event.preventDefault(); 1195 var pick, value, parent,parent_replace; 1196 parent_replace='.filter_menu_trigger'; 1197 if(elem === '.advanced_search_sidebar' ){ 1198 parent_replace='.sidebar_filter_menu'; 1199 } 1200 1201 pick = jQuery(this).text(); 1202 value = jQuery(this).attr('data-value'); 1203 1204 // agents search patch 1205 //if( jQuery(this).parents('.advanced_search_sidebar').hasClass('ag_ag_dev_search_widget') ){ 1206 if( jQuery(this).parent().hasClass('aag_picker') ){ 1207 jQuery('.ag_ag_dev_search_selector').hide(); 1208 jQuery('.selector_for_'+value).fadeIn(); 1209 } 1210 1211 1212 parent = jQuery(this).parent().parent(); 1213 if(elem === '.directory_sidebar' ){ 1214 parent.find(parent_replace).text(pick).attr('data-value',value); 1215 }else{ 1216 parent.find(parent_replace).text(pick).attr('data-value',value); 1217 } 1218 parent.find('input').val(value); 1219 }); 1220 }); 1221 1222 1223 1224 1225 jQuery('.search_wrapper li, .extended_search_check_wrapper input[type="checkbox"]').on( 'click', function(event) { 1226 1227 if(jQuery(this).hasClass('wpestate_prevent_ajax')){ 1228 return; 1229 } 1230 1231 if (typeof (wpestate_show_pins) !== "undefined") { 1232 first_time_wpestate_show_inpage_ajax_half=1; 1233 wpestate_show_pins(); 1234 } 1235 }); 1236 1237 1238 1239 1240 1241 var typingTimer; //timer identifier 1242 var doneTypingInterval = 1500; //time in ms, 5 second for example 1243 var jQueryinput = jQuery('#adv_location,.search_wrapper input[type=text]'); 1244 1245 jQueryinput.on('keyup', function (event) { 1246 if(jQuery(this).attr('id')=='geolocation_search' || jQuery(this).attr('id')=='geolocation_search2') { 1247 return; 1248 } 1249 if (event.keyCode === 13) { 1250 first_time_wpestate_show_inpage_ajax_half=1; 1251 wpestate_show_pins(); 1252 } 1253 }); 1254 1255 //on keydown, clear the countdown 1256 jQueryinput.on('keydown', function () { 1257 clearTimeout(typingTimer); 1258 }); 1259 1260 1261
1262 /////////////////////////////////////////////////////////////////////////////////////////// 1263 //////// advanced search filters 1264 //////////////////////////////////////////////////////////////////////////////////////////// 1265 1266 jQuery('#openmap').on( 'click', function(event) { 1267 1268 if( jQuery(this).find('i').hasClass('fa-angle-down') ){ 1269 jQuery(this).empty().append('<i class="fas fa-angle-up"></i>'+control_vars.close_map); 1270 1271 if (control_vars.show_adv_search_map_close === 'no') { 1272 jQuery('.search_wrapper').addClass('adv1_close'); 1273 wpestate_adv_search_click(); 1274 } 1275 1276 }else{ 1277 jQuery(this).empty().append('<i class="fas fa-angle-down"></i>'+control_vars.open_map); 1278 1279 } 1280 wpestate_new_open_close_map(2); 1281 1282 }); 1283 1284 1285 /////////////////////////////////////////////////////////////////////////////////////////// 1286 //////// full screen map 1287 //////////////////////////////////////////////////////////////////////////////////////////// 1288 var wrap_h; 1289 var map_h; 1290 1291 jQuery('#gmap-full').on( 'click', function(event) { 1292 1293 1294 if( jQuery('#gmap_wrapper').hasClass('fullmap') ){ 1295 jQuery('#google_map_prop_list_wrapper').removeClass('fullhalf'); 1296 1297 jQuery('#gmap_wrapper').removeClass('fullmap').css('height',wrap_h+'px'); 1298 jQuery('#googleMap').removeClass('fullmap').css('height',map_h+'px'); 1299 jQuery('.master_header ').removeClass('header_full_map'); 1300 jQuery('#search_wrapper').removeClass('fullscreen_search'); 1301 jQuery('#search_wrapper').removeClass('fullscreen_search_open'); 1302 1303 if( !jQuery('#google_map_prop_list_wrapper').length ){ 1304 jQuery('.content_wrapper').show(); 1305 } 1306 jQuery('body,html').animate({ 1307 scrollTop: 0 1308 }, "slow"); 1309 jQuery('#openmap').show(); 1310 jQuery(this).empty().append('<i class="fas fa-arrows-alt"></i>'+control_vars.fullscreen).removeClass('spanselected'); 1311 1312 jQuery('#google_map_prop_list_wrapper').removeClass('fullscreen'); 1313 jQuery('#google_map_prop_list_sidebar').removeClass('fullscreen'); 1314 1315 1316 }else{ 1317 jQuery('#gmap_wrapper,#googleMap').css('height','100%').addClass('fullmap'); 1318 1319 jQuery('#google_map_prop_list_wrapper').addClass('fullscreen'); 1320 jQuery('#google_map_prop_list_sidebar').addClass('fullscreen'); 1321 1322 1323 1324 1325 jQuery('#google_map_prop_list_wrapper').addClass('fullhalf'); 1326 1327 1328 wrap_h=jQuery('#gmap_wrapper').outerHeight(); 1329 map_h=jQuery('#googleMap').outerHeight(); 1330 1331 jQuery('.master_header ').addClass('header_full_map'); 1332 1333 1334 jQuery('#search_wrapper').addClass('fullscreen_search'); 1335 1336 if( !jQuery('#google_map_prop_list_wrapper').length ){ 1337 jQuery('.content_wrapper').hide(); 1338 } 1339 1340 jQuery('#openmap').hide(); 1341 jQuery(this).empty().append('<i class="fas fa-square"></i>'+control_vars.default).addClass('spanselected'); 1342 1343 } 1344 wpresidence_map_resise(); 1345 1346 1347 1348 }); 1349 1350 1351 jQuery('#street-view').on( 'click', function(event) { 1352 wpestate_toggleStreetView(); 1353 }); 1354 1355 1356 1357 1358 1359 /////////////////////////////////////////////////////////////////////////////////////////// 1360 /////// caption-wrapper 1361 /////////////////////////////////////////////////////////////////////////////////////////// 1362 1363 jQuery('.caption-wrapper').on( 'click', function(event) { 1364 jQuery(this).toggleClass('closed'); 1365 jQuery('.carusel-back').toggleClass('rowclosed'); 1366 jQuery('.wpestate_horizontal_slider_wrapper .carousel-indicators').toggleClass('rowclosed'); 1367 }); 1368 1369 jQuery('.carousel-round-indicators li').on( 'click', function(event) { 1370 jQuery('.carousel-round-indicators li').removeClass('active'); 1371 jQuery(this).addClass('active'); 1372 }); 1373 1374 jQuery('.videoitem iframe').on( 'click', function(event) { 1375 jQuery('.estate_video_control').remove(); 1376 });
1377 /////////////////////////////////////////////////////////////////////////////////////// 1378 ////// Advanced search 1379 ///////////////////////////////////////////////////////////////////////////////////////// 1380 1381 wpestate_adv_search_click(); 1382 1383 1384 jQuery('.custom_details_container .send_email_agent').on( 'click', function(event) { 1385 event.preventDefault(); 1386 1387 jQuery('body,html').animate({ 1388 scrollTop: ( jQuery("#show_contact").offset().top-100) 1389 }, "slow"); 1390 1391 }); 1392 1393 /////////////////////////////////////////////////////////////////////////////////////////// 1394 /////// back to top 1395 /////////////////////////////////////////////////////////////////////////////////////////// 1396 1397 1398 jQuery('.backtop').on( 'click', function(event) { 1399 event.preventDefault(); 1400 1401 jQuery('body,html').animate({ 1402 scrollTop: 0 1403 }, "slow"); 1404 1405 }); 1406 1407 /////////////////////////////////////////////////////////////////////////////////////////// 1408 /////// footer contact 1409 /////////////////////////////////////////////////////////////////////////////////////////// 1410 1411 jQuery('.contact-box ').on( 'click', function(event) { 1412 event.preventDefault(); 1413 jQuery('.contactformwrapper').toggleClass('hidden'); 1414 wpestate_contact_footer_starter(); 1415 }); 1416 1417 1418 1419 1420 1421 /////////////////////////////////////////////////////////////////////////////////////////// 1422 /////// Search widget 1423 /////////////////////////////////////////////////////////////////////////////////////////// 1424 jQuery('#searchform input').focus(function(){ 1425 jQuery(this).val(''); 1426 }).blur(function(){ 1427 1428 }); 1429 1430 1431 1432 //////////////////////////////////////////////////////////////////////////////////////////// 1433 /// adding total for featured listings 1434 /////////////////////////////////////////////////////////////////////////////////////////// 1435 jQuery('.extra_featured').on('change', function(){ 1436 var parent= jQuery(this).parent().parent(); 1437 var price_regular = parseFloat( parent.find('.submit-price-no').text(),10 ); 1438 var price_featured = parseFloat( parent.find('.submit-price-featured').text(),10 ); 1439 var total= price_regular+price_featured; 1440 1441 if( jQuery(this).is(':checked') ){ 1442 parent.find('.submit-price-total').text(total); 1443 parent.find('.stripe_form_featured').show(); 1444 parent.find('.stripe_form_simple').hide(); 1445 }else{ 1446 //substract from total 1447 parent.find('.submit-price-total').text(price_regular); 1448 parent.find('.stripe_form_featured').hide(); 1449 parent.find('.stripe_form_simple').show(); 1450 } 1451 }); 1452 1453 1454 1455 ///////////////////////////////////////////////////////////////////////////////////////// 1456 /////// grid to list view 1457 /////////////////////////////////////////////////////////////////////////////////////////// 1458 1459 1460 jQuery('.col-md-12.listing_wrapper .property_unit_custom_element.image').each(function(){ 1461 jQuery(this).parent().addClass('wrap_custom_image'); 1462 }); 1463 1464 1465 1466 1467 1468 1469 /////////////////////////////////////////////////////////////////////////////////////////// 1470 /////// compare action 1471 /////////////////////////////////////////////////////////////////////////////////////////// 1472 var already_in=[]; 1473 jQuery('#compare_close').on( 'click', function(event) { 1474 jQuery('.prop-compare').animate({ 1475 right: "-240px" 1476 }); 1477 }); 1478 1479 jQuery('.compare-action').on( 'click', function(e) { 1480 1481 e.preventDefault(); 1482 e.stopPropagation(); 1483 jQuery('.prop-compare').animate({ 1484 right: "0px" 1485 }); 1486 1487 var post_id = jQuery(this).attr('data-pid'); 1488 for(var i = 0; i < already_in.length; i++) { 1489 if(already_in[i] === post_id) { 1490 return; 1491 } 1492 } 1493 1494 already_in.push(post_id); 1495 1496 1497 var post_image = jQuery(this).attr('data-pimage'); 1498 1499 var to_add = '<div class="items_compare" style="display:none;"><img src="' + post_image + '" class="img-responsive"><input type="hidden" value="' + post_id + '" name="selected_id[]" /></div>'; 1500 jQuery('div.items_compare:first-child').css('background', 'red');
1501 if (parseInt(jQuery('.items_compare').length,10) > 3) { 1502 jQuery('.items_compare:first').remove(); 1503 } 1504 jQuery('#submit_compare').before(to_add); 1505 1506 jQuery('#submit_compare').on( 'click', function(event) { 1507 jQuery('#form_compare').trigger('submit'); 1508 }); 1509 1510 jQuery('.items_compare').fadeIn(500); 1511 }); 1512 1513 jQuery('#submit_compare').on( 'click', function(event) { 1514 jQuery('#form_compare').trigger('submit'); 1515 }); 1516 1517 1518 1519 ///////////////////////////////////////////////////////////////////////////////////////// 1520 ////// form upload 1521 ///////////////////////////////////////////////////////////////////////////////////////// 1522 1523 jQuery('#form_submit_2,#form_submit_1 ').on( 'click', function(event) { 1524 var loading_modal; 1525 window.scrollTo(0, 0); 1526 loading_modal='<div class="modal fade" id="loadingmodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-body listing-submit"><span>'+control_vars.addprop+'</div></div></div></div></div>'; 1527 1528 jQuery('body').append(loading_modal); 1529 jQuery('#loadingmodal').modal(); 1530 }); 1531 1532 1533 jQuery('#add-new-image').on( 'click', function(event) { 1534 jQuery('<p><label for="file">New Image:</label><input type="file" name="upload_attachment[]" id="file_featured"></p> ').appendTo('#files_area'); 1535 }); 1536 1537 1538 1539 jQuery('.delete_image').on( 'click', function(event) { 1540 var image_id=jQuery(this).attr('data-imageid'); 1541 1542 var curent=jQuery('#images_todelete').val(); 1543 if(curent===''){ 1544 curent=image_id; 1545 }else{ 1546 curent=curent+','+image_id; 1547 } 1548 1549 jQuery('#images_todelete').val(curent) ; 1550 jQuery(this).parent().remove(); 1551 }); 1552 1553 ///////////////////////////////////////////////////////////////////////////////////////// 1554 ////// mouse over map tooltip 1555 ///////////////////////////////////////////////////////////////////////////////////////// 1556 1557 jQuery('#googleMap').on('mousemove', function(e){ 1558 jQuery('.tooltip').css({'top':e.pageY,'left':e.pageX, 'z-index':'1'}); 1559 }); 1560 1561 setTimeout(function(){ jQuery('.tooltip').fadeOut("fast");},10000); 1562}); 1563 1564///////////////////////////////////////////////////// 1565////////////////// END ready 1566 1567 1568/** 1569 * Initializes Bootstrap tooltips for all elements with the 'data-bs-toggle="tooltip"' attribute. 1570 * This function selects all elements that should have tooltips and applies the Bootstrap tooltip 1571 * functionality to each of them. It should be called after the DOM is fully loaded to ensure all 1572 * elements are accessible. 1573 */ 1574function wpestate_initializeTooltips_bootstrap53() { 1575 // Select all elements with the 'data-bs-toggle="tooltip"' attribute 1576 var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); 1577 1578 // Initialize a Bootstrap tooltip for each selected element 1579 var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 1580 return new bootstrap.Tooltip(tooltipTriggerEl); 1581 }); 1582} 1583 1584 1585 1586/* 1587* control google map types 1588* 1589*/ 1590 1591function wpestate_map_types_control(){ 1592 1593 1594 jQuery('#map-view').on( 'click', function(event) { 1595 jQuery('.wpresidence_map_styles_wrapper').toggle(); 1596 }); 1597 1598 jQuery('.map-type').on( 'click', function(event) { 1599 var map_type; 1600 jQuery('.wpresidence_map_styles_wrapper').hide(); 1601 map_type=jQuery(this).attr('id'); 1602 wpestate_change_map_type(map_type); 1603 1604 }); 1605 1606 1607 1608} 1609 1610 1611/* 1612* adjust sticky footer 1613* 1614*/ 1615 1616 1617 1618function wpestate_adjust_sticky_footer(){ 1619 if(control_vars.sticky_footer==='yes'){ 1620 var footer_height=jQuery('#colophon').height(); 1621 jQuery('.wpresidence_main_wrapper_class:not(.has_header_type4)').css('margin-bottom', footer_height); 1622 jQuery('.wpresidence_wrapper_for_header_4_colum').css('padding-bottom',footer_height); 1623 } 1624 1625} 1626 1627 1628/* 1629*multiple currency set coookie 1630* 1631*/ 1632 1633 1634function wpestate_change_currency_dropdown_action(){ 1635 1636 jQuery('.list_sidebar_currency li').on( 'click', function(event) { 1637 1638 var ajaxurl,data,pos,symbol,coef,curpos, pick; 1639 1640 data=jQuery(this).attr('data-value'); 1641 pos=jQuery(this).attr('data-pos'); 1642 symbol=jQuery(this).attr('data-symbol'); 1643 coef=jQuery(this).attr('data-coef'); 1644 curpos=jQuery(this).attr('data-curpos'); 1645 1646 var parent_pointer = jQuery(this).parents('.dropdown '); 1647 1648 ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php'; 1649 var nonce = jQuery('#wpestate_change_currency').val(); 1650 jQuery.ajax({ 1651 type: 'POST', 1652 url: ajaxurl, 1653 data: { 1654 'action' : 'wpestate_set_cookie_multiple_curr', 1655 'curr' : data, 1656 'pos' : pos,
1657 'symbol' : symbol, 1658 'coef' : coef, 1659 'curpos' : curpos, 1660 'security' : nonce 1661 }, 1662 success: function (data) { 1663 1664 location.reload(); 1665 }, 1666 error: function (errorThrown) {} 1667 });//end ajax 1668 1669 }); 1670 1671} 1672 1673/* 1674* 1675* 1676* 1677*/ 1678 1679 1680 1681 1682function wpestate_adjustMegaMenuPosition() { 1683 jQuery(".wpestate_mega_menu2_wrapper").each(function() { 1684 var $megaMenu = jQuery(this); 1685 var parentOffset = $megaMenu.closest("li").offset().left; 1686 var viewportWidth = jQuery(window).width(); 1687 $megaMenu.css({ 1688 1689 left: -parentOffset + "px", 1690 width: viewportWidth + "px", 1691 "max-width": viewportWidth + "px", 1692 }); 1693 }); 1694} 1695 1696 1697/** 1698 * WpEstate Advanced Filters Multi-Select 1699 * Handles the chained filtering between County/State -> City -> Area dropdowns 1700 * Uses Bootstrap Select plugin for enhanced multi-select functionality 1701 * 1702 * HTML Structure Expected: 1703 * - Multi-select dropdowns with class 'wpestatemultiselectselectpicker' 1704 * - Options with data-taxonomy (county / state, cities, areas) 1705 * - Options with data-parent-value matching parent selection values 1706 * 1707 * @since 5.0.5 1708 */ 1709/** 1710 * WpEstate Advanced Filters Multi-Select 1711 * Handles the chained filtering between County/State -> City -> Area dropdowns 1712 */ 1713function wpestate_advnced_filters_bars() { 1714 function initializeSelectPicker(element) { 1715 element.selectpicker({ 1716 styleBase: 'wpestate-multiselect-custom-style', 1717 size: 7 1718 }).on('changed.bs.select', function(e, clickedIndex, isSelected, previousValue) { 1719 1720 1721 var elememtParent = jQuery(this).closest('.tab-pane.active'); 1722 if (elememtParent.length == 0) { 1723 elememtParent = jQuery(this).parents().eq(2); 1724 } 1725 1726 var elementId = jQuery(this).attr('id'); 1727 1728 const county_relations = { 1729 'county-state': 'advanced_city', 1730 'sidebar-county-state': 'sidebar-advanced_city', 1731 'shortcode-county-state': 'shortcode-advanced_city', 1732 'mobile-county-state': 'mobile-advanced_city' 1733 }; 1734 1735 const city_relations = { 1736 'advanced_city': 'advanced_area', 1737 'sidebar-advanced_city': 'sidebar-advanced_area', 1738 'shortcode-advanced_city': 'shortcode-advanced_area', 1739 'mobile-advanced_city': 'mobile-advanced_area' 1740 }; 1741 1742 var selectedOption = jQuery(this).find('option').eq(clickedIndex); 1743 var attributeTaxonomy = selectedOption.attr('data-taxonomy'); 1744 var selectedOptions = jQuery(this).find('option:selected'); 1745 1746 if (attributeTaxonomy === 'cities' || attributeTaxonomy === 'county / state') { 1747 triggerChangeOn = county_relations[elementId]; 1748 if (attributeTaxonomy === 'cities') { 1749 triggerChangeOn = city_relations[elementId]; 1750 } 1751 1752 var selectedValues = jQuery(this).find('option:selected').map(function() { 1753 return jQuery(this).val(); 1754 }).get(); 1755 1756 var elementCousin = elememtParent.find('#' + triggerChangeOn); 1757 elementCousin.find('option').each(function() { 1758 var optionValue = jQuery(this).data('parent-value'); 1759 if (selectedValues.length === 0 || selectedValues.indexOf(optionValue) !== -1) { 1760 jQuery(this).show(); 1761 } else { 1762 jQuery(this).hide(); 1763 } 1764 }); 1765 1766 // Destroy and reinitialize with all event handlers 1767 elementCousin.selectpicker('destroy'); 1768 initializeSelectPicker(elementCousin); 1769 } 1770 1771 first_time_wpestate_show_inpage_ajax_half = 1; 1772 wpestate_show_pins(); 1773 1774 }).on('shown.bs.select', function(e) { 1775 var thisButton = jQuery(this); 1776 1777 var windowWidth = jQuery(window).width(); 1778 var buttonOffset = thisButton.offset(); 1779 var buttonWidth = thisButton.outerWidth(); 1780 var $dropdownMenu = jQuery(this).parent().find('.dropdown-menu.open'); 1781 1782 var distanceFromLeft = buttonOffset.left; 1783 var distanceFromRight = windowWidth - (buttonOffset.left + buttonWidth); 1784 1785 if (distanceFromLeft <= 150) { 1786 $dropdownMenu.css('left', 0); 1787 $dropdownMenu.css('right', 'auto'); 1788 } else if (distanceFromRight <= 150) { 1789 $dropdownMenu.css('left', 'auto'); 1790 $dropdownMenu.css('right', 0); 1791 } 1792 }); 1793 } 1794 1795 // Initialize all selectpickers 1796 jQuery('.wpestatemultiselectselectpicker').each(function() { 1797 initializeSelectPicker(jQuery(this)); 1798 }); 1799} 1800 1801 1802 1803 1804/**
1805 * Function to show/hide hidden fields in the WP Estate search form. 1806 * This function handles both floating and non-floating search forms, 1807 * providing smooth animations for expanding and collapsing advanced search options. 1808 */ 1809function wpestate_show_hide_search_form_hidden_fields(){ 1810 // Variable to store the original top position of the search wrapper 1811 var handler_top; 1812 1813 // Attach click event handler to the advanced search toggle button 1814 jQuery('.adv_handler').on('click', function(event) { 1815 // Prevent the default action of the click event 1816 event.preventDefault(); 1817 1818 // Select the hidden fields container 1819 var check_row = jQuery('.adv_search_hidden_fields'); 1820 1821 // Check if the search form is floating 1822 if (jQuery('#search_wrapper').hasClass('with_search_form_float')) { 1823 // Handle floating search form 1824 if (!jQuery('#search_wrapper').hasClass('openmore')) { 1825 // If the form is not expanded, prepare to open it 1826 1827 // Temporarily set display to flex and hide to measure accurate height 1828 // This is necessary because flex display can affect the element's dimensions 1829 check_row.css({'display': 'flex', 'visibility': 'hidden'}); 1830 var height = check_row.outerHeight(); 1831 // Reset to original state before animation 1832 check_row.css({'visibility': '', 'display': 'none'}); 1833 1834 // Get the current top position of the search wrapper 1835 handler_top = parseInt(jQuery('#search_wrapper').css('top')); 1836 // Calculate the new top position 1837 1838 1839 1840 // Slide down hidden fields and set to flex display after animation 1841 // This ensures smooth animation while achieving the desired flex layout 1842 check_row.slideDown({ 1843 duration: 200, 1844 queue: false, 1845 complete: function() { 1846 jQuery(this).css('display', 'flex'); 1847 } 1848 }); 1849 1850 // Mark the search wrapper as expanded 1851 jQuery('#search_wrapper').addClass('openmore'); 1852 } else { 1853 // If the form is already expanded, close it 1854 1855 // Animate the search wrapper back to its original position 1856 jQuery('#search_wrapper').animate({ 1857 'top': handler_top 1858 }, { duration: 200, queue: false }); 1859 1860 // Slide up the hidden fields 1861 check_row.slideUp({ duration: 200, queue: false }); 1862 // Remove the expanded state class 1863 jQuery('#search_wrapper').removeClass('openmore'); 1864 } 1865 } else { 1866 // Handle non-floating search form 1867 if (check_row.css('display') === 'none') { 1868 // If hidden fields are not visible, show them 1869 // Set display to flex, hide it, then slide down for smooth animation 1870 check_row.css('display', 'flex').hide().slideDown(200); 1871 } else { 1872 // If hidden fields are visible, hide them 1873 check_row.slideUp(200); 1874 } 1875 } 1876 }); 1877} 1878 1879 1880 1881 1882/** 1883 * Function to control "more options" in search form 1884 * 1885 * This function sets up event handlers for expanding and collapsing 1886 * additional search options in real estate search form. 1887 * 1888 * 1889 */ 1890function wpestate_extended_search_function(){ 1891 // Event handler for expanding the search options 1892 jQuery('.residence_adv_extended_options_text').on('click', function(event) { 1893 var parent_wrapper = jQuery(this).parent(); 1894 1895 // Hide the "More options" text 1896 jQuery(this).hide(); 1897 1898 // Find and show the extended search options 1899 var check_row = parent_wrapper.find('.extended_search_check_wrapper'); 1900 check_row.slideDown({ duration: 200, queue: false }); 1901 1902 // Show the close button 1903 parent_wrapper.find('.adv_extended_close_button').show(); 1904 }); 1905 1906 // Event handler for collapsing the search options 1907 jQuery('.adv_extended_close_button').on('click', function(event) { 1908 var parent_wrapper = jQuery(this).parent().parent(); 1909 1910 // Hide the close button 1911 jQuery(this).hide(); 1912 1913 // Show the "More options" text 1914 parent_wrapper.find('.residence_adv_extended_options_text').show(); 1915 1916 // Hide the extended search options 1917 parent_wrapper.find('.extended_search_check_wrapper').slideUp({ duration: 200, queue: false }); 1918 }); 1919} 1920 1921 1922 1923/* 1924 * wp_estate_baths_component_item 1925 * 1926 * This function sets up the behavior for a beds and baths selection component 1927 * in a real estate WordPress theme or plugin. 1928 */ 1929function wpestate_beds_baths_component() { 1930 1931 /** 1932 * Handles the click event on beds or baths items 1933 * @param {string} itemClass - The class of the clicked item 1934 * @param {string} inputClass - The class of the input to update 1935 */
1936 function handleItemClick(itemClass, inputClass) { 1937 var selected_item = jQuery(this); 1938 var parent = selected_item.parent(); 1939 var component = selected_item.closest('.wpestate-beds-baths-popoup-component'); 1940 // Remove selected class from all items and add it to the clicked item 1941 parent.find(itemClass).removeClass('wp_estate_component_item_selected'); 1942 selected_item.addClass('wp_estate_component_item_selected'); 1943 // Update the hidden input value 1944 var selected_value = selected_item.attr('data-value'); 1945 jQuery(inputClass).val(selected_value); 1946 update_label(component); 1947 } 1948 1949 /** 1950 * Updates the label of the component with the selected beds and baths 1951 * @param {jQuery} component - The component to update 1952 */ 1953 function update_label(component){ 1954 var selected_beds = component.find('.wp_estate_beds_component_item.wp_estate_component_item_selected').length > 0 ? component.find('.wp_estate_beds_component_item.wp_estate_component_item_selected').attr('data-value') : '0'; 1955 var selected_baths = component.find('.wp_estate_baths_component_item.wp_estate_component_item_selected').length > 0 ? component.find('.wp_estate_baths_component_item.wp_estate_component_item_selected').attr('data-value') : '0'; 1956 var update_label=parseFloat(selected_beds)+'+ '+control_vars.bd+'/'+parseFloat(selected_baths)+'+ '+control_vars.ba; 1957 component.find('.dropdown-toggle').text(update_label); 1958 } 1959 1960 // Attach event handlers 1961 // Handler for bed selection 1962 jQuery('.wp_estate_beds_component_item').on('click', function(event) { 1963 event.stopPropagation(); 1964 handleItemClick.call(this, '.wp_estate_beds_component_item', '.wpresidence-componentsbeds'); 1965 }); 1966 1967 // Handler for bath selection 1968 jQuery('.wp_estate_baths_component_item').on('click', function(event) { 1969 event.stopPropagation(); 1970 handleItemClick.call(this, '.wp_estate_baths_component_item', '.wpresidence-componentsbaths'); 1971 }); 1972 1973 // Handler for resetting the selection 1974 jQuery('.wpestate-beds-baths-popoup-reset').on('click', function(event) { 1975 event.stopPropagation(); 1976 var parent = jQuery(this).closest('.wpestate-beds-baths-popoup-wrapper'); 1977 // Remove selected class from all items 1978 parent.find('.wp_estate_baths_component_item').removeClass('wp_estate_component_item_selected'); 1979 parent.find('.wp_estate_beds_component_item').removeClass('wp_estate_component_item_selected'); 1980 // Clear input values 1981 parent.find('.wpresidence-componentsbeds, .wpresidence-componentsbaths').val(''); 1982 // Reset the label 1983 var component = jQuery(this).closest('.wpestate-beds-baths-popoup-component'); 1984 var update_value=jQuery(this).attr('data-default-value')+'<span class="caret caret_filter "></span>'; 1985 component.find('.dropdown-toggle').html(update_value); 1986 }); 1987 1988 // Handler for completing the selection 1989 jQuery('.wpestate-beds-baths-popoup-done').on('click', function() { 1990 first_time_wpestate_show_inpage_ajax_half=1; 1991 wpestate_show_pins(); 1992 }); 1993 1994} 1995 1996 1997/* 1998 * wp_estate_price_component_item 1999 * 2000 * This function sets up the behavior for a price range selection component 2001 * in a real estate WordPress theme or plugin. 2002 */ 2003function wpestate_price_component_item(){ 2004 2005 // Prevent click event propagation on the price popup wrapper 2006 jQuery('.wpestate-price-popoup-wrapper').on('click', function(event) { 2007 event.stopPropagation(); 2008 }); 2009 2010 // Clear input value on focus for price range inputs 2011 jQuery('.component_adv_search_elementor_price_low,.component_adv_search_elementor_price_max').on('focus',function(){ 2012 jQuery(this).val(''); 2013 }) 2014 2015 // Ensure only numeric input for price range fields 2016 jQuery('.component_adv_search_elementor_price_low,.component_adv_search_elementor_price_max').on('input', function() { 2017 // Replace non-digit characters with an empty string 2018 jQuery(this).val(jQuery(this).val().replace(/\D/g, '')); 2019 }); 2020 2021 // Update slider when price input changes 2022 jQuery('.component_adv_search_elementor_price_low,.component_adv_search_elementor_price_max').on('change',function(event) { 2023 var inputValue = jQuery(this).val(); 2024 var parent = jQuery(this).closest('.wpestate-price-popoup-wrapper'); 2025 var numericValue = parseFloat(inputValue) 2026 var slider = parent.find('.ui-slider') 2027 2028 // Update slider based on which input changed (low or max) 2029 if( jQuery(this).hasClass('component_adv_search_elementor_price_low') ){ 2030 slider.slider('values', 0, numericValue); 2031 slider.slider("option", "slide").call(slider, null, { values: [numericValue, slider.slider("values")[1]] }); 2032 }else{ 2033 slider.slider('values', 1, numericValue); 2034 slider.slider("option", "slide").call(slider, null, { values: [slider.slider("values")[0], numericValue] }); 2035 } 2036 }); 2037 2038 // Reset price component to default values 2039 jQuery('.wpestate-price-component-popoup-reset').on('click',function(event){ 2040 event.stopPropagation(); 2041 var parent = jQuery(this).closest('.wpestate-price-popoup-wrapper'); 2042 var low_value_label = parent.find('.wpestate-price-popoup-field-low').attr('data-value'); 2043 var max_value_label = parent.find('.wpestate-price-popoup-field-max').attr('data-value'); 2044 2045 // Reset values based on the type of price input present 2046 if(parent.find('.adv_search_elementor_price_low').length>0 ){ 2047 var low_value = parent.find('.adv_search_elementor_price_low').attr('data-value'); 2048 var max_value = parent.find('.adv_search_elementor_price_max').attr('data-value'); 2049 parent.find('.adv_search_elementor_price_low').val(low_value); 2050 parent.find('.adv_search_elementor_price_max').val(max_value); 2051 }else{ 2052 if( parent.find('.adv6_price_low').length > 0 ){ 2053 var low_value = parent.find('.adv6_price_low').attr('data-value'); 2054 var max_value = parent.find('.adv6_price_max').attr('data-value'); 2055 parent.find('.adv6_price_low').val(low_value); 2056 parent.find('.adv6_price_max').val(max_value); 2057 }else{ 2058 var low_value = parent.find('.single_price_low').attr('data-value'); 2059 var max_value = parent.find('.single_price_max').attr('data-value'); 2060 parent.find('.adv6_price_low').val(low_value); 2061 parent.find('.adv6_price_max').val(max_value); 2062 } 2063 } 2064 2065 // Reset dropdown button text 2066 var button_item = parent.parent().find('.dropdown-toggle'); 2067 button_item.html( button_item.attr('data-default-value')+' <sp
2067an class="caret caret_filter "></span>' ) ; 2068 2069 // Reset price range fields 2070 parent.find('.wpestate-price-popoup-field-low').val(low_value_label); 2071 parent.find('.wpestate-price-popoup-field-max').val(max_value_label); 2072 2073 // Reset slider label and values 2074 var slider_label = parent.find('.wpresidence_slider_price').attr('data-default'); 2075 parent.find('.wpresidence_slider_price').text(slider_label); 2076 var slider = parent.find('.ui-slider') 2077 slider.slider('values', 0, parseFloat(low_value)); // sets first handle (e.g., min value) 2078 slider.slider('values', 1, parseFloat(max_value)); 2079 }) 2080 2081 // Handle 'Done' button click 2082 jQuery('.wpestate-price-component-popoup-done').on('click',function(event){ 2083 var parent_wrapper = jQuery('body'); 2084 var fake_click_item = parent_wrapper.parent(); 2085 fake_click_item.trigger('click'); 2086 wpestate_show_pins(); 2087 }) 2088} 2089 2090 2091 2092/* 2093* 2094* format a price 2095* 2096*/ 2097function wpestate_format_a_price(priceValue){ 2098 thousandSeparator = control_vars.price_separator; 2099 decimalPoints = control_vars.decimal_poins; 2100 decimalSeparator = control_vars.decimal_poins_separator; 2101 2102 if (!isNaN(priceValue)) { 2103 priceValue= parseFloat(priceValue); 2104 var formattedPrice = priceValue.toFixed(decimalPoints).replace(/\d(?=(\d{3})+\.)/g, '$&' + thousandSeparator); 2105 formattedPrice = formattedPrice.replace('.', decimalSeparator); 2106 var formattedPriceWithCurrency= wpestate_return_price_with_multi_currency(formattedPrice); 2107 return formattedPriceWithCurrency; 2108 } 2109 2110 2111} 2112 2113 2114/* 2115* 2116* add currency to a price 2117* 2118*/ 2119 2120function wpestate_return_price_with_multi_currency(theValue){ 2121 var return_string=''; 2122 var my_custom_curr_symbol = decodeURI ( wpestate_getCookie('my_custom_curr_symbol') ); 2123 var my_custom_curr_coef = parseFloat( wpestate_getCookie('my_custom_curr_coef')); 2124 var my_custom_curr_pos = parseFloat( wpestate_getCookie('my_custom_curr_pos')); 2125 var my_custom_curr_cur_post= wpestate_getCookie('my_custom_curr_cur_post'); 2126 2127 2128 2129 if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) { 2130 if (my_custom_curr_cur_post === 'before') { 2131 return_string= wpestate_replace_plus( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + theValue; 2132 } else { 2133 return_string=theValue + " " + wpestate_replace_plus( decodeURIComponent ( my_custom_curr_symbol ) ) ; 2134 } 2135 } else { 2136 2137 if (control_vars.where_curency === 'before') { 2138 return_string= wpestate_replace_plus( decodeURIComponent ( control_vars.curency ) ) + " " + theValue; 2139 } else { 2140 return_string=theValue + " " + wpestate_replace_plus( decodeURIComponent ( control_vars.curency ) ) ; 2141 } 2142 } 2143 2144 return return_string; 2145 2146 2147 2148} 2149/* 2150* 2151* wp estate price component_item v3 2152* 2153*/ 2154function wpestate_price_component_item_v3(){ 2155 jQuery('.wpestate-price-popoup-wrapper_v3').on('click', function(event) { 2156 2157 event.stopPropagation(); 2158 jQuery(this).find('.dropdown-menu').hide(); 2159 }); 2160 2161 2162 jQuery('.wpestate_child_dropdown_item').on("click", function(e) { 2163 jQuery(this).parent().find('.dropdown-menu').toggle(); 2164 e.stopPropagation(); 2165 }); 2166 2167 2168 jQuery('.wpestate-price-component-popoup-reset_v3').on('click',function(event){ 2169 event.stopPropagation(); 2170 var parent = jQuery(this).closest('.wpestate-price-popoup-wrapper_v3'); 2171 2172 parent.find('.wpestate-price-component-select').each(function() { 2173 jQuery(this).val(jQuery(this).find('option:first').val()); 2174 }); 2175 2176 var component = parent.closest('.wpestate-beds-baths-popoup-component'); 2177 var update_value=jQuery(this).attr('data-default-value')+'<span class="caret caret_filter"></span>'; 2178 2179 var item_update_value = jQuery(this).attr('data-default-value2')+'<span class="caret caret_filter"></span>'; 2180 component.find('.dropdown-toggle').html(update_value); 2181 component.find('.wpestate_child_dropdown_item').html(item_update_value); 2182 component.find('.wpresidence-component3_input_class').val(''); 2183 component.find('.price_label_component').val(''); 2184 2185 }) 2186 2187 jQuery('.wpestate-price-component-popoup-done_v3').on('click',function(event){ 2188 var parent_wrapper = jQuery('body'); 2189 var fake_click_item= parent_wrapper.parent(); 2190 fake_click_item.trigger('click'); 2191 first_time_wpestate_show_inpage_ajax_half=1; 2192 wpestate_show_pins(); 2193 }) 2194 2195 2196 jQuery('.wpestate-price-popoup-wrapper_v3 li').on("click", function(e){ 2197 2198 var parent = jQuery(this).closest('.wpestate-price-popoup-wrapper_v3'); 2199 var component = parent.closest('.wpestate-beds-baths-popoup-component'); 2200 var parent_ul = jQuery(this).parent(); 2201 var selected_value = jQuery(this).attr('data-value'); 2202 2203 if(parent_ul.hasClass('wpresidence-component3-min-price_class')){ 2204 var selectedmin =selected_value; 2205 var selectedmax = parent.find('.wpresidence-component3-max-price_input_class').val(); 2206 }else{ 2207 var selectedmin = parent.find('.wpresidence-component3-min-price_input_class').val(); 2208 var selectedmax = selected_value 2209 } 2210 2211 2212 var update_value=wpestate_return_price_with_multi_currency(selectedmin)+" - "+wpestate_return_price_with_multi_currency(selectedmax); 2213 component.find('.wpestate-beds-baths-popoup-component-toggle').html(update_value); 2214 component.find('.price_label_component').val(update_value); 2215 parent_ul.hide(); 2216 }); 2217 2218} 2219 2220 2221 2222 2223/* 2224* 2225*wpestate-price-popoup-wrapper_v3 2226*/ 2227function wpestate_reposion_dropdowns(){ 2228 jQuery('.wpestate-multiselect-custom-style').on('click', function() { 2229 2230 var $popupWrapper = jQuery(this);
2231 var $searchWrapper = $popupWrapper.closest('.search_wrapper'); // Get the closest parent with the class '.search_wrapper' 2232 2233 if($searchWrapper.length===0){ 2234 return; 2235 } 2236 2237 var $dropdownMenu = jQuery(this).next('.wpestate-price-popoup-wrapper_v3'); 2238 2239 if($dropdownMenu.length==0){ 2240 var $dropdownMenu = jQuery(this).next('.wpestate-beds-baths-popoup-wrapper'); 2241 } 2242 if($dropdownMenu.length==0){ 2243 var $dropdownMenu = jQuery(this).next('.wpestate-price-popoup-wrapper'); 2244 } 2245 2246 var popupOffset = $popupWrapper.offset(); 2247 var searchOffset = $searchWrapper.offset(); 2248 2249 // Calculate the distances 2250 var distanceToLeft = popupOffset.left - searchOffset.left; 2251 var distanceToRight = (searchOffset.left + $searchWrapper.outerWidth()) - (popupOffset.left + $popupWrapper.outerWidth()); 2252 2253 if (distanceToLeft <= 150) { 2254 // Close to the left edge 2255 $dropdownMenu.css('left', 0); 2256 $dropdownMenu.css('right', 'auto'); 2257 2258 } else if (distanceToRight <= 150) { 2259 // Close to the right edge 2260 $dropdownMenu.css('left', 'auto'); 2261 $dropdownMenu.css('right', 0); 2262 2263 } 2264 2265 2266 2267 2268 }); 2269} 2270 2271 2272/** 2273* Initializes Slick Slider for Estate Place Cards 2274* @param {Object} jQuery - Requires jQuery 2275* @requires slick-carousel 2276* @description Sets up responsive sliders for real estate location/place displays with optional autoplay 2277* Data attributes required: 2278* - data-items-per-row: Number of slides to show 2279* - data-auto: Autoplay speed in ms (0 to disable) 2280* Global required: 2281* - control_vars.is_rtl: RTL language setting ('1' or '0') 2282*/ 2283 2284function wpestate_enable_slick_places() { 2285 jQuery('.estate_places_slider').not('.slick-initialized').each(function() { 2286 let items = jQuery(this).attr('data-items-per-row'), 2287 auto = parseInt(jQuery(this).attr('data-auto')), 2288 isRTL = control_vars.is_rtl === '1'; 2289 2290 const config = { 2291 infinite: true, 2292 slidesToShow: items, 2293 slidesToScroll: 1, 2294 dots: false, 2295 rtl: isRTL, 2296 responsive: [ 2297 { 2298 breakpoint: 1025, 2299 settings: { 2300 slidesToShow: 2, 2301 slidesToScroll: 1 2302 } 2303 }, 2304 { 2305 breakpoint: 525, 2306 settings: { 2307 slidesToShow: 1, 2308 slidesToScroll: 1 2309 } 2310 } 2311 ] 2312 }; 2313 2314 if (auto) { 2315 config.autoplay = true; 2316 config.autoplaySpeed = auto; 2317 } 2318 2319 jQuery(this).slick(config); 2320 }); 2321 } 2322 2323 2324/* 2325* 2326* 2327*/ 2328 2329function wpestate_enble_slick_slider_list(){ 2330 jQuery('.shortcode_slider_list').each(function() { 2331 const $slider = jQuery(this); 2332 const items = $slider.attr('data-items-per-row'); 2333 const auto = parseInt($slider.attr('data-auto')); 2334 const isRTL = control_vars.is_rtl === '1'; 2335 2336 const slickConfig = { 2337 infinite: true, 2338 slidesToShow: items, 2339 slidesToScroll: 1, 2340 dots: true, 2341 rtl: isRTL, 2342 autoplay: auto !== 0, 2343 autoplaySpeed: auto, 2344 responsive: [ 2345 { 2346 breakpoint: 1025, 2347 settings: { 2348 slidesToShow: 2, 2349 slidesToScroll: 1 2350 } 2351 }, 2352 { 2353 breakpoint: 550, 2354 settings: { 2355 slidesToShow: 1, 2356 slidesToScroll: 1 2357 } 2358 } 2359 ] 2360 }; 2361 2362 // Initialize slick with settings 2363 $slider.not('.slick-initialized').slick(slickConfig); 2364 }); 2365} 2366 2367/** 2368 * Initialize and configure Slick slider for theme and property image sliders 2369 * Handles both RTL and LTR layouts with responsive design and mobile optimization 2370 * 2371 * @param {number|string} items_received - Number of slides to show on desktop view (defaults to 3 if invalid) 2372 * 2373 * Configuration: 2374 * - Supports auto-play and manual navigation modes 2375 * - Responsive breakpoints at 1025px (2 slides) and 576px (1 slide) 2376 * - RTL support with mobile positioning fixes 2377 * - Custom navigation arrows with Bootstrap carousel styling 2378 * - Adaptive height on mobile devices 2379 * 2380 * HTML Requirements: 2381 * - Target elements: .theme_slider_2 or .property_multi_image_slider 2382 * - data-auto attribute for autoplay speed (0 for manual navigation) 2383 * 2384 * Dependencies: 2385 * - jQuery 2386 * - Slick Slider 2387 * - control_vars.is_rtl global variable ('1' for RTL, '0' for LTR) 2388 * 2389 * @return {void} 2390 */ 2391function wpestate_enable_slick_theme_slider(items_received) { 2392 var items = 3; 2393 if (parseInt(items_received) !== '') { 2394 items = parseInt(items_received); 2395 } 2396 2397 jQuery('.theme_slider_2,.property_multi_image_slider').each(function() {
2398 var auto = parseInt(jQuery(this).attr('data-auto')); 2399 var isRTL = control_vars.is_rtl === '1'; 2400 2401 // Common settings for both auto and non-auto 2402 var commonSettings = { 2403 infinite: true, 2404 slidesToShow: items, 2405 slidesToScroll: 1, 2406 dots: auto === 0 ? false : true, 2407 rtl: isRTL, 2408 prevArrow: '<button class="carousel-control-prev wpresidence-carousel-control" type="button" data-bs-target="#wpresidence-blog-post-carousel-bootstrap" data-bs-slide="prev"><i class="demo-icon icon-left-open-big"></i><span class="visually-hidden">Previous</span></button>', 2409 nextArrow: '<button class="carousel-control-next wpresidence-carousel-control" type="button" data-bs-target="#wpresidence-blog-post-carousel-bootstrap" data-bs-slide="next"><i class="demo-icon icon-right-open-big"></i><span class="visually-hidden">Next</span></button>', 2410 responsive: [ 2411 { 2412 breakpoint: 1025, 2413 settings: { 2414 slidesToShow: 2, 2415 slidesToScroll: 1 2416 } 2417 }, 2418 { 2419 breakpoint: 576, 2420 settings: { 2421 slidesToShow: 1, 2422 slidesToScroll: 1, 2423 adaptiveHeight: true 2424 } 2425 } 2426 ], 2427 init: function(slick) { 2428 if (isRTL) { 2429 // Fix for initial RTL positioning 2430 setTimeout(function() { 2431 var $track = jQuery(slick.$slideTrack); 2432 var width = $track.width(); 2433 var slideWidth = jQuery(window).width(); 2434 2435 if (window.innerWidth <= 576) { 2436 $track.css({ 2437 'transform': 'translate3d(0, 0, 0)', 2438 'width': 'auto' 2439 }); 2440 } 2441 }, 100); 2442 } 2443 } 2444 }; 2445 2446 // Add auto-specific settings 2447 if (auto !== 0) { 2448 commonSettings.autoplay = true; 2449 commonSettings.autoplaySpeed = auto; 2450 } 2451 2452 // Initialize slick if not already initialized 2453 if (!jQuery(this).hasClass('slick-initialized')) { 2454 jQuery(this).slick(commonSettings); 2455 } 2456 2457 // Handle window resize 2458 jQuery(window).on('resize', function() { 2459 if (isRTL && window.innerWidth <= 576) { 2460 jQuery('.slick-track').css({ 2461 'transform': 'translate3d(0, 0, 0)', 2462 'width': 'auto' 2463 }); 2464 } 2465 }); 2466 }); 2467} 2468 2469 2470/* 2471* 2472* 2473*/ 2474function wpestate_enable_slick_testimonial(){ 2475 jQuery('.testimonial-slider-container').each(function(){ 2476 2477 2478 var items = parseInt( jQuery(this).attr('data-visible-items')); 2479 var auto = parseInt( jQuery(this).attr('data-auto') ); 2480 2481 if (auto === 0 ){ 2482 2483 jQuery(this).not('.slick-initialized').slick({ 2484 infinite: true, 2485 slidesToShow: items, 2486 slidesToScroll: 1, 2487 dots: true, 2488 2489 responsive: [ 2490 { 2491 breakpoint:1025, 2492 settings: { 2493 slidesToShow: 1, 2494 slidesToScroll: 1 2495 } 2496 }, 2497 { 2498 breakpoint: 480, 2499 settings: { 2500 slidesToShow: 1, 2501 slidesToScroll: 1 2502 } 2503 } 2504 ] 2505 }); 2506 if(control_vars.is_rtl==='1'){ 2507 jQuery(this).slick('slickSetOption','rtl',true,true); 2508 } 2509 }else{ 2510 2511 jQuery(this).not('.slick-initialized').slick({ 2512 infinite: true, 2513 slidesToShow: items, 2514 slidesToScroll: 1, 2515 dots: true, 2516 autoplay: true, 2517 autoplaySpeed: auto, 2518 2519 responsive: [ 2520 { 2521 breakpoint:1025, 2522 settings: { 2523 slidesToShow: 1, 2524 slidesToScroll: 1 2525 } 2526 }, 2527 { 2528 breakpoint: 480, 2529 settings: { 2530 slidesToShow: 1, 2531 slidesToScroll: 1 2532 } 2533 } 2534 ] 2535 }); 2536 if(control_vars.is_rtl==='1'){ 2537 jQuery(this).slick('slickSetOption','rtl',true,true); 2538 } 2539 } 2540 }); 2541} 2542 2543/* 2544* 2545* 2546*/ 2547function wpestate_grid_list_controls(){ 2548 2549 jQuery('#list_view').unbind('click'); 2550 jQuery('#list_view').on( 'click', function(event) { 2551 jQuery(this).toggleClass('icon_selected'); 2552 jQuery('#listing_ajax_container').addClass('ajax12'); 2553 jQuery('#grid_view').toggleClass('icon_selected'); 2554 2555 2556 jQuery('#listing_ajax_container .listing_wrapper,.wpestate_filter_list_properties_wrapper .listing_wrapper').hide().removeClass('col-md-4').removeClass('col-md-6').removeClass('col-md-3').addClass('col-md-12').fadeIn(400) ; 2557 2558 jQuery('.the_grid_view').fadeOut(10,function() { 2559 jQuery('.the_list_view:not(.half_map_list_view)').fadeIn(300); 2560 }); 2561 2562 // custom unit code 2563 jQuery('#listing_ajax_container .col-md-12.listing_wrapper .property_unit_custom_element.image').each(function(){ 2564 jQuery(this).parent().addClass('wrap_custom_image'); 2565 }); 2566 2567 jQuery('.col-md-12.listing_wrapper .property_unit_custom_element.image').each(function(){ 2568 jQuery(this).parent().addClass('wrap_custom_image'); 2569 }); 2570 2571 wpresidence_list_view_arrange(); 2572 }); 2573 2574 2575 2576 jQuery('#grid_view').unbind('click'); 2577 jQuery('#grid_view').on( 'click', function(event) { 2578 var class_type; 2579 2580 class_type = jQuery('#listing_ajax_container .listing_wrapper').first().attr('data-org'); 2581 if( jQuery('.wpestate_filter_list_properties_wrapper').length >0 ){ 2582 class_type = jQuery('.wpestate_filter_list_properties_wrapper .listing_wrapper').first().attr('data-org'); 2583 } 2584 2585 jQuery(this).toggleClass('icon_selected'); 2586 jQuery('#listing_ajax_container').removeClass('ajax12'); 2587 jQuery('#list_view').toggleClass('icon_selected'); 2588 jQuery('#listing_ajax_container .listing_wrapper,.wpestate_filter_list_properties_wrapper .listing_wrapper ').hide().removeClass('col-lg-12').removeClass('col-md-12').addClass('col-lg-'+class_type).fadeIn(400); 2589 jQuery('#listing_ajax_container .the_list_view,.wpestate_filter_list_properties_wrapper .the_list_view').fadeOut(10,function(){ 2590 jQuery('.the_grid_view').fadeIn(300); 2591 }); 2592 2593 jQuery('#listing_ajax_container .wrap_custom_image').each(function(){ 2594 jQuery(this).removeClass('wrap_custom_image'); 2595 jQuery('.property_listing_custom_design').css('padding-left','0px'); 2596 }); 2597 2598 }); 2599 2600 2601 2602} 2603 2604 2605/* 2606* 2607* 2608*/ 2609function wpresidence_list_view_arrange(){ 2610 var wrap_image = parseInt( jQuery('.wrap_custom_image').width()); 2611 2612 if(wrap_image!=0){ 2613 jQuery('.col-md-12>.property_listing_custom_design').css('padding-left',wrap_image); 2614 } 2615} 2616 2617 2618 2619/** 2620 * Handles the dynamic filtering between city and area dropdowns in property listings. 2621 * When a city is selected, it filters the available areas to show only those belonging 2622 * to the selected city. The function works with multiple instances of city-area filter 2623 * pairs on the same page. 2624 * 2625 * @param {string} selected_city - ID of the city dropdown button (without '#') 2626 * @param {string} selected_area - ID of the area dropdown button (without '#') 2627 * 2628 * HTML Structure Expected: 2629 * <button id="[selected_city]"> 2630 * <ul class="dropdown-menu"> 2631 * <li data-value2="city-value" data-value="city-value">City Name</li> 2632 * </ul> 2633 * <button id="[selected_area]"> 2634 * <ul class="dropdown-menu"> 2635 * <li data-parentcity="city-value" data-value="area-value">Area Name</li> 2636 * </ul> 2637 */ 2638function wpestate_filter_city_area(selected_city, selected_area) { 2639 // Bind click event to city dropdown items 2640 jQuery('#' + selected_city).siblings('.dropdown-menu').find('li').on('click', function(event) { 2641 event.preventDefault(); 2642 2643 // Get the selected city value and convert to lowercase for comparison 2644 var value_city = String(jQuery(this).attr('data-value2')).toLowerCase(); 2645 2646 // Update city button text and data value 2647 var cityText = jQuery(this).text(); 2648 var cityButton = jQuery('#' + selected_city); 2649 cityButton.text(cityText); 2650 cityButton.attr('data-value', value_city); 2651 2652 // Filter area options based on selected city 2653 jQuery('#' + selected_area).siblings('.dropdown-menu').find('li').each(function() { 2654 var is_city = String(jQuery(this).attr('data-parentcity')).toLowerCase(); 2655 is_city = is_city.replace(" ", "-");
2656 var area_value = String(jQuery(this).attr('data-value')).toLowerCase(); 2657 2658 // Show areas matching selected city or all areas if 'all' is selected 2659 if (is_city === value_city || value_city === 'all') { 2660 jQuery(this).show(); 2661 } else { 2662 jQuery(this).hide(); 2663 } 2664 }); 2665 2666 // Reset area dropdown to default state 2667 var areaButton = jQuery('#' + selected_area); 2668 areaButton.text(control_vars.areas); 2669 areaButton.attr('data-value', 'all'); 2670 }); 2671 2672 // Bind click event to area dropdown items 2673 jQuery('#' + selected_area).siblings('.dropdown-menu').find('li').on('click', function(event) { 2674 event.preventDefault(); 2675 2676 // Update area button text and data value when area is selected 2677 var areaText = jQuery(this).text(); 2678 var areaValue = jQuery(this).attr('data-value'); 2679 var areaButton = jQuery('#' + selected_area); 2680 areaButton.text(areaText); 2681 areaButton.attr('data-value', areaValue); 2682 }); 2683} 2684 2685 2686/** 2687 * Handles the dynamic filtering between county and city dropdowns in property listings. 2688 * When a county is selected, it filters the available cities to show only those belonging 2689 * to the selected county. The function works with multiple instances of county-city filter 2690 * pairs on the same page. 2691 * 2692 * @param {string} selected_county - ID of the county dropdown button (without '#') 2693 * @param {string} selected_city - ID of the city dropdown button (without '#') 2694 * 2695 * HTML Structure Expected: 2696 * <button id="[selected_county]"> 2697 * <ul class="dropdown-menu"> 2698 * <li data-value2="county-value" data-value="county-value">County Name</li> 2699 * </ul> 2700 * <button id="[selected_city]"> 2701 * <ul class="dropdown-menu"> 2702 * <li data-parentcounty="county-value" data-value="city-value">City Name</li> 2703 * </ul> 2704 */ 2705function wpestate_filter_county_city(selected_county, selected_city) { 2706 // Bind click event to county dropdown items using correct sibling selector 2707 jQuery('#' + selected_county).siblings('.dropdown-menu').find('li').on('click', function(event) { 2708 event.preventDefault(); 2709 2710 // Get the selected county value and convert to lowercase for comparison 2711 var value_county = String(jQuery(this).attr('data-value2')).toLowerCase(); 2712 2713 // Update county button text and data value 2714 var countyText = jQuery(this).text(); 2715 var countyButton = jQuery('#' + selected_county); 2716 countyButton.text(countyText); 2717 countyButton.attr('data-value', value_county); 2718 2719 // Filter city options based on selected county 2720 jQuery('#' + selected_city).siblings('.dropdown-menu').find('li').each(function() { 2721 var is_county = String(jQuery(this).attr('data-parentcounty')).toLowerCase(); 2722 is_county = is_county.replace(" ", "-"); 2723 var city_value = String(jQuery(this).attr('data-value')).toLowerCase(); 2724 2725 // Show cities matching selected county or all cities if 'all' is selected 2726 if (is_county === value_county || value_county === 'all') { 2727 jQuery(this).show(); 2728 } else { 2729 jQuery(this).hide(); 2730 } 2731 }); 2732 2733 // Reset city dropdown to default state 2734 var cityButton = jQuery('#' + selected_city); 2735 cityButton.text(control_vars.cities); 2736 cityButton.attr('data-value', 'all'); 2737 }); 2738 2739 // Bind click event to city dropdown items 2740 jQuery('#' + selected_city).siblings('.dropdown-menu').find('li').on('click', function(event) { 2741 event.preventDefault(); 2742 2743 // Update city button text and data value when city is selected 2744 var cityText = jQuery(this).text(); 2745 var cityValue = jQuery(this).attr('data-value'); 2746 var cityButton = jQuery('#' + selected_city); 2747 cityButton.text(cityText); 2748 cityButton.attr('data-value', cityValue); 2749 }); 2750} 2751 2752 2753 2754 2755/* 2756* 2757* 2758*/ 2759function wpestate_raisePower(x, y) { 2760 "use strict"; 2761 return Math.pow(x, y); 2762} 2763 2764/* 2765* 2766* 2767*/ 2768function wpestate_adv_search_click(){ 2769 "use strict";
2770 jQuery('.with_search_form_float .adv-search-header-1,.with_search_form_float #adv-search-header-3').on( 'click', function(event) { 2771 if ( jQuery('#search_wrapper').hasClass('float_search_closed') ){ 2772 jQuery('#search_wrapper').removeClass('float_search_closed'); 2773 }else{ 2774 jQuery('#search_wrapper').addClass('float_search_closed'); 2775 } 2776 2777 }); 2778 2779} 2780 2781 2782/* 2783*Contact footer 2784* 2785*/ 2786function wpestate_contact_footer_starter(){ 2787 "use strict"; 2788 jQuery('#btn-cont-submit').on( 'click', function(event) { 2789 2790 var contact_name, contact_email, contact_phone, contact_coment, agent_email, property_id, nonce, ajaxurl; 2791 contact_name = jQuery('#foot_contact_name').val(); 2792 contact_email = jQuery('#foot_contact_email').val(); 2793 contact_phone = jQuery('#foot_contact_phone').val(); 2794 contact_coment = jQuery('#foot_contact_content').val(); 2795 nonce = jQuery('#agent_property_ajax_nonce').val(); 2796 ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php'; 2797 var parent = jQuery(this).parent().parent(); 2798 2799 2800 if(ajaxcalls_vars.use_gdpr==='yes'){ 2801 if (!parent.find('.wpestate_agree_gdpr').is(':checked')) { 2802 jQuery('#footer_alert-agent-contact').empty().append(ajaxcalls_vars.gdpr_terms); 2803 return; 2804 } 2805 } 2806 2807 jQuery('#footer_alert-agent-contact').empty().append(ajaxcalls_vars.sending); 2808 2809 2810 2811 jQuery.ajax({ 2812 type: 'POST', 2813 dataType: 'json', 2814 url: ajaxurl, 2815 data: { 2816 'action' : 'wpestate_ajax_agent_contact_form', 2817 'name' : contact_name, 2818 'email' : contact_email, 2819 'phone' : contact_phone, 2820 'comment' : contact_coment, 2821 'is_footer' : 'yes', 2822 'nonce' : nonce 2823 }, 2824 success: function (data) { 2825 2826 if (data.sent) { 2827 jQuery('#foot_contact_name').val(''); 2828 jQuery('#foot_contact_email').val(''); 2829 jQuery('#foot_contact_phone').val(''); 2830 jQuery('#foot_contact_content').val(''); 2831 jQuery('#footer_alert-agent-contact').empty().addClass('wpestate-agent-contact-sent').append(data.response); 2832 }else{ 2833 jQuery('#footer_alert-agent-contact').empty().removeClass('wpestate-agent-contact-sent').append(data.response); 2834 } 2835 2836 2837 }, 2838 error: function (errorThrown) { 2839 2840 } 2841 }); 2842 2843 2844 jQuery.ajax({ 2845 type: 'POST', 2846 dataType: 'json', 2847 url: ajaxurl, 2848 data: { 2849 'action' : 'wpestate_ajax_agent_contact_form_forcrm', 2850 'name' : contact_name, 2851 'email' : contact_email, 2852 'phone' : contact_phone, 2853 'comment' : contact_coment, 2854 'nonce' : nonce 2855 }, 2856 success: function (data) { 2857 2858 2859 }, 2860 error: function (errorThrown) { 2861 2862 } 2863 }); 2864 2865 2866 }); 2867} 2868 2869 2870/* 2871* 2872* 2873*/ 2874function estate_splash_slider(){ 2875 if(jQuery("#splash_slider_wrapper").length>0){ 2876 2877 } 2878} 2879 2880 2881/* 2882* 2883* 2884*/ 2885function wpestat_resize_wpestate_property_slider_v2(){ 2886 if(control_vars.is_rtl==='1'){ 2887 2888 } 2889 var width = 1090; 2890 var window = jQuery( document ).width(); 2891 2892 var toadd=width+(window-width)/2; 2893 2894 if(toadd>1090){ 2895 jQuery('.property_slider_carousel_elementor_v2').css('width',toadd+'px'); 2896 }else{ 2897 jQuery('.property_slider_carousel_elementor_v2').css('width','100%'); 2898 } 2899} 2900 2901 2902/* 2903* 2904* 2905*/ 2906function wpestate_hotspots_click(){ 2907 jQuery('.wpestate_hotspot_icon_wrapper').on('click',function(){ 2908 jQuery('.wpestate_hotspot_tooltip').hide(); 2909 jQuery(this).parent().find('.wpestate_hotspot_tooltip').show(); 2910 }); 2911 2912} 2913 2914 2915/* 2916* 2917* 2918*/ 2919function wpestate_hotspots_hover(){ 2920 jQuery(".wpestate_hotspot_icon_wrapper").on('mouseenter', function () { 2921 jQuery(this).parent().find('.wpestate_hotspot_tooltip').show(); 2922 }).on('mouseleave', function () { 2923 jQuery(this).parent().find('.wpestate_hotspot_tooltip').hide(); 2924 }); 2925 2926 2927} 2928 2929/** 2930 * Initialize testimonial slider with RTL support 2931 * @param {string} slider_id - The ID of the slider element 2932 */ 2933function wpestate_testimonial_slider(slider_id){ 2934 2935 let rtl_value = false;
2936 if(control_vars.is_rtl==='1'){ 2937 rtl_value=true; 2938 } 2939 jQuery('#'+slider_id).owlCarousel({ 2940 loop:true, 2941 margin:0, 2942 nav:true, 2943 items:1, 2944 dots:true, 2945 mouseDrag:true, 2946 video:true, 2947 autoHeight: true, 2948 stagePadding:0, 2949 URLhashListener:false, 2950 rtl:rtl_value, 2951 navText: [ 2952 // Swap arrows for RTL 2953 rtl_value ? 2954 '<i class="fas fa-arrow-right"></i>' : 2955 '<i class="fas fa-arrow-left"></i>', 2956 rtl_value ? 2957 '<i class="fas fa-arrow-left"></i>' : 2958 '<i class="fas fa-arrow-right"></i>' 2959 ], 2960 }); 2961 2962} 2963 2964/* 2965* 2966* 2967*/ 2968function wpestate_property_slider_v2(slider_id, items) { 2969 wpestat_resize_wpestate_property_slider_v2(); 2970 2971 // Initialize RTL value checking both data attribute and control_vars 2972 let rtl_value = false; 2973 const $slider = jQuery('#' + slider_id); 2974 2975 // Check both data-rtl and control_vars.is_rtl 2976 if ($slider.attr('data-rtl') === 'yes' || control_vars.is_rtl === '1') { 2977 rtl_value = true; 2978 $slider.addClass('owl-rtl'); 2979 } 2980 2981 const is_loop = true; 2982 2983 $slider.owlCarousel({ 2984 loop: is_loop, 2985 margin: 0, 2986 nav: true, 2987 items: 6, 2988 dots: false, 2989 mouseDrag: true, 2990 video: true, 2991 autoHeight: true, 2992 autoWidth: true, 2993 stagePadding: 0, 2994 URLhashListener: false, 2995 rtl: rtl_value, 2996 navText: [ 2997 // Swap arrows for RTL 2998 rtl_value ? 2999 '<i class="fas fa-arrow-right"></i>' : 3000 '<i class="fas fa-arrow-left"></i>', 3001 rtl_value ? 3002 '<i class="fas fa-arrow-left"></i>' : 3003 '<i class="fas fa-arrow-right"></i>' 3004 ], 3005 onInitialized: function() { 3006 // Force RTL stage direction 3007 if (rtl_value) { 3008 const stage = $slider.find('.owl-stage'); 3009 stage.css('transform-origin', 'center center'); 3010 // Force correct direction on first load 3011 setTimeout(() => { 3012 $slider.trigger('refresh.owl.carousel'); 3013 }, 10); 3014 } 3015 } 3016 }); 3017} 3018 3019 3020/* 3021* 3022* 3023*/ 3024function wpestate_property_slider_v3(slider_id, items) { 3025 // Initialize RTL value checking both data attribute and control_vars 3026 let rtl_value = false; 3027 const $slider = jQuery('#' + slider_id); 3028 3029 // Check both data-rtl and control_vars.is_rtl 3030 if ($slider.attr('data-rtl') === 'yes' || control_vars.is_rtl === '1') { 3031 rtl_value = true; 3032 $slider.addClass('owl-rtl'); 3033 } 3034 3035 $slider.owlCarousel({ 3036 loop: true, 3037 margin: 0, 3038 nav: true, 3039 items: 1, 3040 dots: true, 3041 mouseDrag: true, 3042 video: true, 3043 autoHeight: true, 3044 stagePadding: 0, 3045 URLhashListener: false, 3046 rtl: rtl_value, 3047 navText: [ 3048 // Swap arrows for RTL 3049 rtl_value ? 3050 '<i class="fas fa-arrow-right"></i>' : 3051 '<i class="fas fa-arrow-left"></i>', 3052 rtl_value ? 3053 '<i class="fas fa-arrow-left"></i>' : 3054 '<i class="fas fa-arrow-right"></i>' 3055 ], 3056 onInitialized: function() { 3057 if (rtl_value) { 3058 const stage = $slider.find('.owl-stage'); 3059 stage.css('transform-origin', 'center center'); 3060 // Force correct direction on first load 3061 setTimeout(() => { 3062 $slider.trigger('refresh.owl.carousel'); 3063 }, 10); 3064 } 3065 } 3066 }); 3067} 3068 3069 3070jQuery(window).on('hashchange', function(event) { 3071 event.preventDefault(); 3072 history.pushState("", document.title, window.location.pathname + window.location.search); // Clear the hash 3073}); 3074 3075 3076 3077/** 3078* Initialize and configure the WpResidence property slider carousel 3079* 3080* This function sets up the Owl Carousel for property images with navigation controls, 3081* RTL support, and indicator synchronization. It handles both horizontal and vertical 3082* carousel layouts, updates active indicators, and manages indicator sliding. 3083* 3084* Dependencies: 3085* - jQuery 3086* - Owl Carousel 2 3087* - control_vars.is_rtl global variable 3088* 3089* @since 4.9.0 3090* @requires jQuery 3091* @requires owl.carousel.js 3092* 3093* Event handlers: 3094* - Click on indicator slides to specific image 3095* - Carousel translation updates active indicators 3096* - Manages indicator positioning for overflow 3097* 3098* Related functions: 3099* - wpestate_show_capture_vertical2() 3100* - wpestate_show_capture2() 3101* 3102* Global variables used: 3103* - control_vars.is_rtl 3104* 3105* @return {void} 3106*/ 3107function wpestate_property_slider() { 3108 let is_rtl = false;
3109 if (control_vars.is_rtl === '1') { 3110 is_rtl = true; 3111 } 3112 3113 var owl_slider_property = jQuery("#property_slider_carousel").owlCarousel({ 3114 loop: true, 3115 margin: 0, 3116 nav: true, 3117 items: 1, 3118 dots: false, 3119 mouseDrag: true, 3120 video: true, 3121 autoHeight: true, 3122 rtl: is_rtl, 3123 navText: [ 3124 '<button class="carousel-control-prev wpresidence-carousel-control " type="button" data-slide="prev"><i class="demo-icon icon-left-open-big"></i><span class="visually-hidden">Previous</span></button>', 3125 '<button class="carousel-control-next wpresidence-carousel-control " type="button" data-slide="next"><i class="demo-icon icon-right-open-big"></i><span class="visually-hidden">Previous</span></button>' 3126 ], 3127 URLhashListener: false, 3128 }); 3129 3130 var hash; 3131 var number; 3132 3133 jQuery('li[data-slide-to]').on('click', function(event) { 3134 event.preventDefault(); 3135 var slideTo = parseInt(jQuery(this).data('slide-to')); 3136 owl_slider_property.trigger('to.owl.carousel', [slideTo, 300, true]); 3137 }); 3138 3139 owl_slider_property.on('translated.owl.carousel', function(event) { 3140 number = jQuery(".carousel-inner .owl-item.active .item").attr('data-number'); 3141 3142 // Remove active class from all indicators 3143 jQuery('.carousel-round-indicators a').removeClass('active'); 3144 jQuery('.carousel-indicators a').removeClass('active'); 3145 jQuery('.carousel-indicators-classic li').removeClass('active'); 3146 jQuery('.carousel-indicators-vertical li').removeClass('active'); 3147 jQuery('.carousel-indicators li').removeClass('active'); 3148 3149 // Add active class to current indicator 3150 const activeIndex = parseInt(number) - 1; 3151 3152 if (jQuery(this).hasClass('carouselvertical')) { 3153 // Handle vertical indicators 3154 const $activeIndicator = jQuery('.carousel-indicators-vertical li[data-slide-to="' + activeIndex + '"]').addClass('active'); 3155 const $container = jQuery('.carousel-indicators-vertical'); 3156 3157 if ($activeIndicator.length && $container.length) { 3158 const containerHeight = $container.height(); 3159 const indicatorOffset = $activeIndicator.position()?.top || 0; 3160 const scrollAmount = Math.max(0, indicatorOffset - (containerHeight / 2) + 45); 3161 3162 $container.css('transform', `translateY(-${scrollAmount}px)`); 3163 } 3164 } else { 3165 // Handle horizontal indicators 3166 let $activeIndicator = jQuery('.carousel-indicators li[data-slide-to="' + activeIndex + '"]').addClass('active'); 3167 let $container = jQuery('.wpestate_property_carousel.carouselhorizontal .carousel-indicators'); 3168 3169 if(jQuery('.wpestate_classic_slider_wrapper').length>0){ 3170 $activeIndicator = jQuery('.carousel-indicators li[data-slide-to="' + activeIndex + '"]').addClass('active'); 3171 $container = jQuery('.wpestate_classic_slider_wrapper .carousel-indicators'); 3172 } 3173 3174 3175 if ($activeIndicator.length && $container.length) { 3176 const containerWidth = $container.width(); 3177 const indicatorOffset = $activeIndicator.position()?.left || 0; 3178 const scrollAmount = Math.max(0, indicatorOffset - 100); // 100px buffer from left 3179 $container.css('transform', `translateX(-${scrollAmount}px)`); 3180 } 3181 } 3182 3183 3184 }); 3185} 3186 3187 3188 3189 3190/* 3191* 3192* 3193*/ 3194function wpestate_property_slider_2(){ 3195 var autoplayvalue=false; 3196 var autoplayTimeoutvalue= parseInt( jQuery(".theme_slider_3").attr('data-auto'),10); 3197 3198 if(autoplayTimeoutvalue>0){ 3199 autoplayvalue=true; 3200 } 3201 let is_rtl=false; 3202 if(control_vars.is_rtl==='1'){ 3203 is_rtl=true; 3204 } 3205 3206 var owl = jQuery(".property_slider2_wrapper").owlCarousel({ 3207 loop:true, 3208 margin:0, 3209 nav:true, 3210 items:1, 3211 dots:false, 3212 rtl:is_rtl, 3213 autoplay:autoplayvalue, 3214 autoplayTimeout:autoplayTimeoutvalue, 3215 navText : ["<div class='nextright'>
3215<i class='demo-icon icon-right-open-big'></i></div>","<div class='nextleft'><i class='demo-icon icon-left-open-big'></i></div>"], 3216 URLhashListener:true, 3217 3218 }); 3219 3220 var hash; 3221 owl.on('translated.owl.carousel', function(event) { 3222 3223 hash = jQuery(".property_slider2_wrapper .owl-item.active .item").attr('data-hash'); 3224 3225 jQuery('.property_slider2_wrapper-indicators a').removeClass('active'); 3226 jQuery('a[href="#'+hash+'"]').addClass('active'); 3227 }); 3228 3229 3230} 3231 3232/* 3233* 3234* 3235*/ 3236function wpestate_theme_slider_3(){ 3237 var autoplayvalue=false; 3238 var autoplayTimeoutvalue= parseInt( jQuery(".theme_slider_3").attr('data-auto'),10); 3239 3240 if(autoplayTimeoutvalue>0){ 3241 autoplayvalue=true; 3242 } 3243 let is_rtl=false; 3244 if(control_vars.is_rtl==='1'){ 3245 is_rtl=true; 3246 } 3247 3248 var owl = jQuery(".theme_slider_3").owlCarousel({ 3249 loop:true, 3250 margin:0, 3251 nav:true, 3252 items:1, 3253 dots:false, 3254 rtl:is_rtl, 3255 autoplay:autoplayvalue, 3256 autoplayTimeout:autoplayTimeoutvalue, 3257 navText : [ 3258 '<svg xmlns="http://www.w3.org/2000/svg" width="32.414" height="20.828" viewBox="0 0 32.414 20.828"><g id="Group_30" data-name="Group 30" transform="translate(-1845.086 -1586.086)"><line id="Line_2" data-name="Line 2" x1="30" transform="translate(1846.5 1596.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2"></line><line id="Line_3" data-name="Line 3" x1="9" y2="9" transform="translate(1846.5 1587.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2"></line><line id="Line_4" data-name="Line 4" x1="9" y1="9" transform="translate(1846.5 1596.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2"></line></g></svg>', 3259 '<svg xmlns="http://www.w3.org/2000/svg" width="32.414" height="20.828" viewBox="0 0 32.414 20.828"><g id="Symbol_1_1" data-name="Symbol 1 – 1" transform="translate(-1847.5 -1589.086)"><line id="Line_5" data-name="Line 2" x2="30" transform="translate(1848.5 1599.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2"></line><line id="Line_6" data-name="Line 3" x2="9" y2="9" transform="translate(1869.5 1590.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2"></line><line id="Line_7" data-name="Line 4" y1="9" x2="9" transform="translate(1869.5 1599.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2"></line></g></svg>', 3260 ], 3261 URLhashListener:true, 3262 3263 }); 3264 3265 var hash; 3266 owl.on('translated.owl.carousel', function(event) { 3267 3268 hash = jQuery(".theme_slider_3 .owl-item.active .item").attr('data-hash'); 3269 3270 jQuery('.theme_slider_3_carousel-indicators a').removeClass('active'); 3271 jQuery('a[href="#'+hash+'"]').addClass('active'); 3272 }); 3273 3274 3275} 3276 3277 3278/* 3279* 3280* 3281*/ 3282function estate_sidebar_slider_carousel(){ 3283 "use strict"; 3284 let is_rtl=false; 3285 if(control_vars.is_rtl==='1'){ 3286 is_rtl=true; 3287 } 3288 3289 // Check if owlCarousel is available 3290 if (typeof jQuery.fn.owlCarousel === 'function') { 3291 jQuery(".owl-featured-slider").owlCarousel({ 3292 loop:true, 3293 margin:0, 3294 nav:true, 3295 items:1, 3296 dots:false, 3297 rtl:is_rtl, 3298 navText : [ 3299 '<button class="carousel-control-prev wpresidence-carousel-control " type="button" data-slide="prev"><i class="demo-icon icon-left-open-big"></i><span class="visually-hidden">Previous</span></button>', 3300 '<button class="carousel-control-next wpresidence-carousel-control " type="button" data-slide="next"><i class="demo-icon icon-right-open-big"></i><span class="visually-hidden">Previous</span></button>' 3301 ], 3302 }); 3303 }else { 3304 console.warn("owlCarousel function not found."); 3305 } 3306 3307} 3308 3309 3310 3311/* 3312* 3313* 3314*/ 3315function estate_start_lightbox_modal(){ 3316 "use strict"; 3317 var jump_slide; 3318 3319 var owl = jQuery("#owl-demo-modal"); 3320 owl.trigger("destroy.owl.carousel"); 3321 3322 owl.owlCarousel({ 3323 loop:true, 3324 margin:0, 3325 nav:true, 3326 items:1, 3327 dots:false, 3328 startPosition:1, 3329 navText : [ 3330 '<button class="carousel-control-prev wpresidence-carousel-control " type="button" data-sli
3330de="prev"><i class="demo-icon icon-left-open-big"></i><span class="visually-hidden">Previous</span></button>', 3331 '<button class="carousel-control-next wpresidence-carousel-control " type="button" data-slide="next"><i class="demo-icon icon-right-open-big"></i><span class="visually-hidden">Previous</span></button>' 3332 ], 3333 }); 3334 3335 3336 jQuery('.lightbox_trigger').on( 'click', function(event) { 3337 3338 3339 3340 event.preventDefault(); 3341 jump_slide=parseInt( jQuery(this).attr('data-slider-no') ); 3342 var carousel = jQuery("#owl-demo-modal"); 3343 carousel.owlCarousel(); 3344 carousel.trigger("refresh.owl.carousel"); 3345 3346 carousel.trigger("to.owl.carousel", [jump_slide, 1, true]); 3347 jQuery('.lightbox_property_wrapper').show(); 3348 3349 }); 3350 3351 jQuery('.lighbox-image-close').on( 'click', function(event) { 3352 event.preventDefault(); 3353 jQuery('.lightbox_property_wrapper').hide(); 3354 }); 3355} 3356 3357 3358 3359 3360/** 3361 * WPResidence Blog List Widget AJAX Handler 3362 * 3363 * Handles AJAX loading of additional blog posts for the blog list widget. 3364 * 3365 * @package WPResidence 3366 * @subpackage Widgets 3367 * @since 1.0.0 3368 */ 3369function wpestate_blog_list_widget() { 3370 "use strict"; 3371 3372 var ajaxurl = ajaxcalls_vars.wpestate_ajax; 3373 3374 jQuery('.blog_list_loader').on('click', function (event) { 3375 var $button = jQuery(this); 3376 var $container = $button.parent().parent(); 3377 var $loader = $container.find('.wpestate_listing_sh_loader'); 3378 var $grid = $container.find('.items_shortcode_wrapper_grid'); 3379 3380 var page = parseInt($container.attr('data-page'), 10) + 1; 3381 $container.attr('data-page', page); 3382 3383 $loader.show(); 3384 3385 jQuery.ajax({ 3386 type: 'POST', 3387 dataType: 'json', 3388 url: ajaxurl, 3389 data: { 3390 action: 'wpestate_load_blog_list_widget_wrapper', 3391 control_terms_id: $container.attr('data-category_ids'), 3392 number: $container.attr('data-number'), 3393 page: page, 3394 rownumber: $container.attr('data-row-number'), 3395 card_version: $container.attr('data-card-version'), 3396 sort_by: $container.attr('data-sort-by'), 3397 display_grid: $container.attr('data-display-grid') 3398 }, 3399 success: function (data) { 3400 if (data.success) { 3401 if ($grid.length) { 3402 if (data.results === 0) { 3403 $loader.before(data.html).hide(); 3404 $button.hide(); 3405 } else { 3406 $grid.append(data.html); 3407 } 3408 } else { 3409 $loader.before(data.html).hide(); 3410 if (data.results === 0) { 3411 $button.hide(); 3412 } 3413 } 3414 } else { 3415 $button.hide(); 3416 } 3417 $loader.hide(); 3418 }, 3419 error: function (xhr, status, error) { 3420 console.error('AJAX request failed:', error); 3421 $loader.hide(); 3422 } 3423 }); 3424 }); 3425} 3426 3427/* 3428* 3429* 3430*/ 3431function wpestate_property_list_sh(ajax_loader,ajax_filters){ 3432 "use strict"; 3433 var ajaxurl = ajaxcalls_vars.wpestate_ajax; 3434 jQuery(ajax_loader).click( function(event) { 3435 var container = jQuery(this).parent().parent(); 3436 var type = container.attr('data-type'); 3437 var category_ids = container.attr('data-category_ids'); 3438 var action_ids = container.attr('data-action_ids'); 3439 var city_ids = container.attr('data-city_ids'); 3440 var area_ids = container.attr('data-area_ids'); 3441 var state_ids = container.attr('data-state_ids'); 3442 var status = container.attr('data-status_ids'); 3443 var features = container.attr('data-features_ids'); 3444 var number = container.attr('data-number'); 3445 var align = container.attr('data-align'); 3446 var show_featured_only = container.attr('data-show_featured_only'); 3447 var random_pick = container.attr('data-random_pick'); 3448 var featured_first = container.attr('data-featured_first'); 3449 var page = container.attr('data-page'); 3450 var align = container.attr('data-align'); 3451 var row_number = container.attr('data-row-number');
3452 var card_version = container.attr('data-card-version'); 3453 var sort_by = container.attr('data-sort-by'); 3454 var display_grid = container.attr('data-display-grid'); 3455 var agentid = container.attr('data-agent-id'); 3456 3457 page=parseInt(page); 3458 page=page+1; 3459 container.attr('data-page',page); 3460 container.find('.wpestate_listing_sh_loader').show(); 3461 3462 page=parseInt(page); 3463 var nonce = jQuery('#wpestate_ajax_filtering').val(); 3464 jQuery.ajax({ 3465 type: 'POST', 3466 dataType: 'json', 3467 url: ajaxurl, 3468 data: { 3469 'action' : 'wpestate_load_recent_items_sh', 3470 'type' : type, 3471 'category_ids' : category_ids, 3472 'action_ids' : action_ids, 3473 'city_ids' : city_ids, 3474 'area_ids' : area_ids, 3475 'state_ids' : state_ids, 3476 'status' : status, 3477 'features' : features, 3478 'number' : number, 3479 'align' : align, 3480 'show_featured_only' : show_featured_only, 3481 'random_pick' : random_pick, 3482 'featured_first' : featured_first, 3483 'page' : page, 3484 'row_number' : row_number, 3485 'card_version' : card_version, 3486 'sort_by' : sort_by, 3487 'display_grid' : display_grid, 3488 'agentid' : agentid, 3489 'security' : nonce 3490 }, 3491 3492 3493 success: function (data) { 3494 3495 3496 if(data.success==true && data.html!==''){ 3497 3498 3499 container.find('.wpestate_listing_sh_loader').hide(); 3500 3501 3502 3503 if(data.no_results===true){ 3504 container.find('.wpresidence_button').after(data.html).hide(); 3505 }else{ 3506 if(container.find('.items_shortcode_wrapper_grid').length > 0){ 3507 container.find('.items_shortcode_wrapper_grid').append(data.html); 3508 } 3509 3510 if(container.find('.items_shortcode_wrapper').length > 0){ 3511 container.find ('.items_shortcode_wrapper').append(data.html); 3512 } 3513 3514 } 3515 3516 3517 3518 3519 3520 3521 3522 wpestate_restart_js_after_ajax(); 3523 jQuery('.col-md-12.listing_wrapper .property_unit_custom_element.image').each(function(){ 3524 jQuery(this).parent().addClass('wrap_custom_image'); 3525 }); 3526 var wrap_image = parseInt( jQuery('.wrap_custom_image').width()); 3527 3528 if(wrap_image!=0){ 3529 jQuery('.col-md-12>.property_listing_custom_design').css('padding-left',wrap_image); 3530 } 3531 3532 3533 }else{ 3534 container.find('.wpestate_listing_sh_loader').hide(); 3535 jQuery(ajax_loader).hide(); 3536 } 3537 3538 3539 }, 3540 error: function (errorThrown) { 3541 3542 } 3543 });//end ajax 3544 3545 3546 }); 3547 3548 3549 jQuery(ajax_filters).on( 'click', function(event) { 3550 3551 var container = jQuery(this).parent().parent(); 3552 var taxid = jQuery(this).attr('data-taxid'); 3553 var taxonomy = jQuery(this).attr('data-taxonomy'); 3554 3555 jQuery(this).parent().parent().find('.wpestate_item_list_sh').show(); 3556 3557 switch(taxonomy) { 3558 case 'property_category': 3559 3560 var category_ids = container.attr('data-category_ids'); 3561 category_ids = wpestate_replace_tax_id(jQuery(this),category_ids,taxid); 3562 container.attr('data-category_ids',category_ids); 3563 3564 break; 3565 case 'property_action_category': 3566 3567 var action_ids = container.attr('data-action_ids'); 3568 action_ids = wpestate_replace_tax_id(jQuery(this),action_ids,taxid); 3569 container.attr('data-action_ids',action_ids); 3570 3571 break; 3572 case 'property_city': 3573 3574 var city_ids = container.attr('data-city_ids'); 3575 city_ids = wpestate_replace_tax_id(jQuery(this),city_ids,taxid); 3576 container.attr('data-city_ids',city_ids); 3577 3578 break; 3579 case 'property_area': 3580 3581 var area_ids = container.attr('data-area_ids'); 3582 area_ids = wpestate_replace_tax_id(jQuery(this),area_ids,taxid); 3583 container.attr('data-area_ids',area_ids); 3584 3585 break; 3586 case 'property_county_state': 3587 3588 3589 var state_ids = container.attr('data-state_ids'); 3590 state_ids = wpestate_replace_tax_id(jQuery(this),state_ids,taxid); 3591 container.attr('data-state_ids',state_ids); 3592 3593 break; 3594 3595 case 'property_status': 3596 var status_ids = container.attr('data-status_ids'); 3597 status_ids = wpestate_replace_tax_id(jQuery(this),status_ids,taxid); 3598 3599 container.attr('data-status_ids',status_ids); 3600 3601 break; 3602 case 'property_features': 3603 var status_ids = container.attr('data-features_ids'); 3604 status_ids = wpestate_replace_tax_id(jQuery(this),status_ids,taxid); 3605 3606 container.attr('data-features_ids',status_ids); 3607 3608 break; 3609 3610 3611 } 3612 container.attr('data-page',0); 3613 jQuery(this).toggleClass('tax_active'); 3614container.find('.items_shortcode_wrapper_grid').empty(); 3615 container.find('.listing_wrapper').remove(); 3616 container.find('.wpestate_item_list_sh').trigger('click'); 3617 3618 }); 3619 3620 3621 function wpestate_replace_tax_id(acesta,tax_ids,taxid){ 3622 3623 3624 if(!acesta.hasClass('tax_active')){ 3625 if ( tax_ids.indexOf(taxid) >= 0){ 3626 return taxid+","; 3627 }else{ 3628 tax_ids=tax_ids+taxid+","; 3629 } 3630 }else{ 3631 var to_replace=taxid+","; 3632 tax_ids=tax_ids.replace(to_replace , ""); 3633 } 3634 return tax_ids; 3635 3636 } 3637 3638} 3639 3640 3641/** 3642 * WpEstate Open Menu Function 3643 * 3644 * This function sets up event listeners for the header phone and user menu elements. 3645 * It handles the toggling of the user menu and shopping cart visibility. 3646 * 3647 * @since 1.0.0 3648 * 3649 * @requires jQuery 3650 * 3651 * @return {void} 3652 * 3653 * @example 3654 * // Call this function after the DOM is ready 3655 * jQuery(document).ready(function($) { 3656 * wpestate_open_menu(); 3657 * }); 3658 */ 3659function wpestate_open_menu() { 3660 "use strict"; 3661 3662 // Prevent click event propagation on header phone 3663 jQuery('.header_phone').on('click', function(event) { 3664 event.stopPropagation(); 3665 }); 3666 3667 // Handle click event on logged-in user menu 3668 jQuery('#user_menu_u.user_loged').on('click', function(event) { 3669 // Hide shopping cart 3670 jQuery('#wpestate_header_shoping_cart').fadeOut(400); 3671 3672 // Toggle user menu visibility 3673 if (jQuery('#user_menu_open').is(":visible")) { 3674 // If menu is visible, hide it and remove 'opensvg' class 3675 jQuery('#user_menu_open').removeClass('iosfixed').fadeOut(400); 3676 jQuery('.navicon-button').removeClass('opensvg'); 3677 } else { 3678 // If menu is hidden, show it and add 'opensvg' class 3679 jQuery('#user_menu_open').fadeIn(400); 3680 jQuery('.navicon-button').addClass('opensvg'); 3681 } 3682 3683 // Prevent event from bubbling up to parent elements 3684 event.stopPropagation(); 3685 }); 3686} 3687 3688/** 3689 * Check if the current device is mobile or tablet 3690 * 3691 * This function uses Bootstrap 5.3's breakpoint checking to determine 3692 * if the current device is considered mobile or tablet. 3693 * 3694 * @returns {boolean} True if the device is mobile or tablet, false otherwise 3695 */ 3696function wpestate_isMobileOrTablet() { 3697 // Check if the window width is less than the 'xl' breakpoint 3698 return window.innerWidth < 1200; // Bootstrap's 'xl' breakpoint is 1200px 3699} 3700 3701 3702/* 3703* 3704* 3705*/ 3706function wpestate_contact_us_shortcode(){ 3707 "use strict"; 3708 jQuery('#btn-cont-submit_sh').on( 'click', function(event) {
3709 var parent,contact_name, contact_email, contact_phone, contact_coment, agent_email, property_id, nonce, ajaxurl; 3710 contact_name = jQuery('#foot_contact_name_sh').val(); 3711 contact_email = jQuery('#foot_contact_email_sh').val(); 3712 contact_phone = jQuery('#foot_contact_phone_sh').val(); 3713 contact_coment = jQuery('#foot_contact_content_sh').val(); 3714 nonce = jQuery('#agent_property_ajax_nonce').val(); 3715 ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php'; 3716 parent = jQuery(this).parent().parent(); 3717 3718 if(ajaxcalls_vars.use_gdpr==='yes'){ 3719 if (!parent.find('.wpestate_agree_gdpr').is(':checked')) { 3720 jQuery('#footer_alert-agent-contact_sh').empty().removeClass('wpestate-agent-contact-sent').append(ajaxcalls_vars.gdpr_terms); 3721 return; 3722 } 3723 } 3724 3725 jQuery('#footer_alert-agent-contact_sh').empty().append(ajaxcalls_vars.sending); 3726 3727 jQuery.ajax({ 3728 type: 'POST', 3729 dataType: 'json', 3730 url: ajaxurl, 3731 data: { 3732 'action' : 'wpestate_ajax_agent_contact_form', 3733 'name' : contact_name, 3734 'email' : contact_email, 3735 'phone' : contact_phone, 3736 'comment' : contact_coment, 3737 'nonce' : nonce 3738 }, 3739 success: function (data) { 3740 3741 if (data.sent) { 3742 jQuery('#foot_contact_name_sh').val(''); 3743 jQuery('#foot_contact_email_sh').val(''); 3744 jQuery('#foot_contact_phone_sh').val(''); 3745 jQuery('#foot_contact_content_sh').val(''); 3746 jQuery('#footer_alert-agent-contact_sh').empty().addClass('wpestate-agent-contact-sent').append(data.response); 3747 }else{ 3748 jQuery('#footer_alert-agent-contact_sh').empty().removeClass('wpestate-agent-contact-sent').append(data.response); 3749 } 3750 3751 }, 3752 error: function (errorThrown) { 3753 3754 } 3755 }); 3756 }); 3757 3758} 3759 3760 3761 3762 3763 3764 3765 3766/* 3767* 3768* 3769*/ 3770function wpestate_enable_property_modal(listing_id,main_img_url,main_title,link){ 3771 "use strict"; 3772 3773 if (Modernizr.mq('only all and (max-width: 1024px)')) { 3774 return; 3775 } 3776 3777 3778 3779 jQuery('.website-wrapper').css('position','fixed'); 3780 jQuery('#property_modal_images').empty(); 3781 var ajaxurl = ajaxcalls_vars.wpestate_ajax; 3782 var window_height =jQuery( window ).height(); 3783 3784 jQuery("#property_modal_images") .css('height', window_height+'px'); 3785 window_height=window_height-183; 3786 jQuery("#property_modal_content").css('height', window_height+'px'); 3787 3788 jQuery('#modal_property_agent').empty(); 3789 jQuery('.modal_content_block').empty(); 3790 jQuery('#property_modal_content .modal_property_description').empty(); 3791 jQuery('#property_modal_content .modal_property_adress').empty(); 3792 jQuery('#property_modal_content .modal_property_details').empty(); 3793 jQuery('#property_modal_content .modal_property_features').empty(); 3794 jQuery('#property_modal_content .modal_property_video').empty(); 3795 jQuery('#property_modal_content .modal_property_video_tour').empty(); 3796 jQuery('#property_modal_content .modal_property_walkscore').empty(); 3797 jQuery('#property_modal_content .modal_property_floor_plans').empty(); 3798 jQuery('#modal_property_mortgage').empty(); 3799 jQuery('#modal_property_maps').empty(); 3800 jQuery('#property_details_modal_wrapper').show(); 3801 3802 //prepopoluate 3803 var to_apped ='<img src="'+main_img_url+'" data-slider-no="1" class="img-responsive lightbox_trigger" alt="image">'; 3804 3805 jQuery('#property_modal_images').append(to_apped); 3806 jQuery('#property_modal_header .modal_property_title').html(main_title); 3807 jQuery('#owl-demo-modal').empty(); 3808 3809 3810 wpestate_propery_preview_prepopulate(); 3811 3812 3813 jQuery.ajax({ 3814 type: 'POST', 3815 url: ajaxurl, 3816 dataType: 'json', 3817 data: { 3818 'action' : 'wpestate_property_modal_listing_details', 3819 'postid' : listing_id, 3820 3821 // 'security' : nonce, 3822 }, 3823 success: function (data) { 3824 3825 if(data.response===true){ 3826 3827
3828 data.images.forEach(wpestate_populate_modal_images); 3829 jQuery('.property_placeholder').remove(); 3830 data.full_images.forEach(wpestate_populate_modal_images_full); 3831 wpestate_populate_content(data); 3832 3833 } 3834 }, 3835 error: function (errorThrown) { 3836 3837 } 3838 });//end ajax 3839 3840 /// 3841 /// aysn request no 2 3842 //////////////////////////////////////////////////////////////////////////// 3843 jQuery.ajax({ 3844 type: 'POST', 3845 url: ajaxurl, 3846 dataType: 'json', 3847 data: { 3848 'action' : 'wpestate_property_modal_listing_details_second', 3849 'postid' : listing_id, 3850 3851 // 'security' : nonce, 3852 }, 3853 success: function (data) { 3854 3855 if(data.response===true){ 3856 3857 jQuery('#property_modal_content .modal_property_yelp').empty().append(data.yelp); 3858 // jQuery('#property_modal_content .modal_property_walkscore').empty().append(data.walkscore); 3859 jQuery('#property_modal_content .modal_property_floor_plans').empty().append(data.floor_plans); 3860 jQuery('#modal_property_mortgage').empty().append(data.mortgage); 3861 jQuery('#modal_property_maps').empty().append(data.map); 3862 3863 3864 //floor plans 3865 wpestate_enable_floor_plans(); 3866 estate_start_lightbox_floorplans(); 3867 3868 //mortgage 3869 wpestate_show_morg_pie(); 3870 3871 // map 3872 3873 wpestate_map_shortcode_function(); 3874 3875 } 3876 }, 3877 error: function (errorThrown) { 3878 3879 } 3880 });//end ajax 3881} 3882 3883 3884/* 3885* 3886* 3887*/ 3888 3889function wpestate_populate_content(data){ 3890 jQuery('#property_modal_top_bar').empty(); 3891 jQuery('#property_modal_top_bar').append(data.favorite); 3892 jQuery('#property_modal_top_bar').append(data.share); 3893 3894 3895 jQuery('#property_modal_header .modal_property_title').html('<a href="'+data.link+'" target="_blank">'+data.title+'</a>'); 3896 jQuery('#property_modal_header .modal_property_price').html(data.price); 3897 jQuery('#property_modal_header .modal_property_bed').html(data.beds_section); 3898 jQuery('#property_modal_header .modal_property_addr').html(data.addr_section); 3899 3900 3901 jQuery('#modal_property_agent').empty().append(data.agent_section); 3902 jQuery('#property_modal_content .modal_property_description').empty().append(data.content); 3903 jQuery('#property_modal_content .modal_property_adress').empty().append(data.address); 3904 jQuery('#property_modal_content .modal_property_details').empty().append(data.details); 3905 jQuery('#property_modal_content .modal_property_features').empty().append(data.features); 3906 jQuery('#property_modal_content .modal_property_video').empty().append(data.video); 3907 jQuery('#property_modal_content .modal_property_video_tour').empty().append(data.video_tour); 3908 3909 //contact
3910 wpestate_agent_contact_modals(); 3911 //img 3912 estate_start_lightbox_modal(); 3913 3914 // video 3915 if (jQuery(".venobox").length > 0){ 3916 jQuery('.venobox').venobox(); 3917 } 3918 3919 //favorite 3920 wpestate_add_to_favorites(); 3921 3922 //print 3923 wpestate_print_property_page(); 3924 3925} 3926 3927/* 3928* 3929* 3930*/ 3931function wpestate_populate_modal_images(value,index){ 3932 3933 if( jQuery('.property_placeholder').length>0 ){ 3934 var placeholder= jQuery('.property_placeholder:first'); 3935 placeholder.attr('src',value).removeClass('property_placeholder'); 3936 }else{ 3937 var to_apped='<img src="'+value+'" data-slider-no="'+index+'" class="img-responsive lightbox_trigger" alt="image">'; 3938 3939 jQuery('#property_modal_images').append(to_apped); 3940 } 3941 3942 3943} 3944 3945/* 3946* 3947* 3948*/ 3949function wpestate_populate_modal_images_full(value,index){ 3950 // var to_append2='<div class="item"><img src="'+value+'"></div>'; 3951 var to_append2='<div class="owl_holder" style="background-image:url('+value+')"></div>'; 3952 jQuery('#owl-demo-modal').append(to_append2); 3953} 3954 3955 3956/* 3957* 3958* 3959*/ 3960function wpestate_propery_preview_prepopulate(){ 3961 3962 path_image=control_vars.path+'/img/placeholder1.png'; 3963 for (i = 0; i <14; i++) { 3964 var to_apped='<img src="'+path_image+'" class="img-responsive lightbox_trigger property_placeholder" data-slider-no="'+(i+1)+'" alt="image">'; 3965 jQuery('#property_modal_images').append(to_apped); 3966 } 3967} 3968 3969/* 3970* 3971* 3972*/ 3973
3974function wpestate_agent_contact_modals(){ 3975 wpestate_agent_submit_email(); 3976 3977 wpestate_enable_schedule_contact(); 3978 3979 jQuery( "#modal_contact_agent").unbind( "click" ); 3980 jQuery('#modal_contact_agent').on('click',function(event){ 3981 jQuery('.schedule_wrapper').hide(); 3982 jQuery('#property_modal_content .agent_contanct_form').slideDown(); 3983 3984 jQuery('#property_modal_content').animate({ 3985 scrollTop: 0 3986 }, 3987 "slow" 3988 ); 3989 }); 3990 3991 3992 3993} 3994 3995/* 3996* 3997* 3998*/ 3999 4000function wpestate_get_location(){ 4001 4002 if(control_vars.location_animation==='no'){ 4003 return; 4004 } 4005 if( jQuery('.heading_over_image').length===0){ 4006 return; 4007 } 4008 4009 jQuery.get("https://ipapi.co/json", function(place) { 4010 var city = place.city; 4011 4012 if(city == null || parseInt( jQuery('.home').length)===0 ){ 4013 //do nothing 4014 }else{ 4015 var heading = control_vars.location_animation_text; 4016 4017 heading = heading.replace("%city%", city); 4018 4019 jQuery('.home .heading_over_image,.home .heading_over_video').slideUp("300",function(){ 4020 jQuery('.home .heading_over_image,.home .heading_over_video').text(heading); 4021 jQuery('.home .heading_over_image,.home .heading_over_video').slideDown(); 4022 }); 4023 4024 } 4025 }, "json"); 4026} 4027 4028/** 4029 * WpEstate Sliding Box Interaction 4030 * 4031 * This function sets up the interactive behavior for the sliding box elements 4032 * in the WpResidence theme. It handles the mouseover event to activate and 4033 * deactivate sliding boxes. 4034 * 4035 * @since 1.0.0 4036 * 4037 * @requires jQuery 4038 */ 4039function wpestate_slider_box() { 4040 4041 // Attach a mouseover event handler to all elements with class 'wpestate_sliding_box' 4042 jQuery(".wpestate_sliding_box").mouseover(function() { 4043 // 'this' refers to the current element being hovered over 4044 var selected_item = jQuery(this); 4045 4046 // Find the parent container of the current sliding box 4047 var item_parent = selected_item.parent(); 4048 4049 // Remove 'active-element' class from all sliding boxes within the same parent 4050 item_parent.find('.wpestate_sliding_box').removeClass('active-element'); 4051 4052 // Add 'active-element' class to the currently hovered sliding box 4053 selected_item.addClass('active-element'); 4054 }); 4055} 4056 4057 4058 4059/* 4060*Mobile Menu Slide out 4061* 4062*/ 4063function wpestate_mobile_menu_slideout(){ 4064 var vc_size; 4065 var var_parents=new Array(); 4066 var var_parents_back=new Array(); 4067 4068 4069 4070 4071 if(jQuery('.mobile-trigger-user').length>0){ 4072 var slideout_user_menu = new Slideout({ 4073 'panel': document.getElementById('all_wrapper'), 4074 'menu': document.getElementById('mobilewrapperuser'), 4075 'padding': -256, 4076 'tolerance': 70 4077 }); 4078 4079 slideout_user_menu.disableTouch(); 4080 4081 // Toggle button 4082 document.querySelector('.mobile-trigger-user').addEventListener('click', function() { 4083 slideout_user_menu.toggle(); 4084 // jQuery('#mobilewrapperuser').show(); 4085 if(jQuery('#mobilewrapperuser').is(':visible') ){ 4086 jQuery('#mobilewrapperuser').hide(); 4087 }else{ 4088 jQuery('#mobilewrapperuser').show(); 4089 } 4090 4091 }); 4092 4093 jQuery('.mobilemenu-close-user').on( 'click', function(event) { 4094 slideout_user_menu.toggle(); 4095 setTimeout(function() { 4096 jQuery('#mobilewrapperuser').hide(); 4097 }, 200); 4098 4099 }); 4100 4101 } 4102 4103 4104 4105 4106 if(jQuery('.mobile-trigger').length>0){ 4107 4108 var slideout_link_menu = new Slideout({ 4109 'panel': document.getElementById('all_wrapper'), 4110 'menu': document.getElementById('mobilewrapper_links'), 4111 'padding': 256, 4112 'tolerance': 70, 4113 'side': 'left', 4114 'easing': 'cubic-bezier(.32,2,.55,.27)' 4115 }); 4116 slideout_link_menu.disableTouch(); 4117 document.querySelector('.mobile-trigger').addEventListener('click', function() {
4118 slideout_link_menu.toggle(); 4119 4120 if(jQuery('#mobilewrapper_links').is(':visible') ){ 4121 jQuery('#mobilewrapper_links').hide(); 4122 }else{ 4123 jQuery('#mobilewrapper_links').show(); 4124 } 4125 }); 4126 4127 jQuery('.mobilemenu-close').on( 'click', function(event) { 4128 slideout_link_menu.toggle(); 4129 setTimeout(function() { 4130 jQuery('#mobilewrapper_links').hide(); 4131 }, 200); 4132 }); 4133 } 4134 4135} 4136 4137/* 4138* Mobile Menu open submenu 4139*/ 4140 4141function wpestate_mobile_menu_open_submenu(){ 4142 jQuery('.mobilex-menu li').on( 'click', function(event) { 4143 event.stopPropagation(); 4144 var selected; 4145 selected = jQuery(this).find('.sub-menu:first'); 4146 selected.slideToggle(); 4147 }); 4148 4149} 4150 4151 4152 4153/* 4154* Mobile Menu Elementor open/close 4155*/ 4156 4157function wpestate_elementor_mobile_menu_trigger_open(){ 4158 jQuery('.wpestate_mobile_menu_trigger').on('click', function(event) { 4159 jQuery(this).hide(); 4160 const parent = jQuery(this).parent(); 4161 const openButton=parent.find('.wpestate_mobile_menu_trigger_close'); 4162 var menu = parent.find('.mobilex-menu'); 4163 4164 4165 jQuery('.wpestate_mobile_menu_trigger_close').show(); 4166 // Show the menu first to measure it correctly 4167 menu.css('display', 'block'); 4168 4169 var containerRect = openButton[0].getBoundingClientRect(); 4170 4171 var margin = 0; // Margin from the viewport edges 4172 4173 // Calculate the left position of the child 4174 var childLeft = -containerRect.left +margin; 4175 4176 // Apply the calculated positions 4177 // menu.css('left', childLeft + 'px'); 4178 menu.css('width', 'calc(100vw - ' + (margin * 2) + 'px)'); 4179 4180 4181 }); 4182 4183 jQuery('.wpestate_mobile_menu_trigger_close').on('click',function(event){ 4184 jQuery(this).hide(); 4185 const parent=jQuery(this).parent(); 4186 var menu = parent.find('.mobilex-menu'); 4187 menu.css('transform', ''); 4188 jQuery('.wpestate_mobile_menu_trigger').show(); 4189 parent.find('.mobilex-menu').hide(); 4190 }); 4191 4192} 4193 4194 4195/* 4196* Control media buttons 4197*/ 4198 4199function wpestate_control_media_buttons(){ 4200 var curentID; 4201 4202 jQuery('.wpestate_control_media_button').on('click',function(){ 4203 jQuery('.wpestate_control_media_button').removeClass('slideron'); 4204 jQuery(this).addClass('slideron'); 4205 jQuery('.wpestate_property_media_section_wrapper .status-wrapper').hide(); 4206 4207 jQuery('.wpestate_property_slider_thing').hide(); 4208 var div_to_show=jQuery(this).attr('data-show'); 4209 4210 jQuery('.'+div_to_show).show(); 4211 if(div_to_show=='wpestate_property_carousel'){ 4212 jQuery('.wpestate_property_media_section_wrapper .status-wrapper').show(); 4213 } 4214 4215 if(div_to_show=='google_map_slider_wrapper'){ 4216 wpestate_control_media_emable_map(); 4217 } 4218 4219 if(jQuery(this).attr('id')=='slider_enable_street'){ 4220 wpestate_control_media_emable_street_view(); 4221 } 4222 4223 4224 }); 4225} 4226 4227 4228 4229/* 4230* 4231* Enable Street Map 4232* 4233*/ 4234 4235 4236function wpestate_control_media_emable_street_view(){ 4237 var cur_lat, cur_long, myLatLng; 4238 4239 cur_lat = jQuery('#googleMapSlider').attr('data-cur_lat'); 4240 cur_long = jQuery('#googleMapSlider').attr('data-cur_long'); 4241 myLatLng = new google.maps.LatLng(cur_lat,cur_long); 4242 4243 jQuery('#gmapzoomplus.smallslidecontrol,#gmapzoomminus.smallslidecontrol,.google_map_poi_marker ').hide(); 4244 4245 panorama.setPosition(myLatLng); 4246 panorama.setVisible(true); 4247} 4248 4249/* 4250* 4251* Enable Map for Slider 4252* 4253*/ 4254 4255function wpestate_control_media_emable_map(){ 4256 jQuery('#googleMapSlider').show(); 4257 jQuery('#gmapzoomplus.smallslidecontrol,#gmapzoomminus.smallslidecontrol,.google_map_poi_marker ').show(); 4258 4259 if(wp_estate_kind_of_map===1){ 4260 google.maps.event.trigger(map, "resize"); 4261 }else{ 4262 setTimeout(function(){ map.invalidateSize(); }, 600); 4263 } 4264 4265 cur_lat = jQuery('#googleMapSlider').attr('data-cur_lat'); 4266 cur_long = jQuery('#googleMapSlider').attr('data-cur_long'); 4267 4268 if(wp_estate_kind_of_map===1){ 4269 map.setOptions({draggable: true}); 4270 myLatLng = new google.maps.LatLng(cur_lat,cur_long); 4271 map.setCenter(myLatLng); 4272 map.panBy(10,-100); 4273 panorama.setVisible(false); 4274 } 4275 4276} 4277/* 4278* 4279* Get Cookie 4280* 4281*/ 4282function wpestate_getCookie(cname) { 4283 var name = cname + "="; 4284 var ca = document.cookie.split(';'); 4285 for(var i=0; i<ca.length; i++) { 4286 var c = ca[i]; 4287 while (c.charAt(0)==' ') c = c.substring(1); 4288 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 4289 } 4290 return ""; 4291 } 4292 4293 4294 /* 4295* 4296* eanble advanced tab functions 4297* 4298*/ 4299 4300function wpestate_advtabs_function(item){ 4301 4302 var all_sliders = ['mainform','sidebar','shortcode','mobile','half']; 4303 var min_tab_slider= control_vars.adv6_min_price[slider_counter]; 4304 var max_tab_slider= control_vars.adv6_max_price[slider_counter]; 4305 4306 slider_counter++; 4307 for (var i = 0, length = all_sliders.length; i < length; i++) { 4308 wpestate_enable_slider_tab_for_all(all_sliders[i],item,min_tab_slider,max_tab_slider); 4309 } 4310} 4311 4312 4313/* 4314* 4315* eanble advanced tab functions 4316* 4317*/ 4318 4319 4320function wpestate_enable_slider_tab_for_all(position,item,min_tab_slider,max_tab_slider){ 4321 4322 var slider_id = 'slider_price_'+item+'_'+position ; 4323 var price_min = 'price_low_'+item; 4324 var price_max = 'price_max_'+item; 4325 var ammount = 'amount_'+item+'_'+position; 4326 4327 4328 var my_custom_curr_symbol = decodeURI ( wpestate_getCookie('my_custom_curr_symbol') ); 4329 var my_custom_curr_coef = parseFloat( wpestate_getCookie('my_custom_curr_coef')); 4330 var my_custom_curr_pos = parseFloat( wpestate_getCookie('my_custom_curr_pos')); 4331 var my_custom_curr_cur_post= wpestate_getCookie('my_custom_curr_cur_post'); 4332 4333// wpestate_enable_slider(slider_id, price_min, price_max, ammount, my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post, my_custom_curr_coef) ; 4334 wpestate_enable_slider_tab(min_tab_slider,max_tab_slider,'slider_price_'+item+'_'+position, 'price_low_'+item, 'price_max_'+item, 'amount_'+item+'_'+position, my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef,control_vars.adv6_min_price[slider_counter],control_vars.adv6_max_price[slider_counter]); 4335 4336 jQuery( '#slider_price_'+item +'_'+position).slider({ 4337 stop: function( event, ui ) { 4338 if (typeof (wpestate_show_pins) !== "undefined") { 4339 first_time_wpestate_show_inpage_ajax_half=1; 4340 4341 wpestate_show_pins(); 4342 } 4343 } 4344 }); 4345} 4346 4347 4348/* 4349* 4350* eanble slider tab 4351*/ 4352function wpestate_enable_slider_tab(slider_min,slider_max,slider_name, price_low, price_max, amount, my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post, my_custom_curr_coef) { 4353 4354 "use strict"; 4355 var price_low_val, price_max_val, temp_min, temp_max;
4356 price_low_val = parseInt(jQuery('#'+price_low).val(), 10); 4357 price_max_val = parseInt(jQuery('#'+price_max).val(), 10); 4358 4359 4360 slider_min = parseInt(slider_min,10); 4361 slider_max = parseInt(slider_max,10); 4362 4363 if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) { 4364 slider_min =slider_min *my_custom_curr_coef; 4365 slider_max =slider_max *my_custom_curr_coef; 4366 } 4367 4368 var slider_parent = jQuery("#" + slider_name).parent(); 4369 4370 var parent = jQuery("#" + slider_name).parent().parent(); 4371 var component_price_min; 4372 var component_price_max; 4373 var dropdown_parent; 4374 var dropdown_label; 4375 var component_label_value; 4376 4377 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4378 component_price_min=parent.find('#component_'+price_low); 4379 component_price_max=parent.find('#component_'+price_max); 4380 var dropdown_parent=parent.parent().find('.dropdown-toggle'); 4381 dropdown_label = parent.find('.price_label_component'); 4382 4383 } 4384 4385 4386 4387 jQuery("#" + slider_name).slider({ 4388 range: true, 4389 min: parseFloat(slider_min), 4390 max: parseFloat(slider_max), 4391 values: [price_low_val, price_max_val ], 4392 slide: function (event, ui) { 4393 temp_min= ui.values[0].format() ; 4394 temp_max= ui.values[1].format(); 4395 if(control_vars.indian_format==="yes"){ 4396 temp_min=wpstrea_js_indian_format(ui.values[0]); 4397 temp_max=wpstrea_js_indian_format(ui.values[1]); 4398 } 4399 4400 4401 4402 if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) { 4403 slider_parent.find("#" + price_low).val(ui.values[0]); 4404 slider_parent.find("#" + price_max).val(ui.values[1]); 4405 4406 jQuery("#price_low").val(ui.values[0]); 4407 jQuery("#price_max").val(ui.values[1]); 4408 4409 4410 4411 4412 if (my_custom_curr_cur_post === 'before') { 4413 jQuery("#" + amount).text( wpestate_replace_plus( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + temp_min + " " + control_vars.to + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) )+ " " + temp_max); 4414 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4415 component_price_min.val( wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + temp_min ); 4416 component_price_max.val( wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol) ) + " " + temp_max ); 4417 component_label_value = ""+ wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + wpestate_formatNumber_short(ui.values[0])+ " - " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + wpestate_formatNumber_short(ui.values[1]) ; 4418 4419 dropdown_parent.text(component_label_value); 4420 dropdown_label.val(component_label_value); 4421 } 4422 4423 } else { 4424 jQuery("#" + amount).text(temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) )+ " " + control_vars.to + " " + temp_max+ " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) ); 4425 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4426 component_price_min.val( temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) ); 4427 component_price_max.val( temp_max + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol) ) ); 4428 component_label_value= wpestate_formatNumber_short(ui.values[0]) + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " - " + wpestate_formatNumber_short(ui.values[1]) + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) ; 4429 4430 dropdown_parent.text(component_label_value); 4431 dropdown_label.val(component_label_value); 4432 } 4433 } 4434 } else { 4435 slider_parent.find("#" + price_low).val(ui.values[0]); 4436 slider_parent.find("#" + price_max).val(ui.values[1]); 4437 4438 4439 jQuery("#price_low").val(ui.values[0]); 4440 jQuery("#price_max").val(ui.values[1]); 4441 4442 if (control_vars.where_curency === 'before') { 4443 jQuery("#" + amount).text( wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_min + " " + control_vars.to + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_max ); 4444 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4445 component_price_min.val( wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_min ); 4446 component_price_max.val( wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_max ); 4447 component_label_value = ""+ wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + wpestate_formatNumber_short(ui.values[0])+ " - " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + wpestate_formatNumber_short(ui.values[1]) ; 4448 4449 dropdown_parent.text(component_label_value); 4450 dropdown_label.val(component_label_value); 4451 4452 } 4453 } else { 4454 jQuery("#" + amount).text(temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + control_vars.to + " " + temp_max + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ); 4455 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4456 component_price_min.val( temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ); 4457 component_price_max.val( temp_max + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ); 4458 component_label_value = wpestate_formatNumber_short(ui.values[0]) + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " - " + wpestate_formatNumber_short(ui.values[1]) + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ; 4459 4460 dropdown_parent.text(component_label_value); 4461 dropdown_label.val(component_label_value); 4462 } 4463 } 4464 } 4465 } 4466 }); 4467} 4468 4469 4470 4471 4472 4473/* 4474* 4475* replace string 4476* 4477*/ 4478function wpestate_replace_plus(string){ 4479 return string.replace("+"," "); 4480} 4481 4482/* 4483* 4484* js indiam format 4485* 4486*/ 4487 4488function wpstrea_js_indian_format(value){ 4489 value=value.toString(); 4490 var afterPoint = ''; 4491 if(value.indexOf('.') > 0) 4492 afterPoint = value.substring(value.indexOf('.'),value.length); 4493 value = Math.floor(value); 4494 value=value.toString(); 4495 var lastThree = value.substring(value.length-3); 4496 var otherNumbers = value.substring(0,value.length-3); 4497 if(otherNumbers != '') 4498 lastThree = ',' + lastThree; 4499 var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree + afterPoint; 4500 return res; 4501} 4502 4503 4504/* 4505* 4506* Eanble Slider 4507* 4508*/ 4509function wpestate_enable_slider(slider_name, price_low, price_max, amount, my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post, my_custom_curr_coef) { 4510 4511 var price_low_val, price_max_val, temp_min, temp_max, slider_min, slider_max;
4512 price_low_val = parseInt(jQuery('#'+price_low).val(), 10); 4513 price_max_val = parseInt(jQuery('#'+price_max).val(), 10); 4514 4515 4516 slider_min = control_vars.slider_min; 4517 slider_max = control_vars.slider_max; 4518 4519 4520 if( jQuery('#'+price_max).hasClass('adv_search_elementor_price_max') ){ 4521 slider_max = jQuery('#'+price_max).attr('data-value'); 4522 slider_min = jQuery('#'+price_low).attr('data-value'); 4523 } 4524 4525 if( jQuery('#'+price_max).hasClass('wpestate_slider_in_tab') ){ 4526 slider_max = jQuery('#'+price_max).attr('data-value'); 4527 slider_min = jQuery('#'+price_low).attr('data-value'); 4528 4529 } 4530 4531 4532 4533 if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) { 4534 slider_min =slider_min *my_custom_curr_coef; 4535 slider_max =slider_max *my_custom_curr_coef; 4536 } 4537 4538 var parent = jQuery("#" + slider_name).parent().parent(); 4539 var component_price_min; 4540 var component_price_max; 4541 var dropdown_parent; 4542 var dropdown_label; 4543 var component_label_value; 4544 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4545 component_price_min=parent.find('#component_'+price_low); 4546 component_price_max=parent.find('#component_'+price_max); 4547 var dropdown_parent=parent.parent().find('.dropdown-toggle'); 4548 dropdown_label = parent.find('.price_label_component'); 4549 4550 } 4551 4552 4553 jQuery("#" + slider_name).slider({ 4554 range: true, 4555 min: parseFloat(slider_min), 4556 max: parseFloat(slider_max), 4557 values: [price_low_val, price_max_val ], 4558 slide: function (event, ui) { 4559 4560 jQuery("#" + price_low).val(ui.values[0]); 4561 jQuery("#" + price_max).val(ui.values[1]); 4562 temp_min= ui.values[0].format() ; 4563 temp_max= ui.values[1].format(); 4564 if(control_vars.indian_format==="yes"){ 4565 temp_min=wpstrea_js_indian_format(ui.values[0]); 4566 temp_max=wpstrea_js_indian_format(ui.values[1]); 4567 } 4568 4569 if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) { 4570 if (my_custom_curr_cur_post === 'before') { 4571 jQuery("#" + amount).text( wpestate_replace_plus( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + temp_min + " " + control_vars.to + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) )+ " " + temp_max); 4572 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4573 component_price_min.val( wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + temp_min ); 4574 component_price_max.val( wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol) ) + " " + temp_max ); 4575 component_label_value = ""+ wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + wpestate_formatNumber_short(ui.values[0])+ " - " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " " + wpestate_formatNumber_short(ui.values[1]) ; 4576 4577 dropdown_parent.text(component_label_value); 4578 dropdown_label.val(component_label_value); 4579 } 4580 } else { 4581 jQuery("#" + amount).text(temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) )+ " " + control_vars.to + " " + temp_max + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) ); 4582 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4583 component_price_min.val( temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) ); 4584 component_price_max.val( temp_max + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol) ) ); 4585 component_label_value= wpestate_formatNumber_short(ui.values[0]) + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) + " - " + wpestate_formatNumber_short(ui.values[1]) + " " + wpestate_replace_plus ( decodeURIComponent ( my_custom_curr_symbol ) ) ; 4586 4587 dropdown_parent.text(component_label_value); 4588 dropdown_label.val(component_label_value); 4589 } 4590 } 4591 } else { 4592 4593 if (control_vars.where_curency === 'before') { 4594 jQuery("#" + amount).text(""+ wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_min+ " " + control_vars.to + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_max); 4595 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4596 component_price_min.val( wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_min ); 4597 component_price_max.val( wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + temp_max ); 4598 component_label_value = ""+ wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + wpestate_formatNumber_short(ui.values[0])+ " - " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + wpestate_formatNumber_short(ui.values[1]) ; 4599 4600 dropdown_parent.text(component_label_value); 4601 dropdown_label.val(component_label_value); 4602 4603 } 4604 } else { 4605 jQuery("#" + amount).text(temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " " + control_vars.to + " " + temp_max + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ); 4606 if(parent.hasClass('wpestate-price-popoup-wrapper')){ 4607 component_price_min.val( temp_min + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ); 4608 component_price_max.val( temp_max + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ); 4609 component_label_value = wpestate_formatNumber_short(ui.values[0]) + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) + " - " + wpestate_formatNumber_short(ui.values[1]) + " " + wpestate_replace_plus ( decodeURIComponent ( control_vars.curency ) ) ; 4610 4611 dropdown_parent.text(component_label_value); 4612 dropdown_label.val(component_label_value); 4613 } 4614 } 4615 } 4616 } 4617 }); 4618} 4619 4620/* 4621* 4622* enable slider for elementor 4623* 4624*/ 4625 4626function wpestate_enable_slider_elementor(){ 4627 4628 jQuery('.wpestate_elementor_search_tab_slider_wrapper').each(function(){ 4629 var slider_id = jQuery(this).find('.wpestate_elementor_search_tab_slider').attr('id'); 4630 var price_min = jQuery(this).find('.adv_search_elementor_price_low').attr('id'); 4631 var price_max = jQuery(this).find('.adv_search_elementor_price_max').attr('id'); 4632 var ammount = jQuery(this).find('.wpresidence_slider_price').attr('id'); 4633 var my_custom_curr_symbol = decodeURI ( wpestate_getCookie('my_custom_curr_symbol') ); 4634 var my_custom_curr_coef = parseFloat( wpestate_getCookie('my_custom_curr_coef')); 4635 var my_custom_curr_pos = parseFloat( wpestate_getCookie('my_custom_curr_pos')); 4636 var my_custom_curr_cur_post= wpestate_getCookie('my_custom_curr_cur_post'); 4637 wpestate_enable_slider(slider_id, price_min, price_max, ammount, my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef); 4638 4639 }); 4640 4641} 4642 4643/* 4644* 4645* 4646* 4647*/ 4648function wpestate_formatNumber_short(num) { 4649 num=parseFloat(num); 4650 4651 if (num >= 1000000000) { 4652 return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + 'B'; 4653 } 4654 if (num >= 1000000) { 4655 return (num / 1000000).toFixed(1).replace(/\.0$/, '') + 'M'; 4656 } 4657 if (num >= 1000) { 4658 return (num / 1000).toFixed(1).replace(/\.0$/, '') + 'K'; 4659 } 4660 return num.toString(); 4661} 4662 4663/* 4664* 4665* 4666* 4667*/ 4668 4669 4670function wpestate_done_typing(){ 4671 if (typeof (wpestate_show_pins) !== "undefined") { 4672 first_time_wpestate_show_inpage_ajax_half=1; 4673 4674 wpestate_show_pins(); 4675 } 4676} 4677 4678 4679/* 4680* 4681* 4682* 4683*/ 4684function isFunction(possibleFunction) { 4685 return typeof(possibleFunction) === typeof(Function); 4686} 4687 4688 4689 4690/* 4691* 4692* calculate morgage widget action 4693*/ 4694 4695function wpestate_zillow_widget_action(){ 4696 4697 jQuery('#zill_submit_estimate').on( 'click', function(event) { 4698 var button = jQuery(this); 4699 var container = button.parent(); 4700 var zillow_adress = jQuery('#zill_estimate_adr1').val(); 4701 var zillow_city = jQuery('#zill_estimate_city1').val(); 4702 var zillow_state = jQuery('#zill_estimate_state1').val(); 4703 4704 var full_address = zillow_adress+', '+zillow_city+', '+zillow_state; 4705 4706 if(zillow_adress==''|| zillow_city=='' || zillow_state==''){ 4707 var answer=control_vars.zillow_fields; 4708 container.find('.wpestate_zillow_answer').empty().append(answer); 4709 return; 4710 } 4711 4712 4713 4714 container.find('.wpestate_zillow_answer').empty().append(control_vars.zillow_wait); 4715 4716 ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php'; 4717 var nonce = jQuery('#wpestate_zillow_nonce').val(); 4718 jQuery.ajax({ 4719 type: 'POST', 4720 dataType: 'json', 4721 url: ajaxurl, 4722 data: { 4723 'action' : 'wpestate_zillow_estimation', 4724 'zillow_adress' : zillow_adress, 4725 'zillow_city' : zillow_city, 4726 'zillow_state' : zillow_state, 4727 'full_address' : full_address, 4728 'security' : nonce 4729 }, 4730 success: function (data) { 4731 4732 4733 4734 4735 if(data.total===0){ 4736 var answer=control_vars.zillow_none+" "+full_address; 4737 }else{ 4738 4739 var zillow_price = data.bundle[0].zestimate; 4740 4741 const formattedPrice = new Intl.NumberFormat('en-US', { 4742 style: 'currency', 4743 currency: 'USD', 4744 useGrouping: true 4745 }).format(zillow_price); 4746 4747 4748 var answer =control_vars.wpestate_zillow_answer+" <span class='wpestate_zillow_address'>"+full_address+"</span> "+control_vars.zillow_is+" <span class='wpestate_zillow_price'>"+formattedPrice+"</span>"; 4749 4750 } 4751 4752 4753 container.find('.wpestate_zillow_answer').empty().append(answer); 4754 4755 }, 4756 error: function (errorThrown) {} 4757 });//end ajax 4758 4759 4760 4761 4762 4763 4764 }); 4765} 4766 4767/* 4768* 4769* calculate morgage widget action 4770*/ 4771 4772function wpestate_morgate_widget_action(){ 4773 jQuery('#morg_compute').on( 'click', function(event) { 4774 4775 var intPayPer = 0; 4776 var intMthPay = 0; 4777 var intMthInt = 0; 4778 var intPerFin = 0; 4779 var intAmtFin = 0; 4780 var intIntRate = 0; 4781 var intAnnCost = 0; 4782 var intVal = 0; 4783 var salePrice = 0; 4784 4785 salePrice = jQuery('#sale_price').val(); 4786 intPerFin = jQuery('#percent_down').val() / 100; 4787 4788 intAmtFin = salePrice - salePrice * intPerFin; 4789 intPayPer = parseInt (jQuery('#term_years').val(),10) * 12; 4790 intIntRate = parseFloat (jQuery('#interest_rate').val(),10); 4791 intMthInt = intIntRate / (12 * 100); 4792 intVal = wpestate_raisePower(1 + intMthInt, -intPayPer); 4793 intMthPay = intAmtFin * (intMthInt / (1 - intVal)); 4794 intAnnCost = intMthPay * 12; 4795 4796 jQuery('#am_fin').html("<strong>"+control_vars.morg1+"</strong> " + (Math.round(intAmtFin * 100)) / 100 + " "); 4797 jQuery('#morgage_pay').html("<strong>"+control_vars.morg2+"</strong>" + (Math.round(intMthPay * 100)) / 100 + " "); 4798 jQuery('#anual_pay').html("<strong>"+control_vars.morg3+"</strong>" + (Math.round(intAnnCost * 100)) / 100 + " "); 4799 jQuery('#morg_results').show();
4800 jQuery('.mortgage_calculator_div').css('height',532+'px'); 4801 }); 4802 4803} 4804 4805/* 4806* 4807* sanitzie string to be used as classname 4808* 4809*/ 4810function wpestateSanitizeClassName(str) { 4811 // Remove leading numbers by replacing them with a prefix (e.g., 'class-') 4812 str = str.replace(/^\d+/, 'class-'); 4813 4814 // Replace invalid characters with a hyphen 4815 str = str.replace(/[^a-zA-Z0-9-_]/g, '-'); 4816 4817 // Remove multiple hyphens 4818 str = str.replace(/-+/g, '-'); 4819 4820 // Remove leading and trailing hyphens 4821 str = str.trim().replace(/(^-|-$)/g, ''); 4822 4823 return str; 4824} 4825 4826 4827/** 4828* Initialize autocomplete functionality for location search fields. 4829* 4830* This function sets up jQuery UI autocomplete on location input fields with the following features: 4831* - Filters and displays location suggestions as user types 4832* - Limits results to 12 items 4833* - Adds a reset button after selected text 4834* - Groups results by location category (City, Area, County/State) 4835* - Updates map pins on selection 4836* 4837* @since 4.9.0 4838* @param {Array} availableTags - Array of location objects with properties: 4839* @param {string} category - Location category ("City", "Area", "County or State") 4840* @param {string} labelcategory - Category identifier for CSS ("city", "area", "countystate") 4841* @param {string} label - Display name of the location 4842* @param {string} value - Location value to be used 4843* @param {string} inputID - ID of the input field to initialize autocomplete on 4844* 4845* @requires jQuery 4846* @requires jQuery UI Autocomplete 4847* 4848* DOM Requirements: 4849* - Input field must be wrapped in .adv_locations_search_component_wrapper 4850* - Input field must have class .adv_locations_search 4851* 4852* Global variables used: 4853* - first_time_wpestate_show_inpage_ajax_half 4854* 4855* Related functions: 4856* - wpestate_show_pins() - Updates map pins after selection 4857*/ 4858function wpresidenceInitializeAutocomplete(availableTags, inputID) { 4859 jQuery("#" + inputID).autocomplete({ 4860 source: function(request, response) { 4861 var results = jQuery.ui.autocomplete.filter(availableTags, request.term); 4862 response(results.slice(0, 12)); 4863 }, 4864 select: function(event, ui) { 4865 var $input = jQuery(this); 4866 var $wrapper = $input.parent(); 4867 var selectedText = ui.item.label; // Get the selected text 4868 4869 // Create reset button 4870 var $resetBtn = jQuery(` 4871 <button type="button" class="wpresidece-reset-btn"> 4872 <svg width="14px" height="14px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 4873 <g id="SVGRepo_bgCarrier" stroke-width="0"></g> 4874 <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g> 4875 <g id="SVGRepo_iconCarrier"> 4876 <rect width="24" height="24"></rect> 4877 <path d="M7 17L16.8995 7.10051" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path> 4878 <path d="M7 7.00001L16.8995 16.8995" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path> 4879 </g> 4880 </svg> 4881 </button>`); 4882 4883 // Remove any existing reset button first 4884 $wrapper.find('.wpresidece-reset-btn').remove(); 4885 4886 // Add the reset button after input 4887 $input.after($resetBtn); 4888 4889 // Calculate position based on selected text 4890 var $measure = jQuery('<span>').css({ 4891 'font-family': $input.css('font-family'), 4892 'font-size': $input.css('font-size'), 4893 'font-weight': $input.css('font-weight'), 4894 'position': 'absolute', 4895 'visibility': 'hidden', 4896 'white-space': 'pre' 4897 }).text(selectedText); 4898 4899 $wrapper.append($measure); 4900 4901 var inputPadding = parseInt($input.css('padding-left')); 4902 var textWidth = $measure.width(); 4903 4904 $resetBtn.css({ 4905 'left': (inputPadding + textWidth + 5) + 'px', // 5px buffer 4906 'right': 'auto' 4907 }); 4908 4909 $measure.remove(); 4910 4911 // Event handler for the reset button 4912 $resetBtn.on('click', function() { 4913 $input.val(""); 4914 jQuery(this).remove(); 4915 setTimeout(function() { 4916 first_time_wpestate_show_inpage_ajax_half = 1; 4917 wpestate_show_pins(); 4918 }, 1000); 4919 }); 4920 4921 setTimeout(function() { 4922 first_time_wpestate_show_inpage_ajax_half = 1; 4923 wpestate_show_pins(); 4924 }, 1000); 4925 }, 4926 change: function() { 4927 } 4928 }).autocomplete("instance")._renderItem = function(ul, item) { 4929 var item_class = "wpresidence-geolocatiomarker-" + item.labelcategory; 4930 var $li = jQuery("<li>").append("<div class='" + item_class + "'>" + item.label + "</div>"); 4931 4932 var lastCategory = jQuery(ul).find(".wpresidece-dropdown-category-label:last").data("category"); 4933 if (lastCategory !== item.category) { 4934 var $categoryDiv = jQuery("<div>") 4935 .addClass("wpresidece-dropdown-category-label") 4936 .data("category", item.category) 4937 .text(item.category); 4938 jQuery(ul).append($categoryDiv); 4939 } 4940 4941 return $li.appendTo(ul); 4942 }; 4943} 4944 4945 4946 4947/* 4948* 4949* save search actions 4950* 4951*/ 4952function wpestate_save_search_actions(){ 4953 4954 jQuery('#save_search_button').on( 'click', function(event) { 4955 var nonce, search, search_name, parent, ajaxurl,meta; 4956 search_name = jQuery('#search_name').val(); 4957 search = jQuery('#search_args').val(); 4958 meta = jQuery('#meta_args').val(); 4959 nonce = jQuery('#wpestate_save_search_nonce').val(); 4960 ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php'; 4961 jQuery('#save_search_notice').html(control_vars.save_search); 4962 4963 jQuery.ajax({ 4964 type: 'POST', 4965 url: ajaxurl, 4966 data: { 4967 'action' : 'wpestate_save_search_function', 4968 'search_name' : search_name, 4969 'search' : search, 4970 'meta' : meta, 4971 'security' : nonce 4972 }, 4973 success: function (data) { 4974 4975 jQuery('#save_search_notice').html(data); 4976 jQuery('#search_name').val(''); 4977 }, 4978 error: function (errorThrown) { 4979 } 4980 }); 4981 4982 }); 4983} 4984 4985/* 4986* 4987* delete save search actions 4988* 4989*/ 4990function wpestate_delete_save_search_actions(){ 4991 jQuery('.delete_search').on( 'click', function(event) { 4992 var search_id, parent, ajaxurl,confirmtext;
4993 confirmtext = control_vars.deleteconfirm; 4994 4995 if (confirm(confirmtext)) { 4996 event.preventDefault(); 4997 ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php'; 4998 search_id = jQuery(this).attr('data-searchid'); 4999 parent = jQuery(this).parent(); 5000 jQuery(this).html(control_vars.deleting); 5001 var nonce = jQuery('#wpestate_searches_actions').val(); 5002 jQuery.ajax({ 5003 type: 'POST', 5004 url: ajaxurl, 5005 data: { 5006 'action' : 'wpestate_delete_search', 5007 'search_id' : search_id, 5008 'security' : nonce, 5009 }, 5010 success: function (data) { 5011 5012 if (data==='deleted'){ 5013 parent.remove(); 5014 } 5015 5016 }, 5017 error: function (errorThrown) { 5018 } 5019 }); 5020 5021 5022 } 5023 5024 }); 5025} 5026 5027 5028 5029/* 5030* 5031* 5032* 5033*/ 5034function wpestate_overview_map(){ 5035 jQuery('#overview_map').click(function(){ 5036 jQuery('#wpestate_overview_map_modal').appendTo("body"); 5037 jQuery('body> #wpestate_overview_map_modal').first().modal("show"); 5038 5039 }); 5040} 5041 5042 5043
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.