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