https://www.immo-dogan.com/wp-content/themes/realhomes/assets/classic/scripts/js/custom.js?ver=4.1.1
1(function ($) { 2 "use strict"; 3 4 $(document).ready(function () { 5 6 var $window = $(window), 7 $body = $('body'), 8 isRtl = $body.hasClass('rtl'); 9 10 /*-----------------------------------------------------------------------------------*/ 11 /* For RTL Languages 12 /*-----------------------------------------------------------------------------------*/ 13 if ($body.hasClass('rtl')) { 14 $('.contact-number .fa-phone, .contact-number .fa-whatsapp, .more-details .fa-caret-right').addClass('fa-flip-horizontal'); 15 } 16 17 /*-----------------------------------------------------------------------------------*/ 18 /* Cross Browser 19 /*-----------------------------------------------------------------------------------*/ 20 $('.property-item .features span:last-child').css('border', 'none'); 21 $('.dsidx-prop-title').css('margin', '0 0 15px 0'); 22 $('.dsidx-prop-summary a img').css('border', 'none'); 23 24 /*-----------------------------------------------------------------------------------*/ 25 /* Main Menu Dropdown Control 26 /*-----------------------------------------------------------------------------------*/ 27 $('ul.rh_menu__main_menu li').on({ 28 mouseenter: function () { 29 $(this).children('ul').stop(true, true).slideDown(200); 30 }, 31 mouseleave: function () { 32 $(this).children('ul').stop(true, true).delay(50).slideUp(600); 33 } 34 }); 35 36 // Responsive Menu. 37 $('.rh_menu__hamburger').on('click', function () { 38 $('ul.rh_menu__responsive').slideToggle(); 39 }); 40 41 var sub_menu_parent = $('.rh_menu__responsive ul.sub-menu').parent(); 42 sub_menu_parent.prepend('<i class="fas fa-caret-down rh_menu__indicator"></i>'); 43 44 // Second Level 45 $('ul.rh_menu__responsive > li .rh_menu__indicator').on('click', function (e) { 46 e.preventDefault(); 47 $(this).parent().children('ul.sub-menu').slideToggle(); 48 $(this).toggleClass('rh_menu__indicator_up'); 49 }); 50 51 /*-----------------------------------------------------------------------------------*/ 52 /* Autofocus user login 53 /*-----------------------------------------------------------------------------------*/ 54 $('.user-nav .last').on('click', function () { 55 setTimeout(function () { 56 if ($('#username').hasClass('focus-class')) { 57 $('.focus-class').focus(); 58 } 59 }, 500); 60 }); 61 62 /*-----------------------------------------------------------------------------------*/ 63 /* Hamburger 64 /*-----------------------------------------------------------------------------------*/ 65 /** 66 * forEach implementation for Objects/NodeLists/Arrays, automatic type loops and context options 67 * 68 * @private 69 * @author Todd Motto 70 * @link https://github.com/toddmotto/foreach 71 * @param {Array|Object|NodeList} collection - Collection of items to iterate, could be an Array, Object or NodeList 72 * @callback requestCallback callback - Callback function for each iteration. 73 * @param {Array|Object|NodeList} scope=null - Object/NodeList/Array that forEach is iterating over, to use as the this value when executing callback. 74 * @returns {} 75 */ 76 var forEach = function (t, o, r) { 77 if ("[object Object]" === Object.prototype.toString.call(t)) for (var c in t) Object.prototype.hasOwnProperty.call(t, c) && o.call(r, t[c], c, t); else for (var e = 0, l = t.length; l > e; e++) o.call(r, t[e], e, t) 78 }; 79 80 var hamburgers = document.querySelectorAll(".hamburger"); 81 if (hamburgers.length > 0) { 82 forEach(hamburgers, function (hamburger) { 83 hamburger.addEventListener("click", function () { 84 this.classList.toggle("is-active"); 85 }, false); 86 }); 87 } 88 89 /*-----------------------------------------------------------------------------------*/ 90 /* Flex Slider 91 /*-----------------------------------------------------------------------------------*/ 92 if (jQuery().flexslider) { 93 // Flex Slider for Homepage 94 $('#home-flexslider .flexslider').flexslider({ 95 animation: "fade", 96 slideshowSpeed: 7000, 97 animationSpeed: 1500, 98 directionNav: true, 99 controlNav: false, 100 keyboardNav: true, 101 start: function (slider) { 102 slider.removeClass('loading'); 103 } 104 }); 105 106 // Flex Slider for Featured Properties - Homepage 107 $('#rh_featured_properties .rh_featured_properties__slider').flexslider({ 108 slideshowSpeed: 5000, 109 animationSpeed: 1000, 110 directionNav: false, 111 slideshow: false, 112 controlNav: true, 113 keyboardNav: true, 114 start: function (slider) { 115 slider.removeClass('loading'); 116 $('.flexslider .clone').children().removeAttr("data-fancybox"); 117 } 118 }); 119 120 // Flex Slider for Property Single Videos.
121 const singlePropertyVideosSlider = $('.rh_wrapper_property_videos_slider'), 122 singlePropertyVideosSliderItems = singlePropertyVideosSlider.find('.slides li'); 123 if( (singlePropertyVideosSliderItems.length > 1 ) ){ 124 singlePropertyVideosSlider.flexslider({ 125 animation: "slide", 126 slideshow: false, 127 directionNav: true, 128 controlNav: false, 129 start: function (slider) { 130 slider.resize(); 131 $('.flexslider .clone').children().removeAttr("data-fancybox"); 132 }, 133 }); 134 }else { 135 singlePropertyVideosSliderItems.css('display', 'block'); 136 } 137 138 // Remove Flex Slider Navigation for Smaller Screens Like IPhone Portrait 139 $('.slider-wrapper, .listing-slider').on({ 140 mouseenter: function () { 141 var mobile = $body.hasClass('probably-mobile'); 142 if (!mobile) { 143 $('.flex-direction-nav').stop(true, true).fadeIn('slow'); 144 } 145 }, 146 mouseleave: function () { 147 $('.flex-direction-nav').stop(true, true).fadeOut('slow'); 148 } 149 }); 150 151 // Flex Slider for Detail Page 152 $('#property-detail-flexslider .flexslider').flexslider({ 153 animation: "slide", 154 directionNav: true, 155 controlNav: "thumbnails", 156 start: function (slider) { 157 slider.resize(); 158 $('.flexslider .clone').children().removeAttr("data-fancybox"); 159 } 160 }); 161 162 // Flex Slider Gallery Post 163 $('.listing-slider').flexslider({ 164 animation: "slide", 165 prevText: '<i class="fas fa-angle-left"></i>', 166 nextText: '<i class="fas fa-angle-right"></i>', 167 }); 168 169 /* Property detail page slider variation two */ 170 $('#property-carousel-two').flexslider({ 171 animation: "slide", 172 controlNav: false, 173 animationLoop: false, 174 slideshow: false, 175 itemWidth: 120, 176 itemMargin: 10, 177 // move: 1, 178 asNavFor: '#property-slider-two' 179 }); 180 $('#property-slider-two').flexslider({ 181 animation: "slide", 182 directionNav: true, 183 controlNav: false, 184 animationLoop: false, 185 slideshow: false, 186 sync: "#property-carousel-two", 187 start: function (slider) { 188 slider.removeClass('loading'); 189 $('.flexslider .clone').children().removeAttr("data-fancybox"); 190 } 191 }); 192 } 193 194 /*-----------------------------------------------------------------------------------*/ 195 /* jCarousel 196 /*-----------------------------------------------------------------------------------*/ 197 if (jQuery().jcarousel) { 198 // Jcarousel for Detail Page 199 jQuery('#property-detail-flexslider .flex-control-nav').jcarousel({ 200 vertical: true, 201 scroll: 1 202 }); 203 } 204 205 /*-----------------------------------------------------------------------------------*/ 206 /* Carousel - Elastislide 207 /*-----------------------------------------------------------------------------------*/ 208 var param = { 209 speed: 500, 210 imageW: 245, 211 minItems: 1, 212 margin: 30, 213 onClick: function ($object) { 214 window.location = $object.find('a').first().attr('href'); 215 return true; 216 } 217 }; 218 219 function cstatus(a, b, c) { 220 var temp = a.children("li"); 221 temp.last().attr('style', 'margin-right: 0px !important'); 222 if (temp.length > c) { 223 b.elastislide(param); 224 } 225 } 226 227 if (jQuery().elastislide) { 228 var fp = $('.featured-properties-carousel .es-carousel-wrapper ul'), 229 fpCarousel = $('.featured-properties-carousel .carousel'); 230 cstatus(fp, fpCarousel, 4); 231 } 232 233 /*-------------------------------------------------------*/ 234 /* Focus and Blur events with input elements 235 /* -----------------------------------------------------*/ 236 var addFocusAndBlur = function ($input, $val) { 237 $input.focus(function () { 238 if ($(this).value == $val) { 239 $(this).value = ''; 240 } 241 }); 242 243 $input.blur(function () { 244 if ($(this).value == '') { 245 $(this).value = $val; 246 } 247 }); 248 }; 249 250 // Attach the events 251 addFocusAndBlur(jQuery('#principal'), 'Principal'); 252 addFocusAndBlur(jQuery('#interest'), 'Interest'); 253 addFocusAndBlur(jQuery('#payment'), 'Payment'); 254 addFocusAndBlur(jQuery('#texes'), 'Texes'); 255 addFocusAndBlur(jQuery('#insurance'), 'Insurance'); 256 addFocusAndBlur(jQuery('#pmi'), 'PMI'); 257 addFocusAndBlur(jQuery('#extra'), 'Extra'); 258 259 /*-----------------------------------------------------------------------------------*/ 260 /* Apply Bootstrap Classes on Comment Form Fields to Make it Responsive 261 /*-----------------------------------------------------------------------------------*/ 262 $('#respond #submit, #dsidx-contact-form-submit').addClass('real-btn'); 263 $('.lidd_mc_form input[type=submit]').addClass('real-btn'); 264 $('.pages-nav > a').addClass('real-btn');
265 $('.dsidx-search-button .submit').addClass('real-btn'); 266 $('.wpcf7-submit').addClass('real-btn'); 267 268 /*----------------------------------------------------------------------------------*/ 269 /* Contact Form AJAX validation and submission 270 /* Validation Plugin : http://bassistance.de/jquery-plugins/jquery-plugin-validation/ 271 /* Form Ajax Plugin : http://www.malsup.com/jquery/form/ 272 /*---------------------------------------------------------------------------------- */ 273 if (jQuery().validate && jQuery().ajaxSubmit) { 274 275 var submitButton = $('#submit-button'), 276 ajaxLoader = $('#ajax-loader'), 277 messageContainer = $('#message-container'), 278 errorContainer = $("#error-container"); 279 280 var formOptions = { 281 beforeSubmit: function () { 282 submitButton.attr('disabled', 'disabled'); 283 ajaxLoader.fadeIn('fast'); 284 messageContainer.fadeOut('fast'); 285 errorContainer.fadeOut('fast'); 286 }, 287 success: function (ajax_response, statusText, xhr, $form) { 288 var response = $.parseJSON(ajax_response); 289 ajaxLoader.fadeOut('fast'); 290 submitButton.removeAttr('disabled'); 291 if (response.success) { 292 $form.resetForm(); 293 messageContainer.html(response.message).fadeIn('fast'); 294 295 setTimeout(function () { 296 messageContainer.fadeOut('slow') 297 },5000); 298 299 // call reset function if it exists 300 if (typeof inspiryResetReCAPTCHA == 'function') { 301 inspiryResetReCAPTCHA(); 302 } 303 304 if( typeof CFOSData !== 'undefined' ){ 305 setTimeout(function(){ 306 window.location.replace(CFOSData.redirectPageUrl); 307 },1000); 308 } 309 310 if( typeof contactFromData !== 'undefined' ){ 311 setTimeout(function(){ 312 window.location.replace(contactFromData.redirectPageUrl); 313 },1000); 314 } 315 316 } else { 317 errorContainer.html(response.message).fadeIn('fast'); 318 } 319 } 320 }; 321 322 // Contact page form 323 $('#contact-form .contact-form').validate({ 324 errorLabelContainer: errorContainer, 325 submitHandler: function (form) { 326 $(form).ajaxSubmit(formOptions); 327 } 328 }); 329 330 // Contact page form 331 $('.cfos_contact_form').validate({ 332 errorLabelContainer: errorContainer, 333 submitHandler: function (form) { 334 $(form).ajaxSubmit(formOptions); 335 } 336 }); 337 338 // Agent single page form 339 $('#agent-single-form').validate({ 340 errorLabelContainer: errorContainer, 341 submitHandler: function (form) { 342 $(form).ajaxSubmit(formOptions); 343 } 344 }); 345 } 346 347 348 349 /* ---------------------------------------------------- */ 350 /* Gallery Hover Effect 351 /* ---------------------------------------------------- */ 352 $('.gallery-item figure').on({ 353 mouseenter: function () { 354 var $currentFigure = $(this); 355 var $mediaContainer = $currentFigure.find('.media_container'); 356 var $media = $mediaContainer.find('a'); 357 var $margin = -($media.first().height() / 2); 358 $media.css('margin-top', $margin); 359 var linkWidth = $media.first().width(); 360 var targetPosition = ($mediaContainer.width() / 2) - (linkWidth + 2); 361 $mediaContainer.stop().fadeIn(300); 362 $mediaContainer.find('a.link').stop().animate({'right': targetPosition}, 300); 363 $mediaContainer.find('a.zoom').stop().animate({'left': targetPosition}, 300); 364 }, 365 mouseleave: function () { 366 var $currentFigure = $(this); 367 var $mediaContainer = $currentFigure.find('.media_container'); 368 $mediaContainer.stop().fadeOut(300); 369 $mediaContainer.find('a.link').stop().animate({'right': '0'}, 300); 370 $mediaContainer.find('a.zoom').stop().animate({'left': '0'}, 300); 371 } 372 }); 373 374 /* ---------------------------------------------------- */ 375 /* Sizing Header Outer Strip 376 /* ---------------------------------------------------- */ 377 function outer_strip() { 378 var $item = $('.outer-strip'), 379 $c_width = $('.header-wrapper .container').width(), 380 $w_width = $(window).width(), 381 $i_width = ($w_width - $c_width) / 2; 382 383 if ($body.hasClass('rtl')) { 384 $item.css({ 385 left: -$i_width, 386 width: $i_width 387 }); 388 } else { 389 $item.css({ 390 right: -$i_width, 391 width: $i_width 392 }); 393 } 394 } 395 396 outer_strip(); 397 $window.on('resize', function () { 398 outer_strip(); 399 }); 400 401 /* ---------------------------------------------------- */ 402 /* Notification Hide Function 403 /* ---------------------------------------------------- */ 404 $(".icon-remove").on('click', function () { 405 $(this).parent().fadeOut(300); 406 }); 407 408 /*-----------------------------------------------------------------------------------*/ 409 /* Image Hover Effect 410 /*-----------------------------------------------------------------------------------*/ 411 if (jQuery().transition) { 412 $('.zoom_img_box img').on({ 413 mouseenter: function () { 414 $(this).stop(true, true).transition({ 415 scale: 1.1 416 }, 300); 417 }, 418 mouseleave: function () { 419 $(this).stop(true, true).transition({ 420 scale: 1 421 }, 150); 422 } 423 }); 424 } 425 426 /*-----------------------------------------------------------------------------------*/ 427 /* Grid and Listing Toggle View 428 /*-----------------------------------------------------------------------------------*/ 429 if ($('.listing-grid-layout').hasClass('property-toggle')) { 430 $('.listing-layout .property-item-grid').hide(); 431 $('a.grid').on('click', function () { 432 $('.listing-layout').addClass('property-grid'); 433 $('.property-item-grid').show(); 434 $('.property-item-list').hide(); 435 $('a.grid').addClass('active'); 436 $('a.list').removeClass('active'); 437 }); 438 $('a.list').on('click', function () { 439 $('.listing-layout').removeClass('property-grid'); 440 $('.property-item-grid').hide(); 441 $('.property-item-list').show(); 442 $('a.grid').removeClass('active'); 443 $('a.list').addClass('active'); 444 }); 445 } 446 447 /*-----------------------------------------------------------------------------------*/ 448 /* Calendar Widget Border Fix 449 /*-----------------------------------------------------------------------------------*/ 450 var $calendar = $('.sidebar .widget #wp-calendar'); 451 if ($calendar.length > 0) { 452 $calendar.each(function () { 453 $(this).closest('.widget').css('border', 'none').css('background', 'transparent'); 454 }); 455 } 456 457 var $single_listing = $('.sidebar .widget .dsidx-widget-single-listing'); 458 if ($single_listing.length > 0) { 459 $single_listing.each(function () { 460 $(this).closest('.widget').css('border', 'none').css('background', 'transparent'); 461 }); 462 } 463 464 /*-----------------------------------------------------------------------------------*/ 465 /* Tags Cloud 466 /*-----------------------------------------------------------------------------------*/ 467 $('.tagcloud').addClass('clearfix'); 468 $('.tagcloud a').removeAttr('style'); 469 470 /* dsIDXpress */ 471 $('#dsidx-top-search #dsidx-search-form table td').removeClass('label');
472 $('.dsidx-tag-pre-foreclosure br').replaceWith(' '); 473 474 /*-----------------------------------------------------------------------------------*/ 475 /* Properties Sorting 476 /*-----------------------------------------------------------------------------------*/ 477 function insertParam(key, value) { 478 key = encodeURI(key); 479 value = encodeURI(value); 480 481 var kvp = document.location.search.substr(1).split('&'); 482 483 var i = kvp.length; 484 var x; 485 while (i--) { 486 x = kvp[i].split('='); 487 488 if (x[0] == key) { 489 x[1] = value; 490 kvp[i] = x.join('='); 491 break; 492 } 493 } 494 495 if (i < 0) { 496 kvp[kvp.length] = [key, value].join('='); 497 } 498 499 //this will reload the page, it's likely better to store this until finished 500 document.location.search = kvp.join('&'); 501 } 502 503 $('#sort-properties').on('change', function () { 504 var key = 'sortby'; 505 var value = $(this).val(); 506 insertParam(key, value); 507 }); 508 509 510 /*-----------------------------------------------------------------------------------*/ 511 /* Remove my property 512 /*-----------------------------------------------------------------------------------*/ 513 $('a.remove-my-property').on('click', function (event) { 514 event.preventDefault(); 515 var $this = $(this); 516 var property_item = $this.closest('.my-property'); 517 var loader = $this.find('.loader'); 518 var remover = $this.find('.remove'); 519 var ajax_response = property_item.find('.ajax-response'); 520 521 remover.hide(); 522 loader.css('display', 'inline-block'); 523 $this.css('cursor', 'default'); 524 525 var remove_property_request = $.ajax({ 526 url: $this.attr('href'), 527 type: "POST", 528 data: { 529 property_id: $this.data('property-id'), 530 action: "remove_my_property" 531 }, 532 dataType: "json" 533 }); 534 535 remove_property_request.done(function (response) { 536 loader.hide(); 537 if (response.success) { 538 property_item.remove(); 539 } else { 540 remover.show(); 541 $this.css('cursor', 'pointer'); 542 ajax_response.text(response.message); 543 } 544 }); 545 546 remove_property_request.fail(function (jqXHR, textStatus) { 547 loader.hide(); 548 remover.show(); 549 $this.css('cursor', 'pointer'); 550 ajax_response.text("Request Failed: " + textStatus); 551 }); 552 }); 553 554 /*-----------------------------------------------------------------------------------*/ 555 /* Sticky-kit 556 /* URL: https://github.com/leafo/sticky-kit 557 /*-----------------------------------------------------------------------------------*/ 558 var makeSticky = function () { 559 var screenWidth = $( window ).width(); 560 if ( 768 <= screenWidth ) { 561 let offsetTop = 0; 562 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 563 offsetTop += 32; 564 } 565 if ( $( 'body' ).hasClass( 'sticky-header' ) ) { 566 let stickyHeaderHeight = $( '.rh_classic_sticky_header' ).height(); 567 if ( stickyHeaderHeight !== undefined ) { 568 offsetTop += parseInt( stickyHeaderHeight ); 569 } 570 } 571 572 $( '.compare-properties-column .property-thumbnail' ).stick_in_parent( { offset_top : offsetTop } ) 573 .on( "sticky_kit:stick", function ( e ) { 574 $( '.compare-template .compare-properties-column > p:nth-child(odd)' ).css( { 575 'background' : '#eeeeee' 576 } ); 577 $( '.compare-template .compare-properties-column > p:nth-child(even)' ).css( { 578 'background' : '#ffffff' 579 } ); 580 let heightThumbnail = $( '.compare-properties-column .property-thumbn
580ail' ).height(); 581 $( '.compare-properties-column > div:nth-child(2)' ).css( { 582 'height' : heightThumbnail 583 } ); 584 } ) 585 .on( "sticky_kit:unstick", function ( e ) { 586 } ); 587 $( '.compare-feature-column .property-thumbnail' ).stick_in_parent( { offset_top : offsetTop } ) 588 .on( "sticky_kit:stick", function ( e ) { 589 $( '.compare-template .compare-feature-column > p:nth-child(odd)' ).css( { 590 'background' : '#eeeeee' 591 } ); 592 $( '.compare-template .compare-feature-column > p:nth-child(even)' ).css( { 593 'background' : '#ffffff' 594 } ); 595 var heightEmptyThumbnail = $( '.compare-properties-column .property-thumbnail' ).height(); 596 $( '.compare-feature-column > div:nth-child(2)' ).css( { 597 'height' : heightEmptyThumbnail 598 } ); 599 } ) 600 .on( "sticky_kit:unstick", function ( e ) { 601 } ); 602 } else { 603 $( '.compare-properties-column .property-thumbnail' ).trigger( "sticky_kit:detach" ); 604 $( '.compare-feature-column .property-thumbnail' ).trigger( "sticky_kit:detach" ); 605 } 606 }; 607 makeSticky(); 608 // Execute again when browser resizes. 609 $window.on( 'resize', function () { 610 makeSticky(); 611 } ); 612 613 614 /*-----------------------------------------------------------------------------------*/ 615 /* Optima Express IDX Support 616 /*-----------------------------------------------------------------------------------*/ 617 $(".ihf-grid-result-container .ihf-grid-result-photocount") 618 .contents() 619 .filter(function () { 620 return this.nodeType !== 1; 621 }) 622 .wrap("<span></span>"); 623 624 $('.ihf-grid-result-mlsnum-proptype').parent().parent().find('.col-xs-3').hide(); 625 $('.ihf-grid-result-mlsnum-proptype').parent().parent().find('.col-xs-9').toggleClass('col-xs-12'); 626 $('#ihf-main-container .ihf-detail-back-to-results a').html('<span class="fas fa-angle-left"></span><span class="rh_back-link"> Back to Results</span>'); 627 $("#ihf-sort-values").parent().on('click', function() { 628 $("#ihf-sort-values").fadeToggle(); 629 }); 630 $("#ihf-main-container").on('mouseleave', function() { 631 $("#ihf-sort-values").fadeOut(); 632 }); 633 634 /*-------------------------------------------------------*/ 635 /* Advanced Search Button - Search Form Over Image Variation 636 /* -----------------------------------------------------*/ 637 $('.SFOI__advanced-expander').on('click', function (e) { 638 639 var upDownArrow = $(this).find('i'); 640 var advancedFieldsWrapper = $(this).parent('.SFOI__form-wrapper').find('.SFOI__advanced-fields-wrapper'); 641 642 if (upDownArrow.hasClass('fa-angle-down')) { 643 advancedFieldsWrapper.slideDown(); 644 upDownArrow.removeClass('fa-angle-down').addClass('fa-angle-up'); 645 } else { 646 advancedFieldsWrapper.slideUp(); 647 upDownArrow.removeClass('fa-angle-up').addClass('fa-angle-down'); 648 } 649 }); 650 651 /*-------------------------------------------------------*/ 652 /* More Options in Search Form 653 /* -----------------------------------------------------*/ 654 $('.more-option-trigger > a').on('click', function (e) { 655 e.preventDefault(); 656 var triggerIcon = $(this).find('i'); 657 var moreOptionsWrapper = $('.more-options-wrapper'); 658 if (triggerIcon.hasClass('fa-plus-square')) { 659 triggerIcon.removeClass('fa-plus-square').addClass('fa-minus-square'); 660 // moreOptionsWrapper.removeClass('collapsed'); 661 moreOptionsWrapper.slideDown(200); 662 } else if (triggerIcon.hasClass('fa-minus-square')) { 663 triggerIcon.removeClass('fa-minus-square').addClass('fa-plus-square'); 664 // moreOptionsWrapper.addClass('collapsed'); 665 moreOptionsWrapper.slideUp(200); 666 } 667 }); 668 669 /*-------------------------------------------------------*/ 670 /* More Fields in Search Form 671 /* -----------------------------------------------------*/ 672 $('.more-fields-trigger > a').on('click', function (e) { 673 var triggerIcon = $(this).find('i'); 674 var triggerSpan = $(this).find('span'); 675 var moreFieldsWrapper = $('.more-fields-wrapper'); 676 if (triggerIcon.hasClass('fa-plus-square-o')) { 677 triggerIcon.removeClass('fa-plus-square-o').addClass('fa-minus-square-o'); 678 moreFieldsWrapper.removeClass('collapsed'); 679 triggerSpan.text(localized.less_search_fields); 680 } else if (triggerIcon.hasClass('fa-minus-square-o')) { 681 triggerIcon.removeClass('fa-minus-square-o').addClass('fa-plus-square-o'); 682 moreFieldsWrapper.addClass('collapsed'); 683 triggerSpan.text(localized.more_search_fields); 684 685 } 686 e.preventDefault(); 687 }); 688 689 /*-----------------------------------------------------------------------------------*/ 690 /* Scroll to Top 691 /*-----------------------------------------------------------------------------------*/ 692 $(function () { 693 var scroll_anchor = $('#scroll-top'), 694 post_nav = $('.inspiry-post-nav'); 695 696 $window.on('scroll', function () { 697 if ($(window).width() > 980) { 698 if ($(this).scrollTop() > 250) { 699 scroll_anchor.fadeIn('fast'); 700 post_nav.fadeIn('fast'); 701 return; 702 } 703 } 704 scroll_anchor.fadeOut('fast'); 705 post_nav.fadeOut('fast'); 706 }); 707 708 scroll_anchor.on('click', function (event) { 709 event.preventDefault(); 710 $('html, body').animate({scrollTop: 0}, 'slow'); 711 }); 712 }); 713 714 /*-----------------------------------------------------------------------------------*/ 715 /* Home page properties pagination 716 /*-----------------------------------------------------------------------------------*/ 717 var homePropertiesSection = $('#home-properties-section'); 718 719 // if homepage 720 if (homePropertiesSection.length && homePropertiesSection.hasClass('ajax-pagination')) { 721 722 $(document).on('click', '#home-properties-section-wrapper .pagination > a', function (e) { 723 e.preventDefault(); 724 var homePropertiesContainer = $('#home-properties-section-wrapper', homePropertiesSection); 725 var paginationLinks = $('.pagination > a', homePropertiesSection); 726 var svgLoader = $('.svg-loader', homePropertiesSection); 727 var currentButton = $(this); 728 svgLoader.slideDown('fast'); 729 homePropertiesContainer.fadeTo('slow', 0.5); 730 paginationLinks.removeClass('current'); 731 // currentButton.addClass('current'); 732 homePropertiesContainer.load( 733 currentButton.attr('href') + ' ' + '#home-properties-section-inner', 734 function (response, status, xhr) { 735 if (status == 'success') { 736 homePropertiesContainer.fadeTo('slow', 1); 737 svgLoader.slideUp('fast'); 738 739 $('html, body').animate({ 740 scrollTop: homePropertiesSection.find('#home-properties-section-wrapper').offset().top-32 741 }, 1000); 742 743 } else { 744 homePropertiesContainer.fadeTo('slow', 1); 745 } 746 } 747 ); 748 }); 749 } 750 751 /*-----------------------------------------------------------------*/ 752 /* Sticky Header 753 /*-----------------------------------------------------------------*/ 754 function classicStickyHeader() { 755 if (window.innerWidth > 979) { 756 const stickyHeader = $('.rh_classic_sticky_header'), 757 getHeaderHeight = $('.header-wrapper').outerHeight(); 758 759 $(document).on('scroll', function () { 760 if ($window.scrollTop() > getHeaderHeight) { 761 stickyHeader.addClass('sticked'); 762 } else { 763 stickyHeader.removeClass('sticked'); 764 } 765 }); 766 } 767 } 768 769 classicStickyHeader(); 770 $(window).on('resize',classicStickyHeader); 771 772 /*-----------------------------------------------------------------*/ 773 /* Property Floor Plans 774 /*-----------------------------------------------------------------*/ 775 $('.floor-plans-accordions .floor-plan:first-child').addClass('current') 776 .children('.floor-plan-content').css('display', 'block').end() 777 .find('i.fas').removeClass('fa-plus').addClass('fa-minus'); 778 779 $('.floor-plan-title').on('click', function () { 780 var parent_accordion = $(this).closest('.floor-plan'); 781 if (parent_accordion.hasClass('current')) { 782 $(this).find('i.fas').removeClass('fa-minus').addClass('fa-plus'); 783 parent_accordion.removeClass('current').children('.floor-plan-content').slideUp(300); 784 } else { 785 $(this).find('i.fas').removeClass('fa-plus').addClass('fa-minus'); 786 parent_accordion.addClass('current').children('.floor-plan-content').slideDown(300); 787 } 788 var siblings = parent_accordion.siblings('.floor-plan'); 789 siblings.find('i.fas').removeClass('fa-minus').addClass('fa-plus'); 790 siblings.removeClass('current').children('.floor-plan-content').slideUp(300); 791 }); 792 793 /*-----------------------------------------------------------------*/ 794 /* Support for Mortgage Calculator - https://wordpress.org/plugins/mortgage-calculator/ 795 /*-----------------------------------------------------------------*/ 796 $('#mc-submit').addClass('real-btn'); 797 798 /*-----------------------------------------------------------------*/ 799 /* Support for Inspiry Memberships 800 /*-----------------------------------------------------------------*/ 801 if ($('#ims-btn-close')) { 802 $('#ims-btn-close').attr('data-dismiss', 'modal'); 803 } 804 805 /*-----------------------------------------------------------------------------------*/ 806 /* Property Ratings 807 /*-----------------------------------------------------------------------------------*/ 808 if (jQuery().barrating) { 809 $('#rate-it').barrating({ 810 theme: 'fontawesome-stars', 811 initialRating: 5, 812 }); 813 } 814 815 /*-----------------------------------------------------------------------------------*/ 816 /* Advance Search Form 817 /*-----------------------------------------------------------------------------------*/ 818 var advanceSearch = $('.rh_classic_advance_search_form .option-bar'); 819 var j = 0; 820 var i = 0; 821 822 advanceSearch.each(function () { 823 if (i < 6) { 824 if ($(this).hasClass('hide-fields')) { 825 j++; 826 } 827 } 828 i++; 829 }); 830 831 var advanceSearchFields = $('.rh_classic_advance_search_form .rh-search-field.option-bar:not(.hide-fields):nth-of-type(-n+' + (j + 5) + ')'); 832 advanceSearchFields.removeClass('small').addClass('large'); 833 834 if ($('.rh_classic_advance_search_form .rh_field_one_others').hasClass('large')) { 835 $('.rh_classic_advance_search_form .rh_field_one_rent').addClass('large').removeClass('small'); 836 } else if ($('.rh_classic_advance_search_form .rh_field_one_rent').hasClass('large')) { 837 $('.rh_classic_advance_search_form .rh_field_one_others').addClass('large').removeClass('small'); 838 } 839 840 if ($('.rh_classic_advance_search_form .rh_field_two_others').hasClass('large')) { 841 $('.rh_classic_advance_search_form .rh_field_two_rent').addClass('large').removeClass('small'); 842 } else if ($('.rh_classic_advance_search_form .rh_field_two_rent').hasClass('large')) { 843 $('.rh_classic_advance_search_form .rh_field_two_others').addClass('large').removeClass('small'); 844 } 845 846 var advanceSearchFieldsCollapsed = $('.rh_classic_advance_search_form .rh-search-field.option-bar.small:not(.hide-fields):nth-of-type(n+' + (j + 6) + ')'); 847 848 if($('.advance-search.widget .more-fields-wrapper').hasClass('collapsed')){ 849 advanceSearchFieldsCollapsed.detach().prependTo('.more-fields-wrapper'); 850 } 851 852 var advanceFieldsSFOI = $('.SFOI__top-fields-container .rh-search-field.option-bar:nth-of-type(n+4)'); 853 advanceFieldsSFOI.detach().prependTo('.SFOI__advanced-fields-container'); 854 855 if ( $('.SFOI__advanced-fields-container').children().length == 0 ) { 856 $('.SFOI__advanced-expander').hide(); 857 }else{ 858 $('.SFOI__advanced-expander').show(); 859 } 860 861 $('.SFOI__form .rh_field_one_rent').insertAfter($('.SFOI__form .rh_field_one_others')); 862 $('.SFOI__form .rh_field_two_rent').insertAfter($('.SFOI__form .rh_field_two_others')); 863 864 $window.on('load', function () { 865 /*-----------------------------------------------------------------------------------*/ 866 /* Compare Listings 867 /*-----------------------------------------------------------------------------------*/ 868 var assignHeights = function () { 869 // Add heights to the first column elements. 870 var columnHeight = -1; 871 var headingHeight = -1; 872 var priceHeight = -1; 873
874 $('.compare-template .span2 .property-thumbnail img').each(function () { 875 if ($(this).attr("complete", "complete")) { 876 headingHeight = headingHeight > $(this).parents('.property-thumbnail').find('.property-title').height() ? headingHeight : $(this).parents('.property-thumbnail').find('.property-title').height(); 877 priceHeight = priceHeight > $(this).parents('.property-thumbnail').find('.property-price').height() ? priceHeight : $(this).parents('.property-thumbnail').find('.property-price').height(); 878 } else { 879 $(this).on('load', function () { 880 headingHeight = headingHeight > $(this).parents('.property-thumbnail').find('.property-title').height() ? headingHeight : $(this).parents('.property-thumbnail').find('.property-title').height(); 881 priceHeight = priceHeight > $(this).parents('.property-thumbnail').find('.property-price').height() ? priceHeight : $(this).parents('.property-thumbnail').find('.property-price').height(); 882 }); 883 } 884 }); 885 886 $('.compare-template .property-thumbnail .property-title').css({ 887 height: headingHeight 888 }); 889 890 $('.compare-template .property-thumbnail .property-price').css({ 891 height: priceHeight 892 }); 893 894 $('.compare-template .span2 .property-thumbnail img').each(function () { 895 if ($(this).attr("complete", "complete")) { 896 columnHeight = columnHeight > $(this).parents('.property-thumbnail').outerHeight() ? columnHeight : $(this).parents('.property-thumbnail').outerHeight(); 897 } else { 898 $(this).on('load', function () { 899 columnHeight = columnHeight > $(this).parents('.property-thumbnail').outerHeight() ? columnHeight : $(this).parents('.property-thumbnail').outerHeight(); 900 }); 901 } 902 }); 903 904 $('.compare-template .span2 .property-thumbnail').css({ 905 height: columnHeight 906 }); 907 }; 908 assignHeights(); 909 910 var screenWidth = $(window).width(); 911 912 $('.compare-template .compare-feature-column').fadeTo(600, 1); 913 $('.compare-template .compare-properties-column').fadeTo(600, 1); 914 915 // Add equal heights to all the rows of all the columns 916 var rowHeight = -1; 917 918 $('.compare-template .span2 p').each(function () { 919 rowHeight = rowHeight > $(this).height() ? rowHeight : $(this).height(); 920 }); 921 922 if (768 <= screenWidth) { 923 $('.compare-template .span2 > p').css({ 924 height: rowHeight 925 }); 926 } 927 928 var imageHeight = -1; 929 $('.home-features-section .span3 .feature-img').each(function () { 930 if ($(this).prop("complete", "complete")) { 931 imageHeight = imageHeight > $(this).outerHeight() ? imageHeight : $(this).outerHeight(); 932 } else { 933 $(this).on('load', function () { 934 imageHeight = imageHeight > $(this).outerHeight() ? imageHeight : $(this).outerHeight(); 935 }); 936 } 937 }); 938 939 $('.home-features-section .span3 .feature-img').css({ 940 height: imageHeight 941 }); 942 }); 943 944 /*-----------------------------------------------------------------------------------*/ 945 /* Fixes - Advance Search form fields disabling issue on hitting browser back button. 946 /*-----------------------------------------------------------------------------------*/ 947 $window.on("pageshow", function (event) { 948 if (event.originalEvent.persisted) { 949 window.location.reload() 950 } 951 }); 952 953 function parallax() { 954 var docHeight = $(document).height(); 955 var scrolled = $window.scrollTop(); 956 957 var parallaxSpeed = (100 - (400 * (scrolled / docHeight))); 958 959 $('.rh_parallax_sfoi').css('background-position', 'center ' + parallaxSpeed + '%'); 960 } 961 962 $window.on('scroll', function () { 963 parallax(); 964 }); 965 }); 966 967 /*-------------------------------------------------------*/ 968 /* Isotope 969 /*------------------------------------------------------*/ 970 function inspiryIsotopeGallery() { 971 var container = $('.isotope'), 972 filters = $('#filter-by'), 973 filterItems = filters.find('li'), 974 filterLinks = filters.find('a'); 975 976 /* to fix floating bugs due to variation in height */ 977 setTimeout(function () { 978 container.isotope({ 979 filter: "*", 980 layoutMode: 'fitRows', 981 itemSelector: '.isotope-item', 982 animationEngine: 'best-available' 983 }); 984 }, 1000); 985 986 filterLinks.on('click', function (event) { 987 var selector = $(this); 988 event.preventDefault(); 989 container.isotope({filter: '.' + selector.data('filter') }); 990 selector.addClass('active'); 991 filterLinks.removeClass('active'); 992 filterItems.removeClass('current-cat'); 993 }); 994 } 995 996 // Code to run on window load. 997 $(window).on('load', function () { 998 if (jQuery().isotope) { 999 inspiryIsotopeGallery(); 1000 } 1001 }); 1002 1003 /** 1004 * Forgot Form 1005 */ 1006 $(document).on('ready', function () { 1007 $('.login-register #forgot-form').slideUp('fast'); 1008 $('.login-register .toggle-forgot-form').on('click', function (event) { 1009 event.preventDefault(); 1010 $('.login-register #forgot-form').slideToggle('fast'); 1011 }); 1012 }); 1013 1014})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.