!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./menu","../keycode","../position","../safe-active-element","../version","../widget"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.autocomplete",{version:"1.13.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,e=this.element[0].nodeName.toLowerCase(),t="textarea"===e,e="input"===e;this.isMultiLine=t||!e&&this._isContentEditable(this.element),this.valueMethod=this.element[t||e?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(e){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var t=o.ui.keyCode;switch(e.keyCode){case t.PAGE_UP:i=!0,this._move("previousPage",e);break;case t.PAGE_DOWN:i=!0,this._move("nextPage",e);break;case t.UP:i=!0,this._keyEvent("previous",e);break;case t.DOWN:i=!0,this._keyEvent("next",e);break;case t.ENTER:this.menu.active&&(i=!0,e.preventDefault(),this.menu.select(e));break;case t.TAB:this.menu.active&&this.menu.select(e);break;case t.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(e),e.preventDefault());break;default:s=!0,this._searchTimeout(e)}}},keypress:function(e){if(i)i=!1,this.isMultiLine&&!this.menu.element.is(":visible")||e.preventDefault();else if(!s){var t=o.ui.keyCode;switch(e.keyCode){case t.PAGE_UP:this._move("previousPage",e);break;case t.PAGE_DOWN:this._move("nextPage",e);break;case t.UP:this._keyEvent("previous",e);break;case t.DOWN:this._keyEvent("next",e)}}},input:function(e){n?(n=!1,e.preventDefault()):this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=o("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().attr({unselectable:"on"}).menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault()},menufocus:function(e,t){var i,s;this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent)&&/^mouse/.test(e.originalEvent.type)?(this.menu.blur(),this.document.one("mousemove",function(){o(e.target).trigger(e.originalEvent)})):(s=t.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:s})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(s.value),(i=t.item.attr("aria-label")||s.value)&&String.prototype.trim.call(i).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(o("<div>").text(i))},100)))},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==o.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=o("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var t=this.menu.element[0];return e.target===this.element[0]||e.target===t||o.contains(t,e.target)},_closeOnClickOutside:function(e){this._isEventTargetInWidget(e)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e=(e=(e=e&&(e.jquery||e.nodeType?o(e):this.document.find(e).eq(0)))&&e[0]?e:this.element.closest(".ui-front, dialog")).length?e:this.document[0].body},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(e,t){t(o.ui.autocomplete.filter(i,e.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(e,t){n.xhr&&n.xhr.abort(),n.xhr=o.ajax({url:s,data:e,dataType:"json",success:function(e){t(e)},error:function(){t([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),t=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;e&&(t||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):!1!==this._trigger("search",t)?this._search(e):void 0},_search:function(e){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")}.bind(this)},__response:function(e){e=e&&this._normalize(e),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:o.map(e,function(e){return"string"==typeof e?{label:e,value:e}:o.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var t=this.menu.element.empty();this._renderMenu(t,e),this.isNewMenu=!0,this.menu.refresh(),t.show(),this._resizeMenu(),t.position(o.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(i,e){var s=this;o.each(e,function(e,t){s._renderItemData(i,t)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(e,t){return o("<li>").append(o("<div>").text(t.label)).appendTo(e)},_move:function(e,t){this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur()):this.menu[e](t):this.search(null,t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(e,t),t.preventDefault())},_isContentEditable:function(e){var t;return!!e.length&&("inherit"===(t=e.prop("contentEditable"))?this._isContentEditable(e.parent()):"true"===t)}}),o.extend(o.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,t){var i=new RegExp(o.ui.autocomplete.escapeRegex(t),"i");return o.grep(e,function(e){return i.test(e.label||e.value||e)})}}),o.widget("ui.autocomplete",o.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(1<e?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(o("<div>").text(t))},100))}}),o.ui.autocomplete});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../ie","../version","../widget"],e):e(jQuery)}(function(o){"use strict";var n=!1;return o(document).on("mouseup",function(){n=!1}),o.widget("ui.mouse",{version:"1.13.3",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.on("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).on("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){var t,i,s;if(!n)return this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),i=1===(this._mouseDownEvent=e).which,s=!("string"!=typeof(t=this).options.cancel||!e.target.nodeName)&&o(e.target).closest(this.options.cancel).length,i&&!s&&this._mouseCapture(e)&&(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?e.preventDefault():(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0)),!0},_mouseMove:function(e){if(this._mouseMoved){if(o.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../keycode","../version","../widget"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.slider",o.ui.mouse,{version:"1.13.3",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,t=this.options,i=this.element.find(".ui-slider-handle"),s=[],a=t.values&&t.values.length||1;for(i.length>a&&(i.slice(a).remove(),i=i.slice(0,a)),e=i.length;e<a;e++)s.push("<span tabindex='0'></span>");this.handles=i.add(o(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){o(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(!0===e.range&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:Array.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=o("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==e.range&&"max"!==e.range||this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,a,n,t,h,l=this,u=this.options;return!u.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var t=Math.abs(i-l.values(e));(t<s||s===t&&(e===l._lastChangedValue||l.values(e)===u.min))&&(s=t,a=o(this),n=e)}),!1!==this._start(e,n))&&(this._mouseSliding=!0,this._handleIndex=n,this._addClass(a,null,"ui-state-active"),a.trigger("focus"),t=a.offset(),h=!o(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-t.left-a.width()/2,top:e.pageY-t.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,n,i),this._animateOff=!0)},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},t=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,t),!1},_mouseStop:function(e){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,e="horizontal"===this.orientation?(t=this.elementSize.width,e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),e=e/t;return(e=1<e?1:e)<0&&(e=0),"vertical"===this.orientation&&(e=1-e),t=this._valueMax()-this._valueMin(),e=this._valueMin()+e*t,this._trimAlignValue(e)},_uiHash:function(e,t,i){var s={handle:this.handles[e],handleIndex:e,value:void 0!==t?t:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==t?t:this.values(e),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(e,t){return this._trigger("start",e,this._uiHash(t))},_slide:function(e,t,i){var s,a=this.value(),n=this.values();this._hasMultipleValues()&&(s=this.values(t?0:1),a=this.values(t),2===this.options.values.length&&!0===this.options.range&&(i=0===t?Math.min(s,i):Math.max(s,i)),n[t]=i),i!==a&&!1!==this._trigger("slide",e,this._uiHash(t,i,n))&&(this._hasMultipleValues()?this.values(t,i):this.value(i))},_stop:function(e,t){this._trigger("stop",e,this._uiHash(t))},_change:function(e,t){this._keySliding||this._mouseSliding||(this._lastChangedValue=t,this._trigger("change",e,this._uiHash(t)))},value:function(e){if(!arguments.length)return this._value();this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0)},values:function(e,t){var i,s,a;if(1<arguments.length)this.options.values[e]=this._trimAlignValue(t),this._refreshValue(),this._change(null,e);else{if(!arguments.length)return this._values();if(!Array.isArray(e))return this._hasMultipleValues()?this._values(e):this.value();for(i=this.options.values,s=e,a=0;a<i.length;a+=1)i[a]=this._trimAlignValue(s[a]),this._change(null,a);this._refreshValue()}},_setOption:function(e,t){var i,s=0;switch("range"===e&&!0===this.options.range&&("min"===t?(this.options.value=this._values(0),this.options.values=null):"max"===t&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(e,t),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(t),this.handles.css("horizontal"===t?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(e){this._super(e),this._toggleClass(null,"ui-state-disabled",!!e)},_value:function(){var e=this.options.value;return this._trimAlignValue(e)},_values:function(e){var t,i;if(arguments.length)return e=this.options.values[e],this._trimAlignValue(e);if(this._hasMultipleValues()){for(t=this.options.values.slice(),i=0;i<t.length;i+=1)t[i]=this._trimAlignValue(t[i]);return t}return[]},_trimAlignValue:function(e){var t,i;return e<=this._valueMin()?this._valueMin():e>=this._valueMax()?this._valueMax():(t=0<this.options.step?this.options.step:1,i=e-(e=(e-this._valueMin())%t),2*Math.abs(e)>=t&&(i+=0<e?t:-t),parseFloat(i.toFixed(5)))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step;(e=Math.round((e-t)/i)*i+t)>this.options.max&&(e-=i),this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return e=null!==this.options.min?Math.max(e,this._precisionOf(this.options.min)):e},_precisionOf:function(e){var e=e.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(e){"vertical"===e&&this.range.css({width:"",left:""}),"horizontal"===e&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var t,i,e,s,a,n=this.options.range,h=this.options,l=this,u=!this._animateOff&&h.animate,r={};this._hasMultipleValues()?this.handles.each(function(e){i=(l.values(e)-l._valueMin())/(l._valueMax()-l._valueMin())*100,r["horizontal"===l.orientation?"left":"bottom"]=i+"%",o(this).stop(1,1)[u?"animate":"css"](r,h.animate),!0===l.options.range&&("horizontal"===l.orientation?(0===e&&l.range.stop(1,1)[u?"animate":"css"]({left:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:h.animate})):(0===e&&l.range.stop(1,1)[u?"animate":"css"]({bottom:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:h.animate}))),t=i}):(e=this.value(),s=this._valueMin(),a=this._valueMax(),i=a!==s?(e-s)/(a-s)*100:0,r["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[u?"animate":"css"](r,h.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:i+"%"},h.animate),"max"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:100-i+"%"},h.animate),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:i+"%"},h.animate),"max"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:100-i+"%"},h.animate))},_handleEvents:{keydown:function(e){var t,i,s,a=o(e.target).data("ui-slider-handle-index");switch(e.keyCode){case o.ui.keyCode.HOME:case o.ui.keyCode.END:case o.ui.keyCode.PAGE_UP:case o.ui.keyCode.PAGE_DOWN:case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(e.preventDefault(),this._keySliding||(this._keySliding=!0,this._addClass(o(e.target),null,"ui-state-active"),!1!==this._start(e,a)))break;return}switch(s=this.options.step,t=i=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case o.ui.keyCode.HOME:i=this._valueMin();break;case o.ui.keyCode.END:i=this._valueMax();break;case o.ui.keyCode.PAGE_UP:i=this._trimAlignValue(t+(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(t-(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:if(t===this._valueMax())return;i=this._trimAlignValue(t+s);break;case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(t===this._valueMin())return;i=this._trimAlignValue(t-s)}this._slide(e,a,i)},keyup:function(e){var t=o(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,t),this._change(e,t),this._removeClass(o(e.target),null,"ui-state-active"))}}})});
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):b("object"==typeof exports?require("jquery"):a.jQuery)}(this,function(a){"use strict";function b(a){var b,c,d,e,f,g,h,i={};for(f=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,",").split(","),h=0,g=f.length;h<g&&(c=f[h],c.search(/^(http|https|ftp):\/\//)===-1&&c.search(":")!==-1);h++)b=c.indexOf(":"),d=c.substring(0,b),e=c.substring(b+1),e||(e=void 0),"string"==typeof e&&(e="true"===e||"false"!==e&&e),"string"==typeof e&&(e=isNaN(e)?e:+e),i[d]=e;return null==d&&null==e?a:i}function c(a){a=""+a;var b,c,d,e=a.split(/\s+/),f="50%",g="50%";for(d=0,b=e.length;d<b;d++)c=e[d],"left"===c?f="0%":"right"===c?f="100%":"top"===c?g="0%":"bottom"===c?g="100%":"center"===c?0===d?f="50%":g="50%":0===d?f=c:g=c;return{x:f,y:g}}function d(b,c){var d=function(){c(this.src)};a('<img src="'+b+'.gif">').on("load",d),a('<img src="'+b+'.jpg">').on("load",d),a('<img src="'+b+'.jpeg">').on("load",d),a('<img src="'+b+'.png">').on("load",d)}function e(c,d,e){if(this.$element=a(c),"string"==typeof d&&(d=b(d)),e?"string"==typeof e&&(e=b(e)):e={},"string"==typeof d)d=d.replace(/\.\w*$/,"");else if("object"==typeof d)for(var f in d)d.hasOwnProperty(f)&&(d[f]=d[f].replace(/\.\w*$/,""));this.settings=a.extend({},g,e),this.path=d;try{this.init()}catch(i){if(i.message!==h)throw i}}var f="vide",g={volume:1,playbackRate:1,muted:!0,loop:!0,autoplay:!0,position:"50% 50%",posterType:"detect",resizing:!0,bgColor:"transparent",className:""},h="Not implemented";e.prototype.init=function(){var b,e,f=this,g=f.path,i=g,j="",k=f.$element,l=f.settings,m=c(l.position),n=l.posterType;e=f.$wrapper=a("<div>").addClass(l.className).css({position:"absolute","z-index":-1,top:0,left:0,bottom:0,right:0,overflow:"hidden","-webkit-background-size":"cover","-moz-background-size":"cover","-o-background-size":"cover","background-size":"cover","background-color":l.bgColor,"background-repeat":"no-repeat","background-position":m.x+" "+m.y}),"object"==typeof g&&(g.poster?i=g.poster:g.mp4?i=g.mp4:g.webm?i=g.webm:g.ogv&&(i=g.ogv)),"detect"===n?d(i,function(a){e.css("background-image","url("+a+")")}):"none"!==n&&e.css("background-image","url("+i+"."+n+")"),"static"===k.css("position")&&k.css("position","relative"),k.prepend(e),"object"==typeof g?(g.mp4&&(j+='<source src="'+g.mp4+'.mp4" type="video/mp4">'),g.webm&&(j+='<source src="'+g.webm+'.webm" type="video/webm">'),g.ogv&&(j+='<source src="'+g.ogv+'.ogv" type="video/ogg">'),b=f.$video=a("<video>"+j+"</video>")):b=f.$video=a('<video><source src="'+g+'.mp4" type="video/mp4"><source src="'+g+'.webm" type="video/webm"><source src="'+g+'.ogv" type="video/ogg"></video>');try{b.prop({autoplay:l.autoplay,loop:l.loop,volume:l.volume,muted:l.muted,defaultMuted:l.muted,playbackRate:l.playbackRate,defaultPlaybackRate:l.playbackRate})}catch(o){throw new Error(h)}b.css({margin:"auto",position:"absolute","z-index":-1,top:m.y,left:m.x,"-webkit-transform":"translate(-"+m.x+", -"+m.y+")","-ms-transform":"translate(-"+m.x+", -"+m.y+")","-moz-transform":"translate(-"+m.x+", -"+m.y+")",transform:"translate(-"+m.x+", -"+m.y+")",visibility:"hidden",opacity:0}).one("canplaythrough.vide",function(){f.resize()}).one("playing.vide",function(){b.css({visibility:"visible",opacity:1}),e.css("background-image","none")}),k.on("resize.vide",function(){l.resizing&&f.resize()}),e.append(b)},e.prototype.getVideoObject=function(){return this.$video[0]},e.prototype.resize=function(){if(this.$video){var a=this.$wrapper,b=this.$video,c=b[0],d=c.videoHeight,e=c.videoWidth,f=a.height(),g=a.width();g/e>f/d?b.css({width:g+2,height:"auto"}):b.css({width:"auto",height:f+2})}},e.prototype.destroy=function(){delete a[f].lookup[this.index],this.$video&&this.$video.off(f),this.$element.off(f).removeData(f),this.$wrapper.remove()},a[f]={lookup:[]},a.fn[f]=function(b,c){var d;return this.each(function(){d=a.data(this,f),d&&d.destroy(),d=new e(this,b,c),d.index=a[f].lookup.push(d)-1,a.data(this,f,d)}),this},a(document).ready(function(){var b=a(window);b.on("resize.vide",function(){for(var b,c=a[f].lookup.length,d=0;d<c;d++)b=a[f].lookup[d],b&&b.settings.resizing&&b.resize()}),b.on("unload.vide",function(){return!1}),a(document).find("[data-vide-bg]").each(function(b,c){var d=a(c),e=d.data("vide-options"),g=d.data("vide-bg");d[f](g,e)})})});
var houzezThemeGlobal={};
(function ($){
'use strict';
var $win=$(window);
var popupSliderLoaded=false;
var houzezStickyTop=0;
var adminBarHeight=0;
var ajaxurl=houzez_vars.admin_url + 'admin-ajax.php';
var compare_url=houzez_vars.compare_url;
var houzez_rtl=houzez_vars.houzez_rtl;
var userID=houzez_vars.user_id;
var wp_is_mobile=houzez_vars.wp_is_mobile;
var houzez_is_splash=houzez_vars.houzez_is_splash;
var prop_detail_nav=houzez_vars.prop_detail_nav;
var search_position=houzez_vars.search_position;
var is_singular_property=houzez_vars.is_singular_property;
var transparent_logo=houzez_vars.transparent_logo;
var is_transparent=houzez_vars.is_transparent;
var is_top_header=houzez_vars.is_top_header;
var houzez_date_language=houzez_vars.houzez_date_language;
var compare_add_icon=houzez_vars.compare_add_icon;
var add_compare_text=houzez_vars.add_compare_text;
var compare_remove_icon=houzez_vars.compare_remove_icon;
var remove_compare_text=houzez_vars.remove_compare_text;
var compare_limit=houzez_vars.compare_limit;
var compare_page_not_found=houzez_vars.compare_page_not_found;
var g_recaptha_version=houzez_vars.g_recaptha_version;
var for_rent=houzez_vars.for_rent;
var listings_not_found=houzez_vars.listings_not_found;
var for_rent_price_slider=houzez_vars.for_rent_price_slider;
var search_price_range_min=parseInt(houzez_vars.search_min_price_range);
var search_price_range_max=parseInt(houzez_vars.search_max_price_range);
var search_price_range_min_rent=parseInt(
houzez_vars.search_min_price_range_for_rent
);
var search_price_range_max_rent=parseInt(
houzez_vars.search_max_price_range_for_rent
);
var get_min_price=parseInt(houzez_vars.get_min_price);
var get_max_price=parseInt(houzez_vars.get_max_price);
var currency_position=houzez_vars.currency_position;
var decimals=houzez_vars.decimals;
var decimal_point_separator=houzez_vars.decimal_point_separator;
var thousands_separator=houzez_vars.thousands_separator;
var currency_symb=houzez_vars.currency_symbol;
var is_halfmap=parseInt(houzez_vars.is_halfmap);
var houzez_reCaptcha=parseInt(houzez_vars.houzez_reCaptcha);
var prev_text=houzez_vars.prev_text;
var next_text=houzez_vars.next_text;
var listing_pagination=houzez_vars.listing_pagination;
var keyword_search_field=houzez_vars.keyword_search_field;
var keyword_autocomplete=houzez_vars.keyword_autocomplete;
var autosearch_text=houzez_vars.autosearch_text;
var login_redirect_type=houzez_vars.redirect_type;
var login_redirect=houzez_vars.login_redirect;
var login_loading=houzez_vars.login_loading;
var paypal_connecting=houzez_vars.paypal_connecting;
var processing_text=houzez_vars.processing_text;
var is_edit_property=houzez_vars.is_edit_property;
var property_gallery_popup_type=houzez_vars.property_gallery_popup_type;
var simple_logo=houzez_vars.simple_logo;
var retina_logo=houzez_vars.retina_logo;
var mobile_logo=houzez_vars.mobile_logo;
var retina_logo_mobile=houzez_vars.retina_logo_mobile;
var retina_logo_mobile_splash=houzez_vars.retina_logo_mobile_splash;
var custom_logo_splash=houzez_vars.custom_logo_splash;
var retina_logo_splash=houzez_vars.retina_logo_splash;
var calDoughnutChart;
var is_listing_gallery_slider=false;
var top_banner_wrap_height=0;
var top_banner_wrap=$('.top-banner-wrap ');
var header_area=$('.header-main-wrap');
var advanced_search_nav=$('.advanced-search-nav');
var desktop_header_search_enabled=advanced_search_nav.data('sticky');
var elementor_location_header=$('.elementor-location-header');
var header_area_height=header_area.innerHeight();
var elementor_location_header_height =
elementor_location_header.innerHeight();
var advanced_search_nav_height=advanced_search_nav.innerHeight();
var header_nav=$('#header-section');
var houzez_nav_sticky_height=header_nav.innerHeight();
var only_nav_sticky=header_nav.data('sticky');
houzezThemeGlobal.$body=$('body');
houzezThemeGlobal.$document=$(document);
houzezThemeGlobal.$window=$(window);
houzezThemeGlobal.houzezEleAddAction=function (name, callback){
houzezThemeGlobal.$window.on('elementor/frontend/init', function (){
if(!elementorFrontend.isEditMode()){
return;
}
elementorFrontend.hooks.addAction(name, callback);
});
};
var houzez_is_mobile =
/ipad|iphone|ipod|android|blackberry|webos|iemobile|windows phone/i.test(navigator.userAgent.toLowerCase()
);
if(prop_detail_nav=='yes'&&is_singular_property){
only_nav_sticky=0;
}
if(elementor_location_header_height==null){
elementor_location_header_height=0;
}
if(header_area_height==null){
header_area_height=0;
}
if(advanced_search_nav_height==null){
advanced_search_nav_height=0;
}
if(houzez_rtl=='yes'){
houzez_rtl=true;
}else{
houzez_rtl=false;
}
if(only_nav_sticky===1){
houzezStickyTop=houzez_nav_sticky_height;
if(!wp_is_mobile){
desktop_header_search_enabled=0;
}}
var make_search_sticky_position =
header_area_height + advanced_search_nav_height;
var searchStickyPlus=100;
var search_under_navigation=true;
if(wp_is_mobile){
make_search_sticky_position=make_search_sticky_position + 40;
}
$(document).ready(function (){
top_banner_wrap_height=top_banner_wrap.innerHeight();
if(search_position=='under_banner'){
make_search_sticky_position =
header_area_height + top_banner_wrap_height;
searchStickyPlus=0;
if(wp_is_mobile){
searchStickyPlus=60;
}
if(is_transparent){
searchStickyPlus=60;
}
search_under_navigation=false;
}
adminBarHeight=$('#wpadminbar').innerHeight();
if(adminBarHeight!=null){
houzezStickyTop=houzezStickyTop + adminBarHeight;
}});
function HouzezDebounce(func, delay){
let debounceTimer;
return function (){
const context=this;
const args=arguments;
clearTimeout(debounceTimer);
debounceTimer=setTimeout(()=> func.apply(context, args), delay);
};}
function parseBool(str){
if(str=='true'){
return true;
}else{
return false;
}}
$(document).ready(function (){
if($('#video-background').length > 0){
$('#video-background').data('vide').getVideoObject().play();
}});
function adjustMegaMenu(
megaMenuSelector,
containerSelector,
fullwidthClass,
customWidthClass,
customWidthPx
){
jQuery(megaMenuSelector).each(function (){
var $megamenu=jQuery(this);
var windowWidth=jQuery(window).width();
var isRTL=jQuery('html').attr('dir')==='rtl';
var $fullwidthContainer=$megamenu.closest(fullwidthClass);
var $customWidthContainer=$megamenu.closest(customWidthClass);
var $container=$megamenu.closest(containerSelector);
var $navItem=$megamenu.closest('.nav-item');
$megamenu.css({ left: '', right: '', width: '' });
if($fullwidthContainer.length > 0){
$megamenu.css('width', '100vw');
var offset=$megamenu.offset();
if(offset&&typeof offset.left==='number'){
var position=offset.left * -1;
if(isRTL){
$megamenu.css('right', (-position) + 'px');
}else{
$megamenu.css('left', position + 'px');
}}else{
console.warn('Mega menu offset not found for fullwidth container.');
}}
else if($customWidthContainer.length > 0){
$megamenu.css('width', customWidthPx + 'px');
if($navItem.length===0){
console.warn('No .nav-item found for custom width calculation.');
return;
}
var menuItemOffset=$navItem.offset().left;
var parentOffset=$megamenu.parent().offset();
parentOffset=parentOffset ? parentOffset.left:0;
var position=menuItemOffset - parentOffset;
if(menuItemOffset + customWidthPx > windowWidth){
position -=(customWidthPx - $navItem.width());
}
if(isRTL){
$megamenu.css('right', (-position) + 'px');
}else{
$megamenu.css('left', position + 'px');
}}
else if($container.length > 0){
var containerWidth=$container.width();
$megamenu.css('width', containerWidth);
var containerOffsetObj=$container.offset();
var navItemOffsetObj=$navItem.offset();
if(containerOffsetObj&&navItemOffsetObj){
var containerOffset=containerOffsetObj.left;
var megamenuOffset=navItemOffsetObj.left;
var position=containerOffset - megamenuOffset;
if(isRTL){
$megamenu.css('right', (-position) + 'px');
}else{
$megamenu.css('left', position + 'px');
}}else{
console.warn('Could not determine offsets for container or nav-item.');
}}else{
console.warn('No container found for mega menu adjustment.');
}});
}
function setMenuFullWidthEle(){
if($('#houzez_toggle').length > 0){
var isRTL=$('html').attr('dir')==='rtl';
var leftDistance;
leftDistance=$('#houzez_toggle').offset().left;
$('.houzez-nav-mobile-menu-fullwidth .main-mobile-nav').css('left',
'calc(50vw - ' + leftDistance + 'px)'
);
console.log('Distance from the left:', leftDistance);
}}
$(window).on('load', function (){
adjustMegaMenu(
'.houzez-elementor-menu .dropdown-menu.megamenu',
'.e-con-inner',
'.menu-item-design-full-width',
'.menu-item-design-custom-size',
200
);
setTimeout(setMenuFullWidthEle, 500);
});
$(window).resize(function (){
adjustMegaMenu(
'.houzez-elementor-menu .dropdown-menu.megamenu',
'.e-con-inner',
'.menu-item-design-full-width',
'.menu-item-design-custom-size',
200
);
setMenuFullWidthEle();
});
if($('.hs-gallery-v3-wrap').length > 0 ||
$('.hs-gallery-v2-wrap').length > 0
){
function adjustTabContentHeight(){
var galleryHeight=$(
'.hs-property-gallery-wrap #pills-gallery'
).height();
$('.tab-content #pills-map').css('height', galleryHeight);
$('.tab-content .houzez-top-area-video').css('height',
galleryHeight
);
$('.tab-content .houzez-360-virtual-tour').css('height',
galleryHeight
);
$('.tab-content #pills-street-view').css('height', galleryHeight);
}
function checkAndAdjustLayout(){
adjustTabContentHeight();
}
$(window).on('load resize', function (){
checkAndAdjustLayout();
});
checkAndAdjustLayout();
}
function houzez_lazyload(){
document.addEventListener('DOMContentLoaded', function (){
var lazyImages=[].slice.call(document.querySelectorAll('.houzez-lazyload')
);
if('IntersectionObserver' in window){
let lazyImageObserver=new IntersectionObserver(function (
entries,
observer
){
entries.forEach(function (entry){
if(entry.isIntersecting){
let lazyImage=entry.target;
lazyImage.src=lazyImage.dataset.src;
if(lazyImage.dataset.srcset){
lazyImage.srcset=lazyImage.dataset.srcset;
}
lazyImage.classList.remove('houzez-lazyload');
lazyImageObserver.unobserve(lazyImage);
}});
});
lazyImages.forEach(function (lazyImage){
lazyImageObserver.observe(lazyImage);
});
}else{
}});
}
houzez_lazyload();
function houzez_lazyload_for_ajax(){
var lazyImages=[].slice.call(document.querySelectorAll('.houzez-lazyload')
);
if('IntersectionObserver' in window){
let lazyImageObserver=new IntersectionObserver(function (
entries,
observer
){
entries.forEach(function (entry){
if(entry.isIntersecting){
let lazyImage=entry.target;
lazyImage.src=lazyImage.dataset.src;
if(lazyImage.dataset.srcset){
lazyImage.srcset=lazyImage.dataset.srcset;
}
lazyImage.classList.remove('houzez-lazyload');
lazyImageObserver.unobserve(lazyImage);
}});
});
lazyImages.forEach(function (lazyImage){
lazyImageObserver.observe(lazyImage);
});
}else{
}}
houzez_lazyload_for_ajax();
if(retina_logo!=='' ||
retina_logo_splash!='' ||
retina_logo_mobile!='' ||
retina_logo_mobile_splash!=''
){
if(window.devicePixelRatio==2){
if(retina_logo!=''){
$('.logo-desktop img').attr('src', retina_logo);
}
if(retina_logo_splash!=''){
$('.logo-splash img').attr('src', retina_logo_splash);
}
if(retina_logo_mobile!=''){
$('.logo-mobile img').attr('src', retina_logo_mobile);
}}
}
$('.all-reviews').on('click', function (e){
$('.hz-review-tab').trigger('click');
});
$(function (){
var scroll_anchor=$('#scroll-top');
$(window).on('scroll', function (){
if($(this).scrollTop() > 300){
scroll_anchor.fadeIn('fast').css('display', 'block');
return;
}
scroll_anchor.fadeOut('fast');
});
scroll_anchor.on('click', function (event){
event.preventDefault();
$('html, body').animate({ scrollTop: 0 }, 'slow');
});
});
/*$.each([
'frontend/element_ready/houzez_properties_tabs.default',
], function(index, value){
houzezThemeGlobal.houzezEleAddAction(value, function(){ alert('1111');
houzezThemeGlobal.houzezProductsTabs();
});
});*/
var houzezProductsTabs=function (){
var alreadyProcessed=false;
$('.houzez-products-tabs-js').each(function (){
var $this=$(this);
var $html_container=$this.find('.houzez-tab-content');
var $products_cache=[];
$this.find('ul.property-nav-tabs li').on('click', function (e){
e.preventDefault();
var $this=$(this);
var settings=$this.data('json');
var data_index=$this.index();
if(alreadyProcessed||$this.find('a').hasClass('active')){
return;
}
alreadyProcessed=true;
if($products_cache[data_index]){
setTimeout(function (){
$html_container.html($products_cache[data_index].html);
houzez_init_add_favorite(ajaxurl, userID);
houzez_init_remove_favorite(ajaxurl, userID);
houzez_listing_lightbox(
ajaxurl,
processing_text,
houzez_rtl,
userID
);
houzez_grid_image_gallery();
houzez_grid_call_to_action();
compare_for_ajax();
$('[data-toggle="tooltip"]').tooltip();
alreadyProcessed=false;
}, 300);
return;
}
$.ajax({
url: ajaxurl,
data: {
action: 'houzez_get_properties_tab_content',
settings: settings,
},
dataType: 'json',
method: 'POST',
beforeSend: function (){
$html_container
.empty()
.append('' +
'<div id="houzez-map-loading">' +
'<div class="mapPlaceholder">' +
'<div class="loader-ripple spinner">' +
'<div class="bounce1"></div>' +
'<div class="bounce2"></div>' +
'<div class="bounce3"></div>' +
'</div>' +
'</div>' +
'</div>'
);
},
success: function (data){
$products_cache[data_index]=data;
$html_container.html(data.html);
houzez_init_add_favorite(ajaxurl, userID);
houzez_init_remove_favorite(ajaxurl, userID);
houzez_listing_lightbox(
ajaxurl,
processing_text,
houzez_rtl,
userID
);
houzez_grid_image_gallery();
houzez_grid_call_to_action();
compare_for_ajax();
$('[data-toggle="tooltip"]').tooltip();
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
alreadyProcessed=false;
},
});
});
});
};
houzezProductsTabs();
if(window.devicePixelRatio==2){
if(transparent_logo){
if(retina_logo_splash!=''){
custom_logo_splash=retina_logo_splash;
}
if(retina_logo!=''){
simple_logo=retina_logo;
}}
}
if(only_nav_sticky&&!wp_is_mobile){
houzez_sticky_nav();
if($('.compare-table').length > 0){
var compare_top_margin=advanced_search_nav.outerHeight();
$('.compare-table thead th').css('top', compare_top_margin + 25);
}}
function houzez_sticky_nav(){
$(window).scroll(function (){
var scroll=$(window).scrollTop();
var admin_nav=$('#wpadminbar').height();
var top_banner_margin=0;
var thisHeight=header_nav.outerHeight();
top_banner_margin=thisHeight;
if(is_top_header!=0){
var top_bar_wrap=$('.top-bar-wrap').height();
top_banner_margin=top_banner_margin + top_bar_wrap;
}
if(only_nav_sticky===0){
return;
}
if(transparent_logo){
$('.logo-splash img').attr('src', simple_logo);
}
if(admin_nav=='null'){
admin_nav=0;
}
if(scroll > header_area_height){
header_nav.addClass('sticky-nav-area');
header_nav.css('top', admin_nav);
if(transparent_logo){
header_area.removeClass('header-transparent-wrap');
$('.top-banner-wrap').css('margin-top',
'-' + top_banner_margin + 'px'
);
$('body.houzez-header-elementor .content-wrap').css('margin-top',
'-' + top_banner_margin + 'px'
);
$('#main-wrap > div.elementor').css('margin-top',
'-' + top_banner_margin + 'px'
);
}
if(scroll >=header_area_height + 20){
header_nav.addClass('houzez-in-view');
$('#main-wrap').css('margin-top', thisHeight);
}}else{
header_nav.removeClass('sticky-nav-area');
header_nav.removeAttr('style');
if(transparent_logo){
header_area.addClass('header-transparent-wrap');
$('.top-banner-wrap').css('margin-top', 0);
$('body.houzez-header-elementor .content-wrap').css('margin-top',
0
);
$('#main-wrap > div.elementor').css('margin-top', 0);
$('.logo-splash img').attr('src', custom_logo_splash);
}
if(scroll <=header_area_height + 20){
header_nav.removeClass('houzez-in-view');
}
$('#main-wrap').css('margin-top', 0);
}});
}
if(desktop_header_search_enabled){
houzez_sticky_search();
}
function houzez_sticky_search(){
$(window).scroll(function (){
var scroll=$(window).scrollTop();
var admin_nav=$('#wpadminbar').height();
var thisHeight=advanced_search_nav.outerHeight();
var hidden_data=advanced_search_nav.data('hidden');
if(admin_nav=='null'){
admin_nav=0;
}
if(scroll >=make_search_sticky_position){
advanced_search_nav.addClass('sticky-search-area');
if(hidden_data){
advanced_search_nav.removeClass('search-hidden');
}
if(!wp_is_mobile){
advanced_search_nav.css('top', admin_nav);
}
if(scroll >=make_search_sticky_position + searchStickyPlus){
advanced_search_nav.addClass('houzez-in-view');
if(!hidden_data){
$('#main-wrap').css('padding-top', thisHeight);
}}
}else{
advanced_search_nav.removeClass('sticky-search-area');
advanced_search_nav.removeAttr('style');
if(scroll <=make_search_sticky_position + 20){
advanced_search_nav.removeClass('houzez-in-view');
}
if(hidden_data){
advanced_search_nav.addClass('search-hidden');
}
if(!hidden_data){
$('#main-wrap').css('padding-top', 0);
}}
});
}
function houzez_mobile_sticky_nav(){
$(window).scroll(function (){
var scroll=$(window).scrollTop();
var admin_nav=0; //$('#wpadminbar').height();
var top_banner_margin=0;
var thisHeight=header_mobile.outerHeight();
top_banner_margin=thisHeight;
if(is_top_header){
var top_bar_wrap=$('.top-bar-wrap').height();
top_banner_margin=top_banner_margin + top_bar_wrap;
}
if(mobile_sticky_nav===0){
return;
}
if(admin_nav=='null'){
admin_nav=0;
}
if(scroll > header_area_height){
header_mobile.addClass('sticky-nav-area');
if(scroll >=header_area_height + 20){
header_mobile.addClass('houzez-in-view');
$('#main-wrap').css('margin-top', thisHeight);
}}else{
header_mobile.removeClass('sticky-nav-area');
header_mobile.removeAttr('style');
if(scroll <=header_area_height + 20){
header_mobile.removeClass('houzez-in-view');
}
$('#main-wrap').css('margin-top', 0);
}});
}
var addCommas=function (nStr){
nStr +='';
var x=nStr.split('.');
var x1=x[0];
var x2=x.length > 1 ? '.' + x[1]:'';
var rgx=/(\d+)(\d{3})/;
while (rgx.test(x1)){
x1=x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
};
var thousandSeparator=(n)=> {
if(typeof n==='number'){
n +='';
var x=n.split('.');
var x1=x[0];
var x2=x.length > 1 ? '.' + x[1]:'';
var rgx=/(\d+)(\d{3})/;
while (rgx.test(x1)){
x1=x1.replace(rgx, '$1' + thousands_separator + '$2');
}
return x1 + x2;
}else{
return n;
}};
function number_format(number){
var decimals, dec_point, thousands_sep;
dec_point=decimal_point_separator;
thousands_sep=thousands_separator;
var i, j, kw, kd, km;
if(isNaN((decimals=Math.abs(decimals)))){
decimals=2;
}
dec_point=dec_point||',';
thousands_sep=thousands_sep||'.';
i=parseInt((number=(+number||0).toFixed(decimals))) + '';
j=(j=i.length) > 3 ? j % 3:0;
km=j ? i.substr(0, j) + thousands_sep:'';
kw=i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousands_sep);
kd=decimals
? dec_point +
Math.abs(number - i)
.toFixed(decimals)
.replace(/-/, 0)
.slice(2)
: '';
return km + kw + kd;
}
if($('#houzez-calculator-form').length > 0){
$('#houzez-calculator-form input').on('input', ()=> {
mortgage_calucaltion_section();
});
mortgage_calucaltion_section();
}
function calculateMonthlyPayment(
principal,
annualInterestRate,
loanTermInYears
){
const monthlyInterestRate=annualInterestRate / 12 / 100;
const numberOfMonths=loanTermInYears * 12;
if(monthlyInterestRate===0){
return principal / numberOfMonths;
}
return (
(principal *
(monthlyInterestRate *
Math.pow(1 + monthlyInterestRate, numberOfMonths))) /
(Math.pow(1 + monthlyInterestRate, numberOfMonths) - 1)
);
}
function parseInput(selector){
const rawValue=$(selector).val();
if(!rawValue) return 0;
const cleanedValue=rawValue.replace(/[^0-9.]/g, '');
const parsedValue=parseFloat(cleanedValue);
return isNaN(parsedValue) ? 0:parsedValue;
}
function mortgage_calucaltion_section(){
const homePrice=parseInput('#homePrice');
const downPaymentPercentage=parseInput('#downPaymentPercentage');
const annualInterestRate=parseInput('#annualInterestRate');
const loanTermInYears=parseInput('#loanTermInYears');
const annualPropertyTaxRate=parseInput('#annualPropertyTaxRate');
const annualHomeInsurance=parseInput('#annualHomeInsurance');
const monthlyHOAFees=parseInput('#monthlyHOAFees');
const pmi=parseInput('#pmi');
const downPayment=homePrice * (downPaymentPercentage / 100);
const principal=homePrice - downPayment;
const monthlyPayment=calculateMonthlyPayment(
principal,
annualInterestRate,
loanTermInYears
);
const monthlyPropertyTax =
(homePrice * (annualPropertyTaxRate / 100)) / 12;
const monthlyHomeInsurance=annualHomeInsurance / 12;
const pmiRequired=downPayment / homePrice < 0.2;
const monthlyPMI=pmiRequired ? (principal * (pmi / 100)) / 12:0;
const totalMonthlyPayment =
monthlyPayment +
monthlyPropertyTax +
monthlyHomeInsurance +
monthlyHOAFees +
monthlyPMI;
const loanAmount=homePrice - downPayment;
const formattedDownPayment=number_format(downPayment);
const formattedLoanAmount=number_format(loanAmount);
const formattedMonthlyPayment=number_format(monthlyPayment);
const formattedPropertyTax=number_format(monthlyPropertyTax);
const formattedHomeInsurance=number_format(monthlyHomeInsurance);
const formattedPMI=pmiRequired ? number_format(monthlyPMI):'';
const formattedHOAFees=number_format(monthlyHOAFees);
const formattedTotalMonthlyPayment=number_format(totalMonthlyPayment);
$('#downPaymentResult').html(currencyFormate(formattedDownPayment));
$('#loadAmountResult').html(currencyFormate(formattedLoanAmount));
$('#monthlyMortgagePaymentResult').html(currencyFormate(formattedMonthlyPayment)
);
$('#monthlyPropertyTaxResult').html(currencyFormate(formattedPropertyTax)
);
$('#monthlyHomeInsuranceResult').html(currencyFormate(formattedHomeInsurance)
);
if(pmiRequired){
$('.rslt-pmi').show();
$('#monthlyPMIResult').html(currencyFormate(formattedPMI));
}else{
$('.rslt-pmi').hide();
}
$('#monthlyHOAResult').html(currencyFormate(formattedHOAFees));
$('#m_monthly_val').html(currencyFormate(formattedTotalMonthlyPayment));
const chartData=[
{
label: 'Monthly Mortgage Payment',
value: monthlyPayment,
color: '#ff6384',
},
{
label: 'Property Tax',
value: monthlyPropertyTax,
color: '#36a2eb',
},
{
label: 'Home Insurance',
value: monthlyHomeInsurance,
color: '#ffce56',
},
{ label: 'HOA', value: monthlyHOAFees, color: '#c2d500' },
];
if(pmiRequired){
chartData.push({
label: 'PMI',
value: monthlyPMI,
color: '#4bc0c0',
});
}
updateChart(chartData);
}
const inputElements=document.querySelectorAll('#calculator-form input');
inputElements.forEach((input)=> {
input.addEventListener('input', ()=> {
formatInputValue(input);
updateResults();
});
});
function updateChart(chartData){
const ctx=$('#mortgage-calculator-chart')[0].getContext('2d');
if(window.myChart){
window.myChart.destroy();
}
window.myChart=new Chart(ctx, {
type: 'doughnut',
data: {
datasets: [
{
data: chartData.map((item)=> item.value),
backgroundColor: chartData.map((item)=> item.color),
},
],
},
options: {
cutoutPercentage: 85,
responsive: false,
tooltips: false,
},
});
}
function currencyFormate(price_value){
var value;
if(currency_position==''||currency_symb==''){
return price_value;
}
value =
'after'===currency_position
? price_value + '' + currency_symb
: currency_symb + '' + price_value;
return value;
}
houzez_listing_lightbox(ajaxurl, processing_text, houzez_rtl, userID);
$(window).on('load', function (){
houzez_grid_image_gallery();
houzez_grid_call_to_action();
});
if($('#stats-property-cities').length > 0){
var chartData=$('#stats-property-cities').data('chart');
var ctx=document
.getElementById('stats-property-cities')
.getContext('2d');
var myDoughnutChart=new Chart(ctx, {
type: 'doughnut',
data: {
datasets: [
{
data: chartData,
backgroundColor: [
'rgba(255, 99, 132, 0.5)',
'rgba(54, 162, 235, 0.5)',
'rgba(255, 206, 86, 0.5)',
'rgba(75, 192, 192, 0.5)',
],
borderColor: [
'rgba(255 ,99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
],
borderWidth: 1,
},
],
},
options: {
cutoutPercentage: 60,
responsive: false,
tooltips: false,
},
});
}
if($('#stats-property-status').length > 0){
var chartData=$('#stats-property-status').data('chart');
var ctx=document
.getElementById('stats-property-status')
.getContext('2d');
var myDoughnutChart=new Chart(ctx, {
type: 'doughnut',
data: {
datasets: [
{
data: chartData,
backgroundColor: [
'rgba(255, 99, 132, 0.5)',
'rgba(54, 162, 235, 0.5)',
'rgba(255, 206, 86, 0.5)',
'rgba(75, 192, 192, 0.5)',
],
borderColor: [
'rgba(255 ,99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
],
borderWidth: 1,
},
],
},
options: {
cutoutPercentage: 60,
responsive: false,
tooltips: false,
},
});
}
$('.houzez-realtor-stats-js[id^="stats-property-"]').each(function (){
var $div=$(this);
var token=$div.data('token');
var statsID='stats-property-' + token;
if($('#' + statsID).length > 0){
var chartData=$('#' + statsID).data('chart');
var ctx=document.getElementById(statsID).getContext('2d');
var myDoughnutChart=new Chart(ctx, {
type: 'doughnut',
data: {
datasets: [
{
data: chartData,
backgroundColor: [
'rgba(255, 99, 132, 0.5)',
'rgba(54, 162, 235, 0.5)',
'rgba(255, 206, 86, 0.5)',
'rgba(75, 192, 192, 0.5)',
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
],
borderWidth: 1,
},
],
},
options: {
cutoutPercentage: 60,
responsive: false,
tooltips: false,
},
});
}});
if($('#stats-property-types').length > 0){
var chartData=$('#stats-property-types').data('chart');
var ctx=document
.getElementById('stats-property-types')
.getContext('2d');
var myDoughnutChart=new Chart(ctx, {
type: 'doughnut',
data: {
datasets: [
{
data: chartData,
backgroundColor: [
'rgba(255, 99, 132, 0.5)',
'rgba(54, 162, 235, 0.5)',
'rgba(255, 206, 86, 0.5)',
'rgba(75, 192, 192, 0.5)',
],
borderColor: [
'rgba(255 ,99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
],
borderWidth: 1,
},
],
},
options: {
cutoutPercentage: 60,
responsive: false,
tooltips: false,
},
});
}
if($('#stats-property-types').length > 0){
var chartData=$('#stats-property-types').data('chart');
var ctx=document
.getElementById('stats-property-types')
.getContext('2d');
var myDoughnutChart=new Chart(ctx, {
type: 'doughnut',
data: {
datasets: [
{
data: chartData,
backgroundColor: [
'rgba(255, 99, 132, 0.5)',
'rgba(54, 162, 235, 0.5)',
'rgba(255, 206, 86, 0.5)',
'rgba(75, 192, 192, 0.5)',
],
borderColor: [
'rgba(255 ,99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
],
borderWidth: 1,
},
],
},
options: {
cutoutPercentage: 60,
responsive: false,
tooltips: false,
},
});
}
var houzez_login_modal=function (){
jQuery('#login-register-form').modal('show');
jQuery('.login-form-tab').addClass('active show');
jQuery('.modal-toggle-1.nav-link').addClass('active');
};
$('#houzez-login-btn').on('click', function (e){
e.preventDefault();
var currnt=$(this);
houzez_login(currnt);
});
$('#houzez-register-btn').on('click', function (e){
e.preventDefault();
var currnt=$(this);
houzez_register(currnt);
});
$('#houzez-create-account-btn').on('click', function (e){
e.preventDefault();
var currnt=$(this);
houzez_social_create_account(currnt);
});
var houzez_login=function (currnt){
var $form=currnt.parents('form');
var $messages=$('#hz-login-messages');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: $form.serialize(),
beforeSend: function (){
currnt.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
currnt.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
window.location.replace(response.redirect_to);
}else{
$messages
.empty()
.append('<div class="alert alert-danger" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
}
currnt.find('.houzez-loader-js').removeClass('loader-show');
if(houzez_reCaptcha==1){
$form.find('.g-recaptcha-response').remove();
if(g_recaptha_version=='v3'){
houzezReCaptchaLoad();
}else{
houzezReCaptchaReset();
}}
},
error: function (xhr, status, error){
console.log('Error Status: ' + status);
console.log('Error Thrown: ' + error);
console.log('Response Text: ' + xhr.responseText);
},
});
};
var houzez_register=function (currnt){
var $form=currnt.parents('form');
var $messages=$('#hz-register-messages');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: $form.serialize(),
beforeSend: function (){
currnt.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
currnt.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
setTimeout(function (){
$('a[href="#login-form-tab"]').tab('show');
}, 2000);
}else{
$messages
.empty()
.append('<div class="alert alert-danger" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
}
currnt.find('.houzez-loader-js').removeClass('loader-show');
if(houzez_reCaptcha==1){
$form.find('.g-recaptcha-response').remove();
if(g_recaptha_version=='v3'){
houzezReCaptchaLoad();
}else{
houzezReCaptchaReset();
}}
},
error: function (xhr, status, error){
console.log('Error Status: ' + status);
console.log('Error Thrown: ' + error);
console.log('Response Text: ' + xhr.responseText);
},
});
};
var houzez_social_create_account=function (currnt){
var $form=currnt.parents('form');
var $messages=$('#hz-create-messages');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: $form.serialize(),
beforeSend: function (){
currnt.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
currnt.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
window.location.replace(response.redirect_to);
}else{
$messages
.empty()
.append('<div class="alert alert-danger" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
}
currnt.find('.houzez-loader-js').removeClass('loader-show');
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
$('#houzez-link-account').on('click', function (e){
e.preventDefault();
var currnt=$(this);
houzez_link_account(currnt);
});
var houzez_link_account=function (currnt){
var $form=currnt.parents('form');
var $messages=$('#hz-link-messages');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: $form.serialize(),
beforeSend: function (){
currnt.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
currnt.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
window.location.replace(response.redirect_to);
}else{
$messages
.empty()
.append('<div class="alert alert-danger" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
}
currnt.find('.houzez-loader-js').removeClass('loader-show');
if(houzez_reCaptcha==1){
$form.find('.g-recaptcha-response').remove();
if(g_recaptha_version=='v3'){
houzezReCaptchaLoad();
}else{
houzezReCaptchaReset();
}}
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
function houzez_social_login_panel(){
var $mainStepWrap=$('.main-step-wrap');
var $newAccountWrap=$('.new-account-wrap');
var $linkAccountWrap=$('.link-account-wrap');
function toggleVisibility(hide1, hide2, show){
hide1.hide();
hide2.hide();
show.show();
}
$(document).on('click', '.btn-link-account', function (event){
event.preventDefault();
toggleVisibility($mainStepWrap, $newAccountWrap, $linkAccountWrap);
});
$(document).on('click', '.btn-create-account', function (event){
event.preventDefault();
toggleVisibility($mainStepWrap, $linkAccountWrap, $newAccountWrap);
});
$(document).on('click', '.hz-fb-cancel', function (event){
event.preventDefault();
toggleVisibility($linkAccountWrap, $newAccountWrap, $mainStepWrap);
});
}
houzez_social_login_panel();
$('#houzez_forgetpass').on('click', function (){
var user_login=$('#user_login_forgot').val(),
security=$('#fave_resetpassword_security').val();
var $this=$(this);
var $messages=$('#reset_pass_msg');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: {
action: 'houzez_reset_password',
user_login: user_login,
security: security,
},
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
}else{
$messages
.empty()
.append('<div class="alert alert-danger" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
});
if($('#houzez_reset_password').length > 0){
$('#houzez_reset_password').click(function (e){
e.preventDefault();
var $this=$(this);
var rg_login=$('input[name="rp_login"]').val();
var rp_key=$('input[name="rp_key"]').val();
var pass1=$('input[name="pass1"]').val();
var pass2=$('input[name="pass2"]').val();
var security=$('input[name="fave_resetpassword_security"]').val();
var $messages=$('#reset_pass_msg_2');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: {
action: 'houzez_reset_password_2',
rq_login: rg_login,
password: pass1,
confirm_pass: pass2,
rp_key: rp_key,
security: security,
},
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
jQuery('#oldpass, #newpass, #confirmpass').val('');
}else{
$messages
.empty()
.append('<div class="alert alert-danger" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.msg +
'</div>'
);
}},
error: function (errorThrown){},
});
});
}
$('.hz-facebook-login').on('click', function (){
var current=$(this);
houzez_login_via_facebook(current);
});
var houzez_login_via_facebook=function (current){
var $messages=$('.hz-social-messages');
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
action: 'houzez_facebook_login_oauth',
},
beforeSend: function (){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
login_loading +
'</div>'
);
current.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
current.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
window.location.replace(response.url);
}else{
$messages
.empty()
.append('<div class="alert alert-danger" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
response.message +
'</div>'
);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
$('.hz-google-login').on('click', function (){
var current=$(this);
houzez_login_via_google(current);
});
var houzez_login_via_google=function (current){
var $form=current.parents('form');
var $messages=$('#hz-login-messages');
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_google_login_oauth',
},
beforeSend: function (){
$messages
.empty()
.append('<div class="alert alert-success" role="alert"><i class="houzez-icon icon-check-circle-1 mr-1"></i>' +
login_loading +
'</div>'
);
current.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
current.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (data){
window.location.replace(data);
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
var properties_module_section=$('#properties_module_section');
if(properties_module_section.length > 0){
var loading=false;
var $loadMoreButton=$('.fave-load-more a');
var paginationType =
$loadMoreButton.data('pagination-type')||'loadmore';
var observer;
function loadMoreProperties(e){
if(e) e.preventDefault();
if(loading) return;
var $this=$(this);
var $wrap=$this
.closest('#properties_module_section')
.find('#module_properties');
var prop_limit=$this.data('prop-limit');
var paged=$this.data('paged');
var card_version=$this.data('card');
var type=$this.data('type');
var status=$this.data('status');
var state=$this.data('state');
var city=$this.data('city');
var country=$this.data('country');
var area=$this.data('area');
var label=$this.data('label');
var user_role=$this.data('user-role');
var featured_prop=$this.data('featured-prop');
var offset=$this.data('offset');
var sortby=$this.data('sortby');
var property_ids=$this.data('property_ids');
var min_price=$this.data('min_price');
var max_price=$this.data('max_price');
var min_beds=$this.data('min_beds');
var max_beds=$this.data('max_beds');
var min_baths=$this.data('min_baths');
var max_baths=$this.data('max_baths');
var agents=$this.data('agents');
var agencies=$this.data('agencies');
var post_status=$this.data('post_status');
loading=true;
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
action: 'houzez_loadmore_properties',
prop_limit: prop_limit,
paged: paged,
card_version: card_version,
type: type,
status: status,
state: state,
city: city,
country: country,
area: area,
label: label,
property_ids: property_ids,
min_price: min_price,
max_price: max_price,
min_beds: min_beds,
max_beds: max_beds,
min_baths: min_baths,
max_baths: max_baths,
user_role: user_role,
agents: agents,
agencies: agencies,
featured_prop: featured_prop,
sort_by: sortby,
offset: offset,
post_status: post_status,
},
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
loading=false;
},
success: function (data){
if(data.html=='no_result'){
$this
.closest('#properties_module_section')
.find('.fave-load-more')
.fadeOut('fast')
.remove();
return;
}
$wrap.append(data.html);
$this.data('paged', paged + 1);
$this.find('i').remove();
if(!data.has_more_posts){
$this
.closest('#properties_module_section')
.find('.fave-load-more')
.fadeOut('fast')
.remove();
}else if(paginationType==='infinite_scroll'){
observeLoadMoreButton();
}
houzez_init_add_favorite(ajaxurl, userID);
houzez_init_remove_favorite(ajaxurl, userID);
houzez_listing_lightbox(
ajaxurl,
processing_text,
houzez_rtl,
userID
);
houzez_grid_image_gallery();
houzez_grid_call_to_action();
houzez_lazyload_for_ajax();
compare_for_ajax();
$('[data-toggle="tooltip"]').tooltip();
},
error: function (jqXHR, textStatus, errorThrown){
console.error('AJAX error: ' + textStatus + ':' + errorThrown
);
loading=false;
},
});
}
function observeLoadMoreButton(){
if(observer){
observer.disconnect();
}
observer=new IntersectionObserver(
(entries)=> {
entries.forEach((entry)=> {
if(entry.isIntersecting&&!loading){
loadMoreProperties.call($('.fave-load-more a')[0]);
}});
},
{
root: null,
rootMargin: '0px',
threshold: 0.1,
}
);
var loadMoreButton=document.querySelector('.fave-load-more a');
if(loadMoreButton){
observer.observe(loadMoreButton);
}}
$('body').on('click', '.fave-load-more a', loadMoreProperties);
if(paginationType==='infinite_scroll'){
observeLoadMoreButton();
}}
jQuery(document).ready(function ($){
const $listingView=$('.listing-view');
const $loadMoreBtn=$('.houzez-infinite-load');
const $paginationContainer=$('#fave-pagination-loadmore');
let loading=false;
let currentPage=1;
let noMoreListings=false;
let totalListings=parseInt($loadMoreBtn.data('total'), 10)||0;
let perPage=parseInt($loadMoreBtn.data('per-page'), 10)||10;
let pagi_type=$loadMoreBtn.data('pagi-type')||'_number';
function loadMoreListings(){
if(loading||noMoreListings) return;
loading=true;
const nextPageUrl=$loadMoreBtn.attr('href');
$.ajax({
url: nextPageUrl,
type: 'GET',
dataType: 'html',
beforeSend: function (){
$loadMoreBtn
.find('.houzez-loader-js')
.addClass('loader-show');
},
complete: function (){
$loadMoreBtn
.find('.houzez-loader-js')
.removeClass('loader-show');
},
success: function (response){
const $html=$(response);
const $newListings=$html.find('.listing-view .item-listing-wrap'
);
if($newListings.length > 0){
$listingView.append($newListings);
currentPage++;
const nextPageLink=$html
.find('.houzez-infinite-load')
.attr('href');
if(nextPageLink &&
currentPage * perPage < totalListings
){
$loadMoreBtn.attr('href', nextPageLink);
$loadMoreBtn.attr('data-page', currentPage + 1);
updateBrowserUrl(nextPageUrl);
$loadMoreBtn.show();
}else{
noMoreListings=true;
showEndMessage();
$loadMoreBtn.hide();
}
houzez_init_add_favorite(ajaxurl, userID);
houzez_init_remove_favorite(ajaxurl, userID);
houzez_listing_lightbox(
ajaxurl,
processing_text,
houzez_rtl,
userID
);
houzez_grid_image_gallery();
houzez_grid_call_to_action();
houzez_lazyload_for_ajax();
compare_for_ajax();
houzez_parallax_listings();
$('[data-toggle="tooltip"]').tooltip();
}else{
noMoreListings=true;
showEndMessage();
$loadMoreBtn.hide();
}
loading=false;
},
error: function (xhr, status, error){
console.error('Error loading more listings:', error);
loading=false;
},
});
}
function updateBrowserUrl(url){
if(history.pushState){
const newUrl=new URL(url);
window.history.pushState({ path: newUrl.href },
'',
newUrl.href
);
}}
function showEndMessage(){
$paginationContainer.html('<p class="no-more-listings">' + listings_not_found + '</p>'
);
}
if(totalListings <=perPage){
$loadMoreBtn.hide();
}
if(pagi_type=='_infinite'&&$('#houzez-infinite-load').length > 0){
const options={
root: null,
rootMargin: '0px',
threshold: 0.1,
};
const observer=new IntersectionObserver((entries)=> {
entries.forEach((entry)=> {
if(entry.isIntersecting&&!loading&&!noMoreListings){
loadMoreListings();
}});
}, options);
observer.observe($loadMoreBtn[0]);
}
$loadMoreBtn.on('click', function (e){
e.preventDefault();
if(!loading&&!noMoreListings){
loadMoreListings();
}});
$(window).on('popstate', function (e){
if(e.originalEvent.state!==null){
window.location.reload();
}});
});
var property_status_changed=function (prop_status, $form){
if(prop_status==for_rent){
$form.find('.prices-for-all').addClass('hide');
$form.find('.prices-for-all select').attr('disabled', 'disabled');
$form.find('.prices-only-for-rent').removeClass('hide');
$form
.find('.prices-only-for-rent select')
.removeAttr('disabled', 'disabled');
$form.find('.prices-only-for-rent select').selectpicker('refresh');
}else{
$form.find('.prices-only-for-rent').addClass('hide');
$form
.find('.prices-only-for-rent select')
.attr('disabled', 'disabled');
$form.find('.prices-for-all').removeClass('hide');
$form
.find('.prices-for-all select')
.removeAttr('disabled', 'disabled');
$form.find('.prices-for-all select').selectpicker('refresh');
}};
$('.status-js').on('change', function (e){
var selected_status=$(this).val();
var $form=$(this).parents('form');
property_status_changed(selected_status, $form);
});
$('.status-tab-js').on('click', function (){
var tab_selected_status=$(this).data('val');
var $form=$(this).parents('form');
property_status_changed(tab_selected_status, $form);
});
var selected_status=$('.status-js').val();
if(selected_status==for_rent){
var $form=$('.houzez-search-form-js');
property_status_changed(selected_status, $form);
}else{
var $form=$('.houzez-search-form-js');
property_status_changed('dummy', $form);
}
var selected_status_tab=$('.status-tab-js').val();
if(selected_status_tab==for_rent){
var $tab_form=$('.houzez-search-builder-form-js');
property_status_changed(selected_status_tab, $tab_form);
}else{
var $tab_form=$('.houzez-search-builder-form-js');
property_status_changed(selected_status_tab, $tab_form);
}
var price_range_search=function (min_price, max_price){
$('.price-range').slider({
range: true,
min: min_price,
max: max_price,
values: [min_price, max_price],
slide: function (event, ui){
if(currency_position=='after'){
var min_price_range =
thousandSeparator(ui.values[0]) + currency_symb;
var max_price_range =
thousandSeparator(ui.values[1]) + currency_symb;
}else{
var min_price_range =
currency_symb + thousandSeparator(ui.values[0]);
var max_price_range =
currency_symb + thousandSeparator(ui.values[1]);
}
$('.min-price-range-hidden').val(ui.values[0]);
$('.max-price-range-hidden').val(ui.values[1]);
$('.min-price-range').text(min_price_range);
$('.max-price-range').text(max_price_range);
},
stop: function (event, ui){},
change: function (event, ui){},
});
if(currency_position=='after'){
var min_price_range =
thousandSeparator($('.price-range').slider('values', 0)) +
currency_symb;
var max_price_range =
thousandSeparator($('.price-range').slider('values', 1)) +
currency_symb;
}else{
var min_price_range =
currency_symb +
thousandSeparator($('.price-range').slider('values', 0));
var max_price_range =
currency_symb +
thousandSeparator($('.price-range').slider('values', 1));
}
$('.min-price-range').text(min_price_range);
$('.max-price-range').text(max_price_range);
$('.min-price-range-hidden').val($('.price-range').slider('values', 0));
$('.max-price-range-hidden').val($('.price-range').slider('values', 1));
};
if($('.price-range').length > 0&&is_halfmap!=1){
var selected_status_adv_search=$('.status-js').val();
if(selected_status_adv_search==for_rent_price_slider){
price_range_search(
search_price_range_min_rent,
search_price_range_max_rent
);
}else{
price_range_search(search_price_range_min, search_price_range_max);
}
$('.status-js').on('change', function (){
var search_status=$(this).val();
if(search_status==for_rent_price_slider){
price_range_search(
search_price_range_min_rent,
search_price_range_max_rent
);
}else{
price_range_search(
search_price_range_min,
search_price_range_max
);
}});
$('.status-tab-js').on('click', function (){
var tab_status=$(this).data('val');
if(tab_status==for_rent_price_slider){
price_range_search(
search_price_range_min_rent,
search_price_range_max_rent
);
}else{
price_range_search(
search_price_range_min,
search_price_range_max
);
}});
}
$('.houzez-status-tabs li a').on('click', function (e){
e.preventDefault();
var $this=$(this);
var status=$this.data('val');
$('#search-tabs').val(status);
var $form=$('.houzez-search-form-js');
property_status_changed(status, $form);
});
function insertParam(key, value){
key=encodeURI(key);
value=encodeURI(value);
var qrp=document.location.search.substr(1).split('&');
var i=qrp.length;
var j;
while (i--){
j=qrp[i].split('=');
if(j[0]==key){
j[1]=value;
qrp[i]=j.join('=');
break;
}}
if(i < 0){
qrp[qrp.length]=[key, value].join('=');
}
document.location.search=qrp.join('&');
}
$('#sort_properties').on('change', function (){
var key='sortby';
var value=$(this).val();
insertParam(key, value);
});
$('#insights_filter').on('change', function (){
var key='listing_id';
var value=$(this).val();
insertParam(key, value);
});
$('#houzez-gmap-full').on('click', function (){
var $this=$(this);
if($this.hasClass('active')){
$this.removeClass('active');
$this.parents('.map-wrap').removeClass('houzez-fullscreen-map');
}else{
$this.parents('.map-wrap').addClass('houzez-fullscreen-map');
$this.addClass('active');
}});
$('.houzez_agent_property_form').on('click', function (e){
e.preventDefault();
var $result;
var $this=$(this);
var $form=$this.parents('form');
var $form_wrap=$this.parents('.property-form-wrap');
$result=$form_wrap.find('.form_messages');
var $is_bottom=$('.is_bottom').val();
if($is_bottom=='bottom'){
$result=$form.find('.form_messages');
}
$result.empty();
$.ajax({
url: ajaxurl,
data: $form.serialize(),
method: $form.attr('method'),
dataType: 'JSON',
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
success: function (response){
if(response.success){
$form
.find('input[name="name"], input[name="mobile"], input[name="email"]'
)
.val('');
$form.find('textarea').val('');
if($is_bottom=='bottom'){
$result
.empty()
.append('<div class="alert alert-success alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}else{
$result
.empty()
.append('<p class="success text-success"><i class="fa fa-check"></i> ' +
response.msg +
'</p>'
);
}}else{
if($is_bottom=='bottom'){
$result
.empty()
.append('<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}else{
$result
.empty()
.append('<p class="error text-danger"><i class="fas fa-times"></i> ' +
response.msg +
'</p>'
);
}}
$this.find('.houzez-loader-js').removeClass('loader-show');
if(houzez_reCaptcha==1){
$form.find('.g-recaptcha-response').remove();
if(g_recaptha_version=='v3'){
houzezReCaptchaLoad();
}else{
houzezReCaptchaReset();
}}
if(houzez_vars.agent_redirection!=''&&response.success){
setTimeout(function (){
window.location.replace(houzez_vars.agent_redirection);
}, 500);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
});
});
$('.msg-login-required').on('click', function (){
$('.modal-toggle-1').addClass('active');
jQuery('.login-form-tab').addClass('active show');
});
$('.houzez-send-message').on('click', function (e){
e.preventDefault();
var $result;
var $this=$(this);
var $form=$this.parents('form');
var $form_wrap=$this.parents('.property-form-wrap');
$result=$form_wrap.find('.form_messages');
var $is_bottom=$('.is_bottom').val();
if($is_bottom=='bottom'){
$result=$form.find('.form_messages');
}
$result.empty();
var property_id=$('input[name="listing_id"]').val();
var message=$form.find('.hz-form-message').val();
var security=$('input[name="property_agent_contact_security"]').val();
$.ajax({
url: ajaxurl,
data: {
action: 'houzez_start_thread',
property_id: property_id,
message: message,
start_thread_form_ajax: security,
},
method: $form.attr('method'),
dataType: 'JSON',
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
success: function (response){
if(response.success){
$form
.find('input[name="name"], input[name="mobile"], input[name="email"]'
)
.val('');
$form.find('textarea').val('');
if($is_bottom=='bottom'){
$result
.empty()
.append('<div class="alert alert-success alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}else{
$result
.empty()
.append('<p class="success text-success"><i class="fa fa-check"></i> ' +
response.msg +
'</p>'
);
}}else{
if($is_bottom=='bottom'){
$result
.empty()
.append('<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}else{
$result
.empty()
.append('<p class="error text-danger"><i class="fas fa-times"></i> ' +
response.msg +
'</p>'
);
}}
$this.find('.houzez-loader-js').removeClass('loader-show');
if(houzez_reCaptcha==1){
$form.find('.g-recaptcha-response').remove();
if(g_recaptha_version=='v3'){
houzezReCaptchaLoad();
}else{
houzezReCaptchaReset();
}}
if(houzez_vars.agent_redirection!=''){
setTimeout(function (){
window.location.replace(houzez_vars.agent_redirection);
}, 500);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
});
});
$('.start_thread_message_form').on('click', function (e){
e.preventDefault();
var $this=$(this);
var $form=$this.parents('form');
var $result=$form.find('.form_messages');
$.ajax({
url: ajaxurl,
data: $form.serialize(),
method: $form.attr('method'),
dataType: 'JSON',
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
success: function (response){
$this.find('.houzez-loader-js').removeClass('loader-show');
window.location.replace(response.url);
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
});
});
$('#contact_realtor_btn').on('click', function (e){
e.preventDefault();
var current_element=$(this);
var $this=$(this);
var $form=$this.parents('form');
jQuery.ajax({
type: 'post',
url: ajaxurl,
data: $form.serialize(),
method: $form.attr('method'),
dataType: 'JSON',
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
success: function (res){
if(res.success){
$('.form_messages')
.empty()
.append('<div class="alert alert-success alert-dismissible fade show" role="alert">' +
res.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}else{
$('.form_messages')
.empty()
.append('<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
res.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}
$this.find('.houzez-loader-js').removeClass('loader-show');
if(houzez_reCaptcha==1){
$form.find('.g-recaptcha-response').remove();
if(g_recaptha_version=='v3'){
houzezReCaptchaLoad();
}else{
houzezReCaptchaReset();
}}
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
});
});
if(keyword_autocomplete!=0){
var houzezAutoComplete=function (){
var ajaxCount=0;
var auto_complete_container=$('.auto-complete');
var lastLenght=0;
$('body').on('keyup',
'.houzez-keyword-autocomplete',
HouzezDebounce(function (){
var $this=$(this);
var $dataType=$this.data('type');
var $form=$this.parents('form');
if($dataType=='banner'){
var auto_complete_container=$(
'#houzez-auto-complete-banner'
);
}else{
var auto_complete_container =
$form.find('.auto-complete');
}
var keyword=$(this).val();
keyword=$.trim(keyword);
var currentLenght=keyword.length;
if(currentLenght >=2&&currentLenght!=lastLenght){
lastLenght=currentLenght;
auto_complete_container.fadeIn();
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_get_auto_complete_search',
key: keyword,
},
beforeSend: function (){
ajaxCount++;
if(ajaxCount==1){
auto_complete_container.html('<ul class="list-group"><li class="list-group-item"><i class="fa fa-spinner fa-spin fa-fw"></i> ' +
autosearch_text +
'</li></ul>'
);
}},
success: function (data){
ajaxCount--;
if(ajaxCount==0){
auto_complete_container.show();
if(data!=''){
auto_complete_container
.empty()
.html(data)
.bind();
}}
},
error: function (errorThrown){
ajaxCount--;
if(ajaxCount==0){
auto_complete_container.html('<ul class="list-group"><li class="list-group-item"><i class="fa fa-spinner fa-spin fa-fw"></i> ' +
autosearch_text +
'</li></ul>'
);
}},
});
}else{
if(currentLenght!=lastLenght){
auto_complete_container.fadeOut();
}}
}, 400)
);
auto_complete_container
.on('click', 'li', function (){
$('.houzez-keyword-autocomplete').val($(this).data('text'));
auto_complete_container.fadeOut();
})
.bind();
};
houzezAutoComplete();
}
$('.save_search_click').on('click', function (e){
e.preventDefault();
var $this=$(this);
var search_args=$('input[name="search_args"]').val();
var security=$('input[name="houzez_save_search_ajax"]').val();
var search_URI=$('input[name="search_URI"]').val();
if(parseInt(userID, 10)===0){
houzez_login_modal();
}else{
$.ajax({
url: ajaxurl,
data: {
action: 'houzez_save_search',
search_args: search_args,
search_URI: search_URI,
houzez_save_search_ajax: security,
},
method: 'POST',
dataType: 'JSON',
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
success: function (response){
if(response.success){
$('.save_search_click').attr('disabled', true);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
});
}});
$('.schedule_contact_form').on('click', function (e){
e.preventDefault();
var $this=$(this);
var $form=$this.parents('form');
var $result=$form.find('.form_messages');
$.ajax({
url: ajaxurl,
data: $form.serialize(),
method: $form.attr('method'),
dataType: 'JSON',
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
success: function (response){
if(response.success){
$form
.find('input[name="name"], input[name="phone"], input[name="email"]'
)
.val('');
$form.find('textarea').val('');
$result
.empty()
.append('<div class="alert alert-success alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
if(typeof response.redirect_to!=='undefined' &&
response.redirect_to!=''
){
setTimeout(function (){
window.location.replace(response.redirect_to);
}, 500);
}}else{
$result
.empty()
.append('<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
});
});
function setAutoCompleteResultPosition(){
var parallax_banner_inner_height=$('.top-banner-wrap').innerHeight();
var banner_caption_inner_height=$('.banner-caption').innerHeight();
var autocomplete_search_position =
parallax_banner_inner_height -
(parallax_banner_inner_height - banner_caption_inner_height) / 2;
$('#houzez-auto-complete-banner').css('top',
autocomplete_search_position
);
}
$('.houzez-nav-menu-main-mobile-wrap .houzez-menu-toggle').click(function (
e
){
$(
'.houzez-nav-menu-main-mobile-wrap .navbar-nav, .houzez-nav-menu-main-mobile-wrap .houzez-menu-toggle'
).toggleClass('houzez-nav-menu-active');
});
$(window).on('load', function (){
setAutoCompleteResultPosition();
});
$win.on('resize', function (){
setAutoCompleteResultPosition();
});
if($('.houzez-print').length > 0){
$('.houzez-print').on('click', function (e){
e.preventDefault();
var propID, printWindow;
propID=$(this).attr('data-propid');
printWindow=window.open('', 'Print Me', 'width=800 ,height=842');
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_create_print',
propid: propID,
},
success: function (data){
printWindow.document.write(data);
printWindow.document.close();
printWindow.focus();
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
});
}
var review_likes=function (){
$('.hz-like-dislike-js').on('click', function (e){
e.preventDefault();
var $this=jQuery(this);
var $parent=$this.parents('.likes-container-js');
if($this.hasClass('already-voted')){
$parent.find('.vote-msg').text($this.data('msg')).show();
var hideMessage=function (){
$parent.find('.vote-msg').hide();
};
setTimeout(hideMessage, 3000);
}else{
var review_id=$this.data('id');
var type=$this.data('type');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'JSON',
data: {
action: 'reviews_likes_dislikes',
type: type,
review_id: review_id,
},
beforeSend: function (){
$parent.find('.vote-msg').empty();
$parent
.find('.houzez-loader-js')
.addClass('loader-show');
if(type=='likes'){
$('.review-dislike-button a').removeClass('already-voted'
);
}else if(type=='dislikes'){
$('.review-like-button a').removeClass('already-voted'
);
}},
success: function (res){
if(res.success){
$parent.find('.likes-count').text(res.likes);
$parent.find('.dislikes-count').text(res.dislikes);
$parent.find('.vote-msg').text(res.msg).show();
}else{
$parent.find('.vote-msg').text(res.msg).show();
}
var hideMessage=function (){
$parent.find('.vote-msg').hide();
};
setTimeout(hideMessage, 3000);
$this.addClass('already-voted');
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
$parent
.find('.houzez-loader-js')
.removeClass('loader-show');
},
});
}});
};
review_likes();
$('#submit-review').on('click', function (e){
e.preventDefault();
var $this=$(this);
var $form=$this.parents('form');
var $result=$form.find('.form_messages');
$.ajax({
url: ajaxurl,
data: $form.serialize(),
method: $form.attr('method'),
dataType: 'JSON',
beforeSend: function (){
$this.find('.houzez-loader-js').addClass('loader-show');
},
success: function (response){
if(response.success){
$result
.empty()
.append('<div class="alert alert-success alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
window.location.replace(response.review_link);
}else{
$result
.empty()
.append('<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){
$this.find('.houzez-loader-js').removeClass('loader-show');
},
});
});
var listing_review_ajax=function (sortby, listing_id, paged){
var review_container=$('#houzez_reviews_container');
var review_post_type=$('input[name="review_post_type"]').val();
$.ajax({
type: 'post',
url: ajaxurl,
data: {
action: 'houzez_ajax_review',
sortby: sortby,
listing_id: listing_id,
review_post_type: review_post_type,
paged: paged,
},
beforeSend: function (){
review_container
.empty()
.append('' +
'<div id="houzez-map-loading">' +
'<div class="mapPlaceholder">' +
'<div class="loader-ripple spinner">' +
'<div class="bounce1"></div>' +
'<div class="bounce2"></div>' +
'<div class="bounce3"></div>' +
'</div>' +
'</div>' +
'</div>'
);
$('html, body').animate({
scrollTop: $('#property-review-wrap').offset().top - 50,
},
'slow'
);
},
success: function (data){
review_container.empty();
review_container.html(data);
review_likes();
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
complete: function (){},
});
};
if($('#sort_review').length > 0){
$('#sort_review').on('change', function (){
var sortby=$(this).val();
var listing_id=$('input[name="listing_id"]').val();
var paged=1;
$('#review_paged').val(paged);
$('#review_prev').attr('disabled', true);
$('#review_next').attr('disabled', false);
listing_review_ajax(sortby, listing_id, paged);
return;
});
}
if($('#review_next').length > 0){
$('#review_next').on('click', function (e){
e.preventDefault();
$('#review_prev').removeAttr('disabled');
var sortby=$('#sort_review').val();
var total_pages=$('#total_pages').val();
var listing_id=$('input[name="listing_id"]').val();
var paged=$('#review_paged').val();
paged=Number(paged) + 1;
$('#review_paged').val(paged);
if(paged==total_pages){
$(this).attr('disabled', true);
}
listing_review_ajax(sortby, listing_id, paged);
return;
});
}
if($('#review_prev').length > 0){
$('#review_prev').on('click', function (e){
e.preventDefault();
$('#review_next').removeAttr('disabled');
var sortby=$('#sort_review').val();
var listing_id=$('input[name="listing_id"]').val();
var paged=$('#review_paged').val();
paged=Number(paged) - 1;
$('#review_paged').val(paged);
if(paged <=1){
$(this).attr('disabled', true);
}
listing_review_ajax(sortby, listing_id, paged);
return;
});
}
function houzezSelectFilter(
$this,
$dataRef,
$list_num='',
is_on_load=''
){
var e=$this.data('target'),
i=$this.find(':selected').data('ref');
if(is_on_load=='yes'){
e=$list_num;
i=$dataRef;
}
$('select.' + e).val(''),
null==i
? $('select.' + e)
.find('option')
.each(function (){
console.log('inside undefined'),
$(this).removeAttr('disabled hidden');
})
: $('select.' + e)
.find('option')
.each(function (){
var e=$(this).data('belong'),
t=$(this).val();
i!=e&&t!=''
? ($(this).prop('disabled', !0),
$(this).prop('hidden', !0))
: ($(this).prop('disabled', !1),
$(this).prop('hidden', !1));
});
$('select.' + e).selectpicker('refresh');
}
$('.houzezSelectFilter').on('change', function (){
var $this=$(this);
houzezSelectFilter($this);
});
if($('.houzez-search-form-js').length > 0||$('#location').length > 0){
var countryRef, stateRef, cityRef, areasRef;
if(is_edit_property){
countryRef=$('#country').data('country');
stateRef=$('#countyState').data('state');
cityRef=$('#city').data('city');
areasRef=$('#neighborhood').data('area');
}else{
countryRef=houzez_vars.s_country;
stateRef=houzez_vars.s_state;
cityRef=houzez_vars.s_city;
areasRef=houzez_vars.s_areas;
}
if(($('.houzez-country-js').length > 0||$('#country').length > 0) &&
countryRef!=''
){
var countryFilter=$('.houzezCountryFilter');
houzezSelectFilter(
countryFilter,
countryRef,
'houzezSecondList',
'yes'
);
$(window).load(function (){
$('.houzezSecondList').val(stateRef);
$('select.houzezSecondList').selectpicker('refresh');
});
}
if(($('.houzez-state-js').length > 0 ||
$('#countyState').length > 0) &&
stateRef!=''
){
var stateFilter=$('.houzezStateFilter');
houzezSelectFilter(stateFilter, stateRef, 'houzezThirdList', 'yes');
$(window).load(function (){
$('.houzezThirdList').val(cityRef);
$('select.houzezThirdList').selectpicker('refresh');
});
}
if(($('.houzez-city-js').length > 0||$('#city').length > 0) &&
cityRef!=''
){
var cityFilter=$('.houzezCityFilter');
houzezSelectFilter(cityFilter, cityRef, 'houzezFourthList', 'yes');
$(window).load(function (){
$('.houzezFourthList').val(areasRef);
$('select.houzezFourthList').selectpicker('refresh');
});
}}
if($('#houzez_mortgage_calculate').length > 0){
$('#houzez_mortgage_calculate').click(function (e){
e.preventDefault();
var monthly_payment=houzez_vars.monthly_payment;
var weekly_payment=houzez_vars.weekly_payment;
var bi_weekly_payment=houzez_vars.bi_weekly_payment;
var currency_symb=houzez_vars.currency_symbol;
var totalPrice=0;
var down_payment=0;
var term_years=0;
var interest_rate=0;
var amount_financed=0;
var monthInterest=0;
var intVal=0;
var mortgage_pay=0;
var annualCost=0;
var payment_period;
var mortgage_pay_text;
var total_years=$('#mc_term_years').val();
payment_period=$('#mc_payment_period').val();
totalPrice=$('#mc_total_amount').val().replace(/,/g, '');
down_payment=$('#mc_down_payment').val().replace(/,/g, '');
amount_financed=totalPrice - down_payment;
term_years =
parseInt($('#mc_term_years').val(), 10) * payment_period;
interest_rate=parseFloat($('#mc_interest_rate').val(), 10);
monthInterest=interest_rate / (payment_period * 100);
intVal=Math.pow(1 + monthInterest, -term_years);
mortgage_pay=amount_financed * (monthInterest / (1 - intVal));
annualCost=mortgage_pay * payment_period;
if($('#mc_term_years').val()=='' ||
$('#mc_total_amount')=='' ||
$('#mc_down_payment')=='' ||
$('#mc_interest_rate')==''
){
return;
}
var total_mortgage_with_interest =
mortgage_pay * total_years * payment_period;
var total_with_down_payment =
total_mortgage_with_interest + parseInt(down_payment);
if(payment_period=='12'){
mortgage_pay_text=monthly_payment;
}else if(payment_period=='26'){
mortgage_pay_text=bi_weekly_payment;
}else if(payment_period=='52'){
mortgage_pay_text=weekly_payment;
}
if(currency_position=='after'){
$('#mortgage_mwbi').html('<strong>' +
mortgage_pay_text +
'</strong>: <span>' +
Math.round(mortgage_pay * 100) / 100 +
currency_symb +
'</span>'
);
$('#amount_financed').html(Math.round(amount_financed * 100) / 100 + currency_symb
);
$('#mortgage_pay').html(Math.round(mortgage_pay * 100) / 100 + currency_symb
);
$('#annual_cost').html(Math.round(annualCost * 100) / 100 + currency_symb
);
$('#balance_payable_with_interest').html(Math.round(total_mortgage_with_interest * 100) / 100 +
currency_symb
);
$('#total_with_down_payment').html(Math.round(total_with_down_payment * 100) / 100 +
currency_symb
);
}else{
$('#mortgage_mwbi').html('<strong>' +
mortgage_pay_text +
'</strong>: <span>' +
currency_symb +
Math.round(mortgage_pay * 100) / 100 +
'</span>'
);
$('#amount_financed').html(currency_symb + Math.round(amount_financed * 100) / 100
);
$('#mortgage_pay').html(currency_symb + Math.round(mortgage_pay * 100) / 100
);
$('#annual_cost').html(currency_symb + Math.round(annualCost * 100) / 100
);
$('#balance_payable_with_interest').html(currency_symb +
Math.round(total_mortgage_with_interest * 100) / 100
);
$('#total_with_down_payment').html(currency_symb +
Math.round(total_with_down_payment * 100) / 100
);
}
$('#cal_years').html(total_years);
$('.mortgage-details').show();
});
}
var beds_baths=function (btn_action, btn_count, btn_val){
$('.' + btn_action).on('click', function (e){
e.preventDefault();
var current_val=parseInt($('.' + btn_val).val())||0;
if(btn_action=='btn_count_plus' ||
btn_action=='btn_beds_plus'
){
current_val++;
}else{
if(current_val==0) return;
current_val--;
}
$('.' + btn_count).text(current_val);
$('.' + btn_val).val(current_val);
});
};
beds_baths('btn_count_plus', 'baths_count', 'bathrooms');
beds_baths('btn_count_minus', 'baths_count', 'bathrooms');
beds_baths('btn_beds_plus', 'beds_count', 'bedrooms');
beds_baths('btn_beds_minus', 'beds_count', 'bedrooms');
$('.btn-apply').on('click', function (e){
e.preventDefault();
$('.advanced-search-v3 .btn-group .dropdown-menu').removeClass('show');
});
$('.clear-baths').on('click', function (e){
e.preventDefault();
$('.baths_count').text('0');
$('.bathrooms').val('');
});
$('.clear-beds').on('click', function (e){
e.preventDefault();
$('.beds_count').text('0');
$('.bedrooms').val('');
});
$('.clear-checkboxes').on('click', function (e){
e.preventDefault();
$(this)
.parents('.btn-group')
.find('input[type="checkbox"]')
.prop('checked', false)
.attr('checked', false);
});
$('.method-select input').on('change', function (){
if($(this).is(':checked')){
$('.recurring-payment-wrap').slideUp();
$(this)
.parents('.payment-method-block')
.next('.recurring-payment-wrap')
.slideDown();
}else{
$('.recurring-payment-wrap').slideUp();
}});
function paypal_option(ele){
if($(ele).attr('checked')){
$(ele)
.parents('.payment-method-block')
.next('.recurring-payment-wrap')
.slideDown();
}else{
$(ele)
.parents('.payment-method-block')
.next('.recurring-payment-wrap')
.slideUp();
}}
paypal_option('.paypal-method');
paypal_option('.stripe-method');
$('button.stripe-button-el span').prepend('<i class="fa fa-credit-card"></i>'
);
$('#stripe_package_recurring').click(function (){
if($(this).attr('checked')){
$('.houzez_payment_form').append('<input type="hidden" name="houzez_stripe_recurring" id="houzez_stripe_recurring" value="1">'
);
}else{
$('#houzez_stripe_recurring').remove();
}});
$('.prop_featured').on('change', function (){
var currency_symbol=houzez_vars.currency_symbol;
var currency_position=houzez_vars.currency_position;
var total_price, total_price_with_currency, price_regular_with_currency;
var price_regular=parseFloat($('#submission_price').text());
var price_featured=parseFloat($('#submission_featured_price').text());
total_price=price_regular + price_featured;
if(currency_position==='after'){
price_regular_with_currency=price_regular + '' + currency_symbol;
total_price_with_currency=total_price + '' + currency_symbol;
}else{
price_regular_with_currency=currency_symbol + '' + price_regular;
total_price_with_currency=currency_symbol + '' + total_price;
}
if($(this).is(':checked')){
$('#submission_total_price').text(total_price_with_currency);
$('#featured_pay').val(1);
$('input[name="pay_ammout"]').val(total_price * 100);
$('#houzez_listing_price').val(total_price);
}else{
$('#submission_total_price').text(price_regular_with_currency);
$('#featured_pay').val(0);
$('input[name="pay_ammout"]').val(price_regular * 100);
$('#houzez_listing_price').val(price_regular);
}
return false;
});
$('#houzez_complete_order').on('click', function (e){
e.preventDefault();
var hform,
relist_mode,
payment_gateway,
houzez_listing_price,
property_id,
is_prop_featured,
is_prop_upgrade;
payment_gateway=$("input[name='houzez_payment_type']:checked").val();
is_prop_featured=$("input[name='featured_pay']").val();
is_prop_upgrade=$("input[name='is_upgrade']").val();
relist_mode=$("input[name='relist_mode']").val();
property_id=$('#houzez_property_id').val();
houzez_listing_price=$('#houzez_listing_price').val();
if(payment_gateway=='paypal'){
fave_processing_modal(paypal_connecting);
paypal_per_listing_payment(
property_id,
is_prop_featured,
is_prop_upgrade,
relist_mode
);
}else if(payment_gateway=='stripe'){
fave_processing_modal(processing_text);
stripe_per_listing_payment(
property_id,
is_prop_featured,
is_prop_upgrade,
relist_mode
);
}else if(payment_gateway=='direct_pay'){
fave_processing_modal(processing_text);
bank_transfer_per_listing(property_id, houzez_listing_price);
}
return;
});
var paypal_per_listing_payment=function (
property_id,
is_prop_featured,
is_prop_upgrade,
relist_mode
){
$.ajax({
type: 'post',
url: ajaxurl,
data: {
action: 'houzez_property_paypal_payment',
prop_id: property_id,
is_prop_featured: is_prop_featured,
is_prop_upgrade: is_prop_upgrade,
relist_mode: relist_mode,
},
success: function (response){
window.location.href=response;
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
var stripe_per_listing_payment=function (
property_id,
is_prop_featured,
is_prop_upgrade,
relist_mode
){
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'JSON',
data: {
action: 'houzez_property_stripe_payment',
prop_id: property_id,
is_prop_featured: is_prop_featured,
is_prop_upgrade: is_prop_upgrade,
relist_mode: relist_mode,
},
success: function (response){
if(response.status){
window.location.href=response.paymeny_link;
}else{
alert(response.message);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
var bank_transfer_per_listing=function (prop_id, listing_price){
var is_featured=$('input[name="featured_pay"]').val();
var is_upgrade=$('input[name="is_upgrade"]').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_direct_pay_per_listing',
prop_id: prop_id,
is_featured: is_featured,
is_upgrade: is_upgrade,
},
success: function (data){
window.location.href=data;
},
error: function (errorThrown){},
});
};
var houzez_stripe_package_payment=function (
houzez_package_id,
is_stripe_recurring
){
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'JSON',
data: {
action: 'houzez_stripe_package_payment',
package_id: houzez_package_id,
is_stripe_recurring: is_stripe_recurring,
},
success: function (response){
if(response.status){
window.location.href=response.paymeny_link;
}else{
alert(response.message);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
var houzez_paypal_package_payment=function (
houzez_package_price,
houzez_package_name,
houzez_package_id
){
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_paypal_package_payment',
houzez_package_price: houzez_package_price,
houzez_package_name: houzez_package_name,
houzez_package_id: houzez_package_id,
},
success: function (data){
window.location.href=data;
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
var houzez_recuring_paypal_package_payment=function (
houzez_package_price,
houzez_package_name,
houzez_package_id
){
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_recuring_paypal_package_payment',
houzez_package_name: houzez_package_name,
houzez_package_id: houzez_package_id,
houzez_package_price: houzez_package_price,
},
success: function (data){
window.location.href=data;
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
var direct_bank_transfer_package=function (
houzez_package_id,
houzez_package_price,
houzez_package_name
){
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_direct_pay_package',
selected_package: houzez_package_id,
},
success: function (data){
window.location.href=data;
},
error: function (errorThrown){},
});
};
var houzez_free_membership_package=function (houzez_package_id){
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_free_membership_package',
selected_package: houzez_package_id,
},
success: function (data){
window.location.href=data;
},
error: function (errorThrown){},
});
};
var houzez_membership_data=function (currnt){
var payment_gateway=$(
"input[name='houzez_payment_type']:checked"
).val();
var houzez_package_price=$(
"input[name='houzez_package_price']"
).val();
var houzez_package_id=$("input[name='houzez_package_id']").val();
var houzez_package_name=$('#houzez_package_name').text();
if(payment_gateway=='paypal'){
fave_processing_modal(paypal_connecting);
if($('#paypal_package_recurring').is(':checked')){
houzez_recuring_paypal_package_payment(
houzez_package_price,
houzez_package_name,
houzez_package_id
);
}else{
houzez_paypal_package_payment(
houzez_package_price,
houzez_package_name,
houzez_package_id
);
}}else if(payment_gateway=='stripe'){
fave_processing_modal(processing_text);
var is_stripe_recurring=$('#houzez_stripe_recurring').is(':checked'
);
houzez_stripe_package_payment(
houzez_package_id,
is_stripe_recurring
);
}else if(payment_gateway=='direct_pay'){
fave_processing_modal(processing_text);
direct_bank_transfer_package(
houzez_package_id,
houzez_package_price,
houzez_package_name
);
}else{
fave_processing_modal(processing_text);
houzez_free_membership_package(houzez_package_id);
}
return false;
};
var houzez_register_user_with_membership=function (currnt){
var $form=currnt.parents('form');
var $messages=$('#packmem-msgs');
$.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: $form.serialize(),
beforeSend: function (){
currnt.find('.houzez-loader-js').addClass('loader-show');
},
complete: function (){
currnt.find('.houzez-loader-js').removeClass('loader-show');
},
success: function (response){
if(response.success){
houzez_membership_data(currnt);
}else{
$('html, body').animate({
scrollTop: $('.frontend-submission-page').offset()
.top,
},
'slow'
);
$messages
.empty()
.append('<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
response.msg +
'<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>'
);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
};
$('#houzez_complete_membership').on('click', function (e){
e.preventDefault();
var currnt=$(this);
if(parseInt(userID, 10)===0||userID==undefined){
houzez_register_user_with_membership(currnt);
return;
}
houzez_membership_data(currnt);
});
var areaSwitcherList=$('#area-switcher-list-js');
if(areaSwitcherList.length > 0){
$('#area-switcher-list-js > li').on('click', function (e){
var selectedAreaCode=$(this).data('area-code');
if(selectedAreaCode){
$('#houzez-switch-to-area').val(selectedAreaCode);
var houzez_switch_to_area=$('#houzez-switch-to-area').val();
fave_processing_modal(processing_text);
$.ajax({
url: ajaxurl,
dataType: 'JSON',
method: 'POST',
data: {
action: 'houzez_switch_area',
switch_to_area: houzez_switch_to_area,
},
success: function (res){
if(res.success){
window.location.reload(true);
}else{
console.log(res);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
}});
}
var currencySwitcherList=$('#hz-currency-switcher-list');
if(currencySwitcherList.length > 0){
$('#hz-currency-switcher-list > li').on('click', function (e){
var selectedCurrencyCode=$(this).data('currency-code');
if(selectedCurrencyCode){
$('#houzez-switch-to-currency').val(selectedCurrencyCode);
var houzez_switch_to_currency=$(
'#houzez-switch-to-currency'
).val();
fave_processing_modal(processing_text);
$.ajax({
url: ajaxurl,
dataType: 'JSON',
method: 'POST',
data: {
action: 'houzez_currency_converter',
currency_converter: selectedCurrencyCode,
},
success: function (res){
if(res.success){
window.location.reload(true);
}else{
console.log(res);
}},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
}});
}
$('[data-toggle="tooltip"]').tooltip();
$('.advanced-search-dropdown').on('click', function (e){
e.stopPropagation();
});
$('.agent-show-onClick').on('click', function (e){
$(this).toggleClass('agent-phone-hidden');
});
$('.dropdown-menu span.dropdown-toggle').on('click', function (e){
if(!$(this).next().hasClass('show')){
$(this)
.parents('.dropdown-menu')
.first()
.find('.show')
.removeClass('show');
}
var $subMenu=$(this).next('.dropdown-menu');
$subMenu.toggleClass('show');
$(this)
.parents('li.nav-item.dropdown.show')
.on('hidden.bs.dropdown', function (e){
$('.dropdown-submenu .show').removeClass('show');
});
return false;
});
$.fn.nodoubletapzoom=function (){
$(this).bind('touchstart', function preventZoom(e){
var t2=e.timeStamp,
t1=$(this).data('lastTouch')||t2,
dt=t2 - t1,
fingers=e.originalEvent.touches.length;
$(this).data('lastTouch', t2);
if(!dt||dt > 500||fingers > 1) return;
e.preventDefault();
$(this).trigger('click').trigger('click');
});
};
if($('.nav-mobile-js').length > 0){
var smm_transform=256;
if(houzez_rtl){
smm_transform=-256;
}
var slideout_left=new Slideout({
panel: document.getElementById('main-wrap'),
menu: document.getElementById('nav-mobile'),
padding: smm_transform,
tolerance: 70,
side: 'left',
easing: 'cubic-bezier(.32,2,.55,.27)',
});
slideout_left.disableTouch();
}
if($('.main-wrap-js').length > 0&&$('#navi-user').length > 0){
var smd_transform=256;
if(houzez_rtl){
smd_transform=-256;
}
var slideout_right=new Slideout({
panel: document.getElementById('main-wrap'),
menu: document.getElementById('navi-user'),
padding: smd_transform,
tolerance: 70,
side: 'right',
easing: 'cubic-bezier(.32,2,.55,.27)',
});
slideout_right.disableTouch();
}
$('.toggle-button-left, #nav-mobile .nav-link:not(.dropdown-toggle)').on('click',
function (){
slideout_left.toggle();
$('.slideout-menu-left').toggleClass('open');
}
);
$('.toggle-button-right').on('click', function (){
slideout_right.toggle();
$('.slideout-menu-right').toggleClass('open');
});
$(document).on('mouseup', function (e){
var mobileNavcontainer=$('.nav-mobile');
var toggleBtnCloseW=$('.toggle-button-left');
var mobileMenuDiv=$('#nav-mobile');
var toggleBtnCloseL=$('.toggle-button-right');
var mobileMenuDivL=$('#navi-user');
if(!mobileNavcontainer.is(e.target) &&
mobileNavcontainer.has(e.target).length===0 &&
mobileMenuDiv.hasClass('open') &&
!toggleBtnCloseW.is(e.target) &&
toggleBtnCloseW.has(e.target).length===0
){
slideout_left.toggle();
$('.slideout-menu-left').toggleClass('open');
}
if(!mobileNavcontainer.is(e.target) &&
mobileNavcontainer.has(e.target).length===0 &&
mobileMenuDivL.hasClass('open') &&
!toggleBtnCloseL.is(e.target) &&
toggleBtnCloseL.has(e.target).length===0
){
slideout_right.toggle();
$('.slideout-menu-right').toggleClass('open');
}});
$(function (){
if($('.distance-range').length > 0){
$('.distance-range').slider();
}});
function houzez_parallax_listings(){
var header_parallax=$('.parallax');
if(header_parallax.length > 0){
header_parallax.parallaxBackground({
parallaxBgPosition: 'center center',
parallaxBgRepeat: 'no-repeat',
parallaxBgSize: 'cover',
parallaxSpeed: '0.25',
});
}}
houzez_parallax_listings();
$(document).ready(function (){
$('.mobile-search-nav').click(function (){
$('#overlay-search-advanced-module').toggleClass('open');
});
});
$(document).ready(function (){
$(
'.overlay-search-module-close, .overly_is_halfmap .half-map-search-js-btn'
).click(function (){
$('#overlay-search-advanced-module').toggleClass('open');
});
});
function setSectionHeight(){
var window_height=$(window).innerHeight();
var sections_height=window_height - header_area_height;
sections_height=sections_height - advanced_search_nav_height;
sections_height=sections_height - elementor_location_header_height;
if($(window).width() >=767){
$('.half-map-left-wrap, .half-map-right-wrap').css('height',
sections_height
);
}else{
$('.map-on-right .half-map-right-wrap').css('height',
sections_height
);
$('.map-on-right .half-map-left-wrap').css('height', '100vh');
$('.map-on-left .half-map-right-wrap').css('height',
sections_height
);
$('.map-on-left .half-map-left-wrap').css('height', '100vh');
}}
setSectionHeight();
$win.on('resize', function (){
setSectionHeight();
});
$('.switch-btn').on('click', function (){
$('.switch-btn').removeClass('active');
$(this).addClass('active');
if($(this).hasClass('btn-list')){
$('.listing-view').removeClass('grid-view').addClass('list-view');
}else if($(this).hasClass('btn-grid')){
$('.listing-view').removeClass('list-view').addClass('grid-view');
}});
$(document).ready(function (){
$('.show-compare-panel').click(function (){
$(this).toggleClass('active');
$('.compare-property-active').addClass('compare-property-active-push-toleft'
);
$('#compare-property-panel').addClass('compare-property-panel-open'
);
});
$('.close-compare-panel').click(function (){
$(this).toggleClass('active');
$('.compare-property-active').removeClass('compare-property-active-push-toleft'
);
$('#compare-property-panel').removeClass('compare-property-panel-open'
);
});
});
var property_banner_slider=$('.property-slider');
if(property_banner_slider.length > 0){
var autoplay=property_banner_slider.data('autoplay');
var slider_loop=property_banner_slider.data('loop');
var slider_speed=property_banner_slider.data('speed');
var s_loop=false;
if(slider_loop==1){
s_loop=true;
}
property_banner_slider.slick({
rtl: houzez_rtl,
autoplay: autoplay,
autoplaySpeed: slider_speed,
lazyLoad: 'ondemand',
infinite: s_loop,
speed: 300,
slidesToShow: 1,
arrows: true,
adaptiveHeight: true,
});
}
$(window).on('load', function (){
var property_detail_gallery=$('#property-gallery-js');
if(property_detail_gallery.length > 0){
property_detail_gallery.lightSlider({
rtl: houzez_rtl,
gallery: true,
item: 1,
thumbItem: 8,
slideMargin: 0,
speed: 500,
adaptiveHeight: true,
auto: false,
loop: false,
prevHtml:
'<button type="button" class="slick-prev slick-arrow"></button>',
nextHtml:
'<button type="button" class="slick-next slick-arrow"></button>',
onSliderLoad: function (){
property_detail_gallery.removeClass('cS-hidden');
property_detail_gallery.refresh();
},
});
}});
var lightbox_slider_js=$('#lightbox-slider-js');
if(lightbox_slider_js.length > 0){
lightbox_slider_js.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: true,
speed: 300,
slidesToShow: 1,
arrows: true,
adaptiveHeight: true,
});
$('.houzez-trigger-popup-slider-js').on('click', function (e){
e.preventDefault();
var slider_num=parseInt($(this).data('slider-no'));
setTimeout(function (){
lightbox_slider_js.slick('slickGoTo', slider_num - 1);
}, 200);
});
}
var listing_slider_variable_width=$('.listing-slider-variable-width');
if(listing_slider_variable_width.length > 0){
listing_slider_variable_width.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: true,
speed: 300,
slidesToShow: 1,
centerMode: true,
variableWidth: true,
arrows: true,
adaptiveHeight: true,
});
$('.property-detail-v5 #pills-gallery-tab').on('click', function (){
if(!listing_slider_variable_width.hasClass('hz-slick-refreshed')){
setTimeout(function (){
listing_slider_variable_width.slick('setPosition');
listing_slider_variable_width.slick('refresh');
listing_slider_variable_width.addClass('hz-slick-refreshed'
);
}, 0);
}});
}
var testimonials_slider_v1=$('.testimonials-slider-wrap-v1');
if(testimonials_slider_v1.length > 0){
testimonials_slider_v1.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: true,
autoplay: true,
speed: 300,
slidesToShow: 1,
arrows: true,
adaptiveHeight: true,
dots: true,
appendArrows: '.testimonials-module-slider-v1',
prevArrow:
'<button type="button" class="slick-prev btn-primary-outlined">' +
prev_text +
'</button>',
nextArrow:
'<button type="button" class="slick-next btn-primary-outlined">' +
next_text +
'</button>',
});
}
var testimonials_slider_v2=$('.testimonials-slider-wrap-v2');
if(testimonials_slider_v2.length > 0){
testimonials_slider_v2.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: true,
autoplay: true,
speed: 300,
slidesToShow: 3,
arrows: true,
adaptiveHeight: true,
dots: true,
appendArrows: '.testimonials-module-slider-v2',
prevArrow:
'<button type="button" class="slick-prev btn-primary-outlined">' +
prev_text +
'</button>',
nextArrow:
'<button type="button" class="slick-next btn-primary-outlined">' +
next_text +
'</button>',
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
},
},
{
breakpoint: 769,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
}
var testimonials_slider_v3=$('.testimonials-slider-wrap-v3');
if(testimonials_slider_v3.length > 0){
testimonials_slider_v3.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: true,
fade: true,
autoplay: true,
speed: 300,
slidesToShow: 1,
arrows: true,
adaptiveHeight: true,
dots: false,
appendArrows: '.testimonials-module-slider-v3',
prevArrow: $('.slick-prev'),
nextArrow: $('.slick-next'),
});
}
var houzez_custom_carousel=$('.custom-carousel');
if(houzez_custom_carousel.length > 0){
$('.custom-carousel').each(function (){
var token=$(this).data('token');
var carouselSettings=$(this).data('carousel');
$('.custom-carousel-js-' + token).slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
autoplay: carouselSettings.slide_auto==='true',
autoplaySpeed: parseInt(carouselSettings.auto_speed)||3000,
infinite: carouselSettings.slide_infinite==='true',
speed: 500,
slidesToShow: parseInt(carouselSettings.slides_to_show)||3,
slidesToScroll:
parseInt(carouselSettings.slides_to_scroll)||1,
arrows: carouselSettings.navigation==='true',
adaptiveHeight: true,
dots: carouselSettings.slide_dots==='true',
appendArrows: '.custom-carousel-js-wrap-' + token,
prevArrow: $('.slick-prev-js-' + token),
nextArrow: $('.slick-next-js-' + token),
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
},
},
{
breakpoint: 769,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
});
}
var partners_carousel=$('.partners-slider-wrap');
if(partners_carousel.length > 0){
partners_carousel.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: true,
speed: 300,
slidesToShow: 4,
arrows: true,
adaptiveHeight: true,
dots: true,
appendArrows: '.partners-module-slider',
prevArrow: $('.partner-prev-js'),
nextArrow: $('.partner-next-js'),
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 2,
slidesToScroll: 2,
},
},
{
breakpoint: 769,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
}
var schedule_tour_day=$('.property-schedule-tour-day-form-slide-v2');
if(schedule_tour_day.length > 0){
schedule_tour_day.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: false,
speed: 300,
slidesToShow: 3,
slidesToScroll: 3,
arrows: true,
adaptiveHeight: false,
dots: false,
prevArrow: $('.tour-day-form-slide-arrow.sche-tabs-prev-js'),
nextArrow: $('.tour-day-form-slide-arrow.sche-tabs-next-js'),
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
},
},
{
breakpoint: 769,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
},
},
],
});
}
var schedule_tour_day2=$(
'.property-schedule-tour-day-form-slide-v2-bottom'
);
if(schedule_tour_day2.length > 0){
schedule_tour_day2.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: false,
speed: 300,
slidesToShow: 4,
slidesToScroll: 4,
arrows: true,
adaptiveHeight: false,
dots: false,
prevArrow: $('.tour-day-form-slide-arrow.sche-prev-js'),
nextArrow: $('.tour-day-form-slide-arrow.sche-next-js'),
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 4,
slidesToScroll: 4,
},
},
{
breakpoint: 769,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
},
},
],
});
}
var widget_featured_carousel=$('.widget-featured-property-slider');
if(widget_featured_carousel.length > 0){
widget_featured_carousel.slick({
rtl: houzez_rtl,
speed: 300,
slidesToShow: 1,
arrows: true,
adaptiveHeight: true,
dots: true,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 769,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
}
$(document).ready(function (){
$('.btn-expand').click(function (){
$('.lightbox-gallery-wrap').toggleClass('lightbox-gallery-full-wrap'
);
$('#lightbox-slider-js').slick('refresh');
});
$('.btn-email').click(function (){
$('.lightbox-form-wrap').toggleClass('lightbox-form-wrap-show');
});
});
var houzez_listing_nav=$('.property-navigation-wrap');
if(houzez_listing_nav.length > 0){
$(document).scroll(function (){
var y=$(this).scrollTop();
houzez_listing_nav.css('top', houzezStickyTop);
if(y > 300){
houzez_listing_nav.fadeIn(250);
}else{
houzez_listing_nav.fadeOut(0);
}});
$('.property-navigation-item a.target').click(function (event){
event.preventDefault();
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top - 84,
},
500
);
});
$(window).on('scroll', function (){
$('.property-section-wrap').each(function (){
if($(window).scrollTop() >=$(this).offset().top - 86){
var id=$(this).attr('id');
$('.target').removeClass('active');
$('.target[href="#' + id + '"]').addClass('active');
}else if($(window).scrollTop() <=0){
$('.target').removeClass('active');
}});
});
}
function setCalendarCellHeight(){
var calendarCellWidth=$(
'.block-availability-calendars .search-calendar li'
).innerWidth();
$('.block-availability-calendars .search-calendar li').css('height',
calendarCellWidth
);
$('.block-availability-calendars .search-calendar li').css('line-height',
calendarCellWidth + 'px'
);
}
setCalendarCellHeight();
$win.on('resize', function (){
setCalendarCellHeight();
});
$('.login-link a').on('click', function (){
$('.modal-toggle-1').addClass('active');
$('.modal-toggle-2').removeClass('active');
$('.register-form-tab').removeClass('active').removeClass('show');
$('.login-form-tab').addClass('active').addClass('show');
});
$('.register-link a').click(function (){
$('.modal-toggle-2').addClass('active');
$('.modal-toggle-1').removeClass('active');
$('.register-form-tab').addClass('active').addClass('show');
$('.login-form-tab').removeClass('active').removeClass('show');
});
if($('.db_input_date').length > 0){
$('.db_input_date').datepicker({
format: 'yyyy-mm-dd',
clearBtn: true,
autoclose: true,
language: houzez_date_language,
});
}
if(houzez_is_mobile){
}else{
if($('.deals-table-wrap').length > 0){
$('.deals-table-wrap').overlayScrollbars({
overflowBehavior: {
x: 'scroll',
y: 'scroll',
},
});
}}
var listing_nav_area_height=$('.property-navigation-wrap').innerHeight();
if(listing_nav_area_height==null){
listing_nav_area_height=0;
}
if($('.houzez_sticky').length > 0){
$('.houzez_sticky').theiaStickySidebar({
additionalMarginTop:
houzezStickyTop +
advanced_search_nav_height +
listing_nav_area_height,
minWidth: 768,
updateSidebarHeight: false,
});
}
function resizeMasonryItem(item){
var grid=document.getElementsByClassName('masonry')[0],
rowGap=parseInt(
window.getComputedStyle(grid).getPropertyValue('grid-row-gap')
),
rowHeight=parseInt(
window.getComputedStyle(grid).getPropertyValue('grid-auto-rows')
);
var rowSpan=Math.ceil((item.querySelector('.masonry-content').getBoundingClientRect()
.height +
rowGap) /
(rowHeight + rowGap)
);
item.style.gridRowEnd='span ' + rowSpan;
}
function resizeAllMasonryItems(){
var allItems=document.getElementsByClassName('masonry-brick');
for (var i=0; i > allItems.length; i++){
resizeMasonryItem(allItems[i]);
}}
if($('.page-template-blog-masonry').length > 0){
var waitForImages=function (){
var allItems=document.getElementsByClassName('masonry-brick');
for (var i=0; i < allItems.length; i++){
imagesLoaded(allItems[i], function (instance){
var item=instance.elements[0];
resizeMasonryItem(item);
});
}};
var masonryEvents=['load', 'resize'];
masonryEvents.forEach(function (event){
window.addEventListener(event, resizeAllMasonryItems);
});
waitForImages();
}
var splash_slider_wrap=$('.splash-slider-wrap');
if(splash_slider_wrap.length > 0){
splash_slider_wrap.slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
adaptiveHeight: true,
autoplay: true,
infinite: true,
speed: 300,
fade: true,
slidesToShow: 1,
arrows: false,
});
}
houzez_init_add_favorite(ajaxurl, userID);
houzez_init_remove_favorite(ajaxurl, userID);
houzez_check_favourites(userID);
function getWindowWidth(){
return Math.max($(window).width(), window.innerWidth);
}
function getWindowHeight(){
return Math.max($(window).height(), window.innerHeight);
}
$('.houzez-woocommerce-pay').on('click', function (e){
e.preventDefault();
let listID=$(this).data('listid');
let is_featured=$(this).data('featured');
fave_processing_modal(processing_text);
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_perlist_woo_pay',
listing_id: listID,
is_featured: is_featured,
},
success: function (data){
if(data.success!=false){
window.location.href=houzez_vars.woo_checkout_url;
}else{
jQuery('#fave_modal').modal('hide');
}},
error: function (errorThrown){},
});
});
$('.houzez-woocommerce-package').on('click', function (e){
e.preventDefault();
if(parseInt(userID, 10)===0||userID==undefined){
jQuery('#login-register-form').modal('show');
jQuery('.login-form-tab').addClass('active show');
jQuery('.modal-toggle-1.nav-link').addClass('active');
}else{
let packid=$(this).data('packid');
fave_processing_modal(processing_text);
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
action: 'houzez_woo_pay_package',
package_id: packid,
},
success: function (data){
if(data.success!=false){
window.location.href=houzez_vars.woo_checkout_url;
}else{
jQuery('#fave_modal').modal('hide');
}},
error: function (errorThrown){},
});
}});
var setTopBannerFullScreen=function (){
var totalTopBarsHeight=0;
var searchH=0;
var topBarH=0;
var totalBannerHeight=0;
var window_height=$(window).innerHeight();
var admin_bar=$('#wpadminbar');
var topBarB=$('.top-bar-wrap');
var admin_bar_height=admin_bar.outerHeight();
searchH=window_height - header_area_height;
if(header_area.hasClass('header-transparent-wrap')){
if(topBarB.length){
topBarH=topBarB.outerHeight();
}
totalBannerHeight =
getWindowHeight() - (topBarH + admin_bar_height);
}else{
if(header_area.length &&
advanced_search_nav.length &&
!advanced_search_nav.hasClass('search-hidden')
){
totalTopBarsHeight =
parseInt(header_area_height) +
parseInt(advanced_search_nav_height);
}else if(header_area.length){
totalTopBarsHeight=parseInt(header_area_height);
}
totalBannerHeight =
getWindowHeight() - (totalTopBarsHeight + admin_bar_height);
}
$('.top-banner-wrap-fullscreen').css('height', totalBannerHeight);
};
if(!houzez_is_splash&&$('.top-banner-wrap-fullscreen').length > 0){
$(document).ready(function (){
setTopBannerFullScreen();
});
$(window).on('resize', function (){
setTopBannerFullScreen();
});
}
$(document).ready(function (){
$('.compare-property-label').on('click', function (){
$(this).toggleClass('active');
$('.compare-property-active').addClass('compare-property-active-push-toleft'
);
$('#compare-property-panel').addClass('compare-property-panel-open'
);
});
$('.close-compare-panel').on('click', function (){
$(this).toggleClass('active');
$('.compare-property-active').removeClass('compare-property-active-push-toleft'
);
$('#compare-property-panel').removeClass('compare-property-panel-open'
);
});
var listings_compare=houzezGetCookie('houzez_compare_listings');
var limit_item_compare=4;
add_to_compare(
compare_url,
compare_add_icon,
compare_remove_icon,
add_compare_text,
remove_compare_text,
compare_limit,
listings_compare,
limit_item_compare
);
remove_from_compare(
listings_compare,
compare_add_icon,
compare_remove_icon,
add_compare_text,
remove_compare_text
);
});
function compare_for_ajax(){
var listings_compare=houzezGetCookie('houzez_compare_listings');
var limit_item_compare=4;
add_to_compare(
compare_url,
compare_add_icon,
compare_remove_icon,
add_compare_text,
remove_compare_text,
compare_limit,
listings_compare,
limit_item_compare
);
remove_from_compare(
listings_compare,
compare_add_icon,
compare_remove_icon,
add_compare_text,
remove_compare_text
);
}
$(
'.houzez-onepage-mode .header-main-wrap .main-nav li.nav-item a.nav-link'
).on('click', function (e){
var currentUrl=$(this).attr('href');
window.history.pushState({ houzezTheme: true }, '', currentUrl);
});
houzez_render_compare_properties_data();
function houzez_render_compare_properties_data(){
let compare_listings=JSON.parse(localStorage.getItem('houzez_compare_listings')
);
if(compare_listings&&compare_listings.length > 0){
let properties_array='';
compare_listings.forEach(function (item){
let img=item.image;
let listingId=item.id;
properties_array +=
'<div class="compare-item remove-' +
listingId +
'">' +
'<a href="#" class="remove-compare remove-icon" data-listing_id="' +
listingId +
'">' +
'<i class="houzez-icon icon-remove-circle"></i></a>' +
'<img class="img-fluid" src="' +
img +
'" width="200" height="150" alt="Thumb">' +
'</div>';
});
jQuery('.compare-wrap').html(properties_array);
}}
})(jQuery);
function houzezSetCookie(cname, cvalue, exdays){
var d=new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
var expires='expires=' + d.toUTCString();
document.cookie=cname + '=' + cvalue + ';' + expires + ';path=/';
}
function houzezGetCookie(cname){
var name=cname + '=';
var decodedCookie=decodeURIComponent(document.cookie);
var ca=decodedCookie.split(';');
for (var i=0; i < ca.length; i++){
var c=ca[i];
while (c.charAt(0)==' '){
c=c.substring(1);
}
if(c.indexOf(name)==0){
return c.substring(name.length, c.length);
}}
return '';
}
function fave_processing_modal(msg){
var process_modal =
'<div class="modal fade" id="fave_modal" tabindex="-1" role="dialog" aria-labelledby="faveModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-body houzez_messages_modal">' +
msg +
'</div></div></div></div></div>';
jQuery('body').append(process_modal);
jQuery('#fave_modal').modal();
}
function fave_processing_modal_close(){
jQuery('#fave_modal').modal('hide');
}
function houzez_grid_image_gallery(){
if(houzez_vars.disable_property_gallery==1){
var gallery_behaviour=houzez_vars.grid_gallery_behaviour;
var houzez_rtl=houzez_vars.houzez_rtl==='yes';
jQuery('.hz-item-gallery-js').each(function (){
var $this=jQuery(this);
if(!$this.hasClass('houzez-gallery-loaded') &&
$this.data('images')
){
var href=$this.find('a.listing-featured-thumb').attr('href');
var link_target=$this
.find('a.listing-featured-thumb')
.attr('target');
var images=$this.data('images');
var fragment=document.createDocumentFragment();
var galleryWrap=document.createElement('div');
galleryWrap.className =
'listing-gallery-wrap ' + gallery_behaviour;
var carouselDiv=document.createElement('div');
carouselDiv.className='houzez-listing-carousel';
images.forEach(function (image){
var itemDiv=document.createElement('div');
itemDiv.className='item';
var anchor=document.createElement('a');
anchor.className='hover-effect';
anchor.href=href;
anchor.target=link_target;
var img=document.createElement('img');
img.src=image.image;
img.alt=image.alt;
img.width=image.width;
img.height=image.height;
img.className='img-fluid';
anchor.appendChild(img);
itemDiv.appendChild(anchor);
carouselDiv.appendChild(itemDiv);
});
galleryWrap.appendChild(carouselDiv);
fragment.appendChild(galleryWrap);
$this.find('.listing-image-wrap').html(fragment);
jQuery(
'.item-wrap-v6 .listing-gallery-wrap .item a'
).removeClass('hover-effect');
var listing_slider=$this.find('.houzez-listing-carousel');
listing_slider.slick({
rtl: houzez_rtl,
autoplay: false,
lazyLoad: 'ondemand',
infinite: false,
speed: 300,
slidesToShow: 1,
arrows: true,
prevArrow:
'<button type="button" class="slick-prev slick-arrow"></button>',
nextArrow:
'<button type="button" class="slick-next slick-arrow"></button>',
adaptiveHeight: true,
});
is_listing_gallery_slider=true;
$this.addClass('houzez-gallery-loaded');
}});
}
jQuery(document).on('click', '.switch-btn', function (){
jQuery('.hz-item-gallery-js .houzez-listing-carousel').slick('refresh');
});
}
function houzez_listing_lightbox(ajaxurl, processing_text, houzez_rtl, userID){
jQuery('.hz-show-lightbox-js').on('click', function (){
var listing_id=jQuery(this).data('listid');
var $parents=jQuery(this).parents('.item-wrap');
var preview_loader=$parents.find('.preview_loader');
jQuery.ajax({
type: 'post',
url: ajaxurl,
data: {
action: 'load_lightbox_content',
listing_id: listing_id,
},
beforeSend: function (){
preview_loader
.empty()
.append('' +
'<div class="houzez-overlay-loading">' +
'<div class="overlay-placeholder">' +
'<div class="loader-ripple spinner">' +
'<div class="bounce1"></div>' +
'<div class="bounce2"></div>' +
'<div class="bounce3"></div>' +
'</div>' +
'</div>' +
'</div>'
);
},
complete: function (){
preview_loader.empty();
},
success: function (response){
jQuery('#hz-listing-model-content').html(response);
jQuery('#houzez-listing-lightbox').modal('show');
jQuery('.lightbox-slider').not('.slick-initialized').slick({
rtl: houzez_rtl,
lazyLoad: 'ondemand',
infinite: true,
speed: 300,
slidesToShow: 1,
arrows: true,
adaptiveHeight: true,
});
jQuery('#houzez-listing-lightbox').on('shown.bs.modal',
function (e){
jQuery('.lightbox-slider').slick('setPosition');
jQuery('.lightbox-slider').slick('refresh');
}
);
jQuery('.btn-expand').on('click', function (){
jQuery('.lightbox-gallery-wrap').toggleClass('lightbox-gallery-full-wrap'
);
jQuery('.lightbox-slider').slick('setPosition');
});
jQuery('.btn-email').on('click', function (){
jQuery('.lightbox-form-wrap').toggleClass('lightbox-form-wrap-show'
);
});
houzez_init_add_favorite(ajaxurl, userID);
houzez_init_remove_favorite(ajaxurl, userID);
},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
});
}
function houzez_init_add_favorite(ajaxurl, userID){
jQuery('.add-favorite-js').on('click', function (e){
e.preventDefault();
var curnt=jQuery(this);
var listID=jQuery(this).attr('data-listid');
add_to_favorite(ajaxurl, listID, curnt, userID);
return false;
});
}
function houzez_init_remove_favorite(ajaxurl, userID){
jQuery('.remove_fav').on('click', function (){
var curnt=jQuery(this);
var listID=jQuery(this).attr('data-listid');
add_to_favorite(ajaxurl, listID, curnt, userID);
var itemWrap=curnt.parents('tr').remove();
});
}
function add_to_favorite(ajaxurl, listID, curnt, userID){
if(parseInt(userID, 10)===0||userID==undefined){
var add_to_favorite_login_required =
houzez_vars.add_to_favorite_login_required;
if(add_to_favorite_login_required!=0){
jQuery('.register-form-tab').removeClass('active show');
jQuery('.modal-toggle-2.nav-link').removeClass('active');
jQuery('#login-register-form').modal('show');
jQuery('.login-form-tab').addClass('active show');
jQuery('.modal-toggle-1.nav-link').addClass('active');
}else{
add_to_favorite_without_login(curnt);
}}else{
var $parents=curnt.parents('.item-wrap');
var preview_loader=$parents.find('.preview_loader');
jQuery.ajax({
type: 'post',
url: ajaxurl,
dataType: 'json',
data: {
action: 'houzez_add_to_favorite',
listing_id: listID,
},
beforeSend: function (){
preview_loader
.empty()
.append('' +
'<div class="houzez-overlay-loading">' +
'<div class="overlay-placeholder">' +
'<div class="loader-ripple spinner">' +
'<div class="bounce1"></div>' +
'<div class="bounce2"></div>' +
'<div class="bounce3"></div>' +
'</div>' +
'</div>' +
'</div>'
);
},
complete: function (){
preview_loader.empty();
},
success: function (response){
if(response.data.added){
curnt.children('i').addClass('text-danger');
}else{
curnt.children('i').removeClass('text-danger');
}
preview_loader.empty();
},
complete: function (){},
error: function (xhr, status, error){
var err=eval('(' + xhr.responseText + ')');
console.log(err.Message);
},
});
}}
function add_to_favorite_without_login(curnt){
var listings_favorite=houzezGetCookie('houzez_favorite_listings');
if(listings_favorite&&listings_favorite.length){
listings_favorite=listings_favorite.split(',');
}else{
listings_favorite=[];
}
var listing_id=curnt.data('listid');
var index=listings_favorite.indexOf(listing_id.toString());
if(index==-1){
listings_favorite.push(listing_id.toString());
houzezSetCookie(
'houzez_favorite_listings',
listings_favorite.join(','),
30
);
jQuery('span.frvt-count').html('');
jQuery('span.frvt-count').html(listings_favorite.length);
for (var i=0; i < listings_favorite.length; i++){
jQuery(
'.add-favorite-js[data-listid="' + listings_favorite[i] + '"] i'
).addClass('text-danger');
jQuery(
'.add-favorite-js[data-listid="' + listings_favorite[i] + '"]'
).addClass('remove-favorite');
}}else{
listings_favorite.splice(index, 1);
houzezSetCookie(
'houzez_favorite_listings',
listings_favorite.join(','),
30
);
jQuery('span.frvt-count').html('');
jQuery('span.frvt-count').html(listings_favorite.length);
jQuery(
'.add-favorite-js[data-listid="' + listing_id.toString() + '"] i'
).removeClass('text-danger');
jQuery(
'.add-favorite-js[data-listid="' + listing_id.toString() + '"]'
).removeClass('remove-favorite');
}
jQuery('a.favorite-btn').attr('href',
houzez_vars.favorite_url + '?ids=' + listings_favorite
);
return false;
}
function houzez_check_favourites(userID){
if(parseInt(userID, 10)===0||userID==undefined){
var listings_favorite=houzezGetCookie('houzez_favorite_listings');
jQuery('a.favorite-btn').attr('href',
houzez_vars.favorite_url + '?ids=' + listings_favorite
);
if(listings_favorite&&listings_favorite.length){
listings_favorite=listings_favorite.split(',');
if(listings_favorite.length){
for (var i=0; i < listings_favorite.length; i++){
jQuery(
'.add-favorite-js[data-listid="' +
listings_favorite[i] +
'"] i'
).addClass('text-danger');
jQuery(
'.add-favorite-js[data-listid="' +
listings_favorite[i] +
'"]'
).addClass('remove-favorite');
}
jQuery('span.frvt-count').html('');
jQuery('span.frvt-count').html(listings_favorite.length);
}}else{
listings_favorite=[];
}}
}
function add_to_compare(
compare_url,
compare_add_icon,
compare_remove_icon,
add_compare_text,
remove_compare_text,
compare_limit,
listings_compare,
limit_item_compare
){
var storedData=localStorage.getItem('houzez_compare_listings');
var listings_compare=storedData ? JSON.parse(storedData):[];
jQuery('a.compare-btn').attr('href',
compare_url +
'?ids=' +
listings_compare.map((item)=> item.id).join(',')
);
if(listings_compare.length > 0){
jQuery('.compare-property-label').fadeIn(1000);
}
if(listings_compare.length){
for (var i=0; i < listings_compare.length; i++){
jQuery(
'.houzez_compare[data-listing_id="' +
listings_compare[i].id +
'"] i'
)
.removeClass('icon-add-circle')
.addClass('icon-subtract-circle');
jQuery(
'.houzez_compare[data-listing_id="' +
listings_compare[i].id +
'"]'
).attr('title', remove_compare_text);
jQuery(
'.houzez_compare[data-listing_id="' +
listings_compare[i].id +
'"]'
)
.tooltip('hide')
.attr('data-original-title', remove_compare_text);
}
jQuery('.compare-property-label')
.find('.compare-count')
.html(listings_compare.length);
}
jQuery('.houzez_compare').on('click', function (e){
e.preventDefault();
var storedData=localStorage.getItem('houzez_compare_listings');
var listings_compare=storedData ? JSON.parse(storedData):[];
var listing_id=jQuery(this).data('listing_id');
var index=listings_compare.findIndex((item)=> item.id===listing_id.toString()
);
var image_div=jQuery(this).parents('.item-wrap');
var thumb_url=image_div.find('img').attr('src');
if(index==-1){
if(listings_compare.length >=limit_item_compare){
alert(compare_limit);
}else{
jQuery('.compare-wrap').append('<div class="compare-item remove-' +
listing_id +
'"><a href="" class="remove-compare remove-icon" data-listing_id="' +
listing_id +
'"><i class="houzez-icon icon-remove-circle"></i></a><img class="img-fluid" src="' +
thumb_url +
'" width="200" height="150" alt="Thumb"></div>'
);
listings_compare.push({
id: listing_id.toString(),
image: thumb_url,
});
localStorage.setItem('houzez_compare_listings',
JSON.stringify(listings_compare)
);
jQuery(this).attr('title', remove_compare_text);
jQuery(this)
.find('i')
.removeClass('icon-add-circle')
.addClass('icon-subtract-circle');
jQuery('.compare-property-label')
.find('.compare-count')
.html(listings_compare.length);
jQuery('a.compare-btn').attr('href',
compare_url +
'?ids=' +
listings_compare.map((item)=> item.id).join(',')
);
jQuery('.compare-property-label').fadeIn(1000);
jQuery(this).toggleClass('active');
jQuery('.compare-property-active').addClass('compare-property-active-push-toleft'
);
jQuery('#compare-property-panel').addClass('compare-property-panel-open'
);
jQuery(this).tooltip('dispose').tooltip('show');
remove_from_compare(
listings_compare,
compare_add_icon,
compare_remove_icon,
add_compare_text,
remove_compare_text
);
}}else{
jQuery('div.remove-' + listing_id).remove();
jQuery(this).attr('title', add_compare_text);
jQuery(this)
.find('i')
.removeClass('icon-subtract-circle')
.addClass('icon-add-circle');
listings_compare.splice(index, 1);
localStorage.setItem('houzez_compare_listings',
JSON.stringify(listings_compare)
);
jQuery('.compare-property-label')
.find('.compare-count')
.html(listings_compare.length);
jQuery('a.compare-btn').attr('href',
compare_url +
'?ids=' +
listings_compare.map((item)=> item.id).join(',')
);
jQuery(this).tooltip('dispose').tooltip('show');
if(listings_compare.length > 0){
jQuery('.compare-property-label').fadeIn(1000);
jQuery(this).toggleClass('active');
jQuery('.compare-property-active').addClass('compare-property-active-push-toleft'
);
jQuery('#compare-property-panel').addClass('compare-property-panel-open'
);
}else{
jQuery('.compare-property-label').fadeOut(1000);
}}
return false;
});
}
function remove_from_compare(
listings_compare,
compare_add_icon,
compare_remove_icon,
add_compare_text,
remove_compare_text
){
jQuery('.remove-compare')
.off('click')
.on('click', function (e){
e.preventDefault();
var compare_url=houzez_vars.compare_url;
var storedData=localStorage.getItem('houzez_compare_listings');
listings_compare=storedData ? JSON.parse(storedData):[];
var listing_id=jQuery(this).data('listing_id');
var index=listings_compare.findIndex((item)=> item.id===listing_id.toString()
);
if(index!==-1){
listings_compare.splice(index, 1);
localStorage.setItem('houzez_compare_listings',
JSON.stringify(listings_compare)
);
jQuery('.compare-property-label')
.find('.compare-count')
.html(listings_compare.length);
var compareElement=jQuery('.compare-' + listing_id);
if(compareElement.length){
compareElement.attr('title', add_compare_text);
compareElement
.tooltip('hide')
.attr('data-original-title', add_compare_text);
compareElement
.find('i')
.removeClass('icon-subtract-circle')
.addClass('icon-add-circle');
}
jQuery(this).parents('.compare-item').remove();
jQuery('a.compare-btn').attr('href',
compare_url +
'?ids=' +
listings_compare.map((item)=> item.id).join(',')
);
}});
}
function houzez_grid_call_to_action(){
jQuery('.hz-call-popup-js').on('click', function (){
var call_model_id=jQuery(this).data('model-id');
jQuery('#' + call_model_id).appendTo('body');
jQuery('#' + call_model_id).modal('show');
});
jQuery('.hz-email-popup-js').on('click', function (){
var email_model_id=jQuery(this).data('model-id');
jQuery('#' + email_model_id).appendTo('body');
jQuery('#' + email_model_id).modal('show');
});
};
jQuery(document).ready((function(e){}));