(function(){(jQuery.browser=jQuery.browser||{}).mobile=(/android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent.toLowerCase()));}(navigator.userAgent||navigator.vendor||window.opera)); (function($) { $(function() { var $body = $('body'), $navSection = $('#nav-section'); $body.waypoint(function(dir) { if (!$('.nav-mobile.open').length) $navSection.toggleClass('stuck', dir === "down"); }, { offset: -135 }); $body.waypoint(function (dir) { if (!$('.nav-mobile.open').length) $navSection.toggleClass('shrink', dir === "down"); }, { offset: -320 }); if (!$.browser.mobile) { $.stellar(); } else { $('.parallax, #home-search-section').css({'background-position': '50% 50%', 'background-size': 'cover', 'background-attachment': 'scroll'}); } $(document).on('click', '.advanced-search', function(e) { e.preventDefault(); $("#home-advanced-search .container").css({"overflow": "hidden"}); $("#home-advanced-search").toggleClass("open"); if ($("#home-advanced-search").hasClass("open")) { setTimeout(function () { $("#home-advanced-search .container").css({"overflow": "visible"}); }, 400); } }); if ($('select').length) { $("select").chosen({ allow_single_deselect: true, disable_search_threshold: 12, }); $(".chzn-drop, .chzn-search > input").each(function() { $(this).attr('style', 'width: 100%'); }); } $(document).on('click', '.btn-search', function(e) { e.preventDefault(); }); if ($('#undertakings-slider')) { $("#undertakings-slider").owlCarousel({ autoPlay: true, itemsCustom : [ [0, 1], [975, 2], ], stopOnHover: true, }); } if ($("#saleables-slider").length) { $("#saleables-slider").owlCarousel({ autoPlay: true, itemsCustom : [ [0, 1], [590, 2], [751, 2], [975, 3], [1183, 4], [1440, 4], [1728, 4] ], stopOnHover: true, }); } if ($("#rentables-slider").length) { $("#rentables-slider").owlCarousel({ autoPlay: true, itemsCustom : [ [0, 1], [590, 2], [751, 2], [975, 3], [1183, 4], [1440, 4], [1728, 4] ], stopOnHover: true, }); } if ($("#seasonables-slider").length) { $("#seasonables-slider").owlCarousel({ autoPlay: true, itemsCustom : [ [0, 1], [590, 2], [751, 2], [975, 3], [1183, 4], [1440, 4], [1728, 4] ], stopOnHover: true, }); } var animate = function () { $('[data-animation-delay]').each(function () { var $this = $(this), s = $(window).scrollTop(), h = $(window).height(), d = parseInt($this.attr('data-animation-delay'), 10), dir = $this.data('animation-direction'); if (dir === undefined) { return false; } $this.addClass('animate-' + dir); if (s + h >= $this.offset().top) { if (isNaN(d) || d === 0) { $this.removeClass('animate-' + dir).addClass('animation-' + dir); } else { setTimeout(function () { $this.removeClass('animate-me').addClass('animation-' + dir); }, d); } } }); }; if ($(window).innerWidth() >= 751) { $(window).scroll(function () { animate(); }); animate(); } if ($('#filters').length && !$.browser.mobile) { $('#filters').stick_in_parent(); } if ($('#contact-sticky').length && !$.browser.mobile) { $('#contact-sticky').stick_in_parent(); } $(document).on('click', '[data-view]', function() { $($(this).data('target')).removeClass().addClass($(this).data('view')); }); if ($("#property-detail-large").length && $("#property-detail-thumbs").length) { var sync1 = $("#property-detail-large"), sync2 = $("#property-detail-thumbs"), center = function (number) { var sync2visible = sync2.data("owlCarousel").owl.visibleItems, num = number, found = false, i; for (i = 0; i < sync2visible.lenght - 1; i += 1) { if (num === sync2visible[i]) { found = true; } } if (found === false) { if (num > sync2visible[sync2visible.length - 1]) { sync2.trigger("owl.goTo", num - sync2visible.length + 2); } else { if (num - 1 === -1) { num = 0; } sync2.trigger("owl.goTo", num); } } else if (num === sync2visible[sync2visible.length - 1]) { sync2.trigger("owl.goTo", sync2visible[1]); } else if (num === sync2visible[0]) { sync2.trigger("owl.goTo", num - 1); } }, syncPosition = function () { /*jshint validthis: true */ var current = this.currentItem; $("#property-detail-thumbs") .find(".owl-item") .removeClass("synced") .eq(current) .addClass("synced"); if (sync2.data("owlCarousel") !== undefined) { center(current); } }; $(".item", sync2).each(function () { var $item = $(this); $item.css({'background-image': 'url(' + $('img', $item).attr('src') + ')'}); $('img', $item).remove(); }); sync1.owlCarousel({ singleItem : true, slideSpeed : 1000, navigation: false, pagination: false, autoHeight : true, afterAction : syncPosition, responsiveRefreshRate : 200 }); sync2.owlCarousel({ itemsCustom : [ [0, 2], [300, 3], [629, 4], [751, 3], [975, 4], [1183, 5] ], pagination: true, responsiveRefreshRate : 100, afterInit : function (el) { el.find(".owl-item").eq(0).addClass("synced"); } }); $("#property-detail-thumbs").on("click", ".owl-item", function (e) { e.preventDefault(); var number = $(this).data("owlItem"); sync1.trigger("owl.goTo", number); }); $('.prettyphoto').prettyPhoto(); } $(window).on('resize', function (w) { var $this = this, $wrapper = $('#wrapper'), $navMobile, etype = $.browser.mobile ? 'touchstart' : 'click'; if (w !== null) { w = $(window).innerWidth(); } if (w <= 975 && !$this.mobMenuFlag) { $('body').prepend(''); $('.nav-mobile > ul').html($('.nav').html()); $('.nav-mobile b').remove(); $('.nav-mobile ul.dropdown-menu').removeClass().addClass("dropdown-mobile"); //$('.nav-mobile').css({'min-height': ($('#wrapper').height() + 270) + 'px' }); $navMobile = $(".nav-mobile"); $("#nav-mobile-btn").bind(etype, function (e) { e.stopPropagation(); e.preventDefault(); setTimeout(function () { $wrapper.addClass('open'); $navMobile.addClass('open'); }, 25); $(document).bind(etype, function (e) { if (!$(e.target).hasClass('nav-mobile') && !$(e.target).parents('.nav-mobile').length) { $wrapper.removeClass('open'); $navMobile.removeClass('open'); $(document).unbind(etype); } }); $('>i', $navMobile).bind(etype, function () { $wrapper.removeClass('open'); $navMobile.removeClass('open'); $(document).unbind(etype); }); }); $this.mobMenuFlag = true; } }).trigger('resize'); }); })(jQuery) 'use strict'; $(function() { $(document).on('click', '[data-target][data-value]', function() { var $this = $(this), $target = $($this.data('target')); $target.val($this.data('value')); $target.trigger('change'); if($this.hasClass('btn')) { $this.addClass('active').siblings().removeClass('active') } }); $(document).on('keyup', 'input', function(e) { if(e.keyCode == 13 || e.which == 13) $('#apply-filters').trigger('click'); }); $(document).on('change', '.search-status', function(e) { $('.undertaking-field').toggleClass('hidden', this.value.match(/prontos/) !== null); $('.built-field').toggleClass('hidden', this.value.match(/lancamentos/) !== null); }); $(document).on('click', '#apply-filters', function() { window.location = 'http://corretor-teste.minhaimob.com.br/'+buildQuery('.search-input').join('/'); }); $(document).on('change', '#ordenar-por, #por-pagina', function() { $('#apply-filters').trigger('click'); }); $(document).on('click', '#toggle-filters', function() { var s = $(this).find('span'); s.text(s.text() == 'Abrir'?'Fechar':'Abrir'); $('#filters').toggleClass('open'); }); function buildQuery(selector) { var query = []; $(selector).each(function() { var $this = $(this); if(($this.val() && $this.attr('type') != 'radio') || ($this.attr('type') == 'radio' && $this.prop('checked') && $this.val())) { switch($this.attr('name')) { case 'bairro': case 'condominio': case 'construtora': if($this.attr('multiple')) { var values = $this.val(); for(var i in values) { if(values[i].length > 0) { query.push($this.attr('name')); query.push(values[i]); } } } else { query.push($this.attr('name')); query.push($this.val()); } break; case "palavra-chave": query.push($this.attr('name')); query.push($this.val());//.replace(/\s/g, '-')); break; case 'area': if(this.value.match(/\-/)) { var value = this.value.split('-'); query.push('area-de'); query.push(value[0]); query.push('area-ate'); query.push(value[1]); } else { query.push('area-de'); query.push(this.value); } break; case 'valor': if(this.value.match(/\-/)) { var value = this.value.split('-'); query.push('preco-de'); query.push(value[0]); query.push('preco-ate'); query.push(value[1]); } else { query.push('preco-de'); query.push(this.value); } break; case 'status': query.push($this.val()) break; case "tipo": $this.find('option:selected').each(function() { var ti = $(this).closest('optgroup').data('value'); var tp = $(this).val(); if(ti && (query.indexOf(ti) == -1 || query.indexOf('tipo-de-imovel') == -1)) { query.push('tipo-de-imovel'); query.push($(this).closest('optgroup').data('value')); } if(query.indexOf(tp) == -1 || query.indexOf('tipo') == -1) { query.push('tipo'); query.push($(this).val()); } }); break; default: query.push($this.attr('name')); query.push($this.val()); } } }); return query; } }); "use strict";$(function(){var tries=0;function randomNumber(min,max){return Math.floor(Math.random()*(max-min+1)+min);} function generateCaptcha(){$('#captchaOperation').html([randomNumber(1,100),'+',randomNumber(1,200),'='].join(' '));} function maskBehavior(val){return val.replace(/\D/g,'').length===11?'(00) 00000-0000':'(00) 0000-00009';} $('.form-contact').formValidation({framework:'bootstrap',locale:'pt_BR',icon:{valid:'glyphicon glyphicon-ok',invalid:'glyphicon glyphicon-remove',validating:'glyphicon glyphicon-refresh'},trigger:'submit',}).on('err.form.fv',function(e){tries++;}).on('success.form.fv',function(e){e.preventDefault();var form=$(this),btn=$("#btn-contact");if(form.find('[readonly]').length||btn.prop('disabled')) return;btn.prop('disabled',true);if(typeof Cookies=='function') Cookies.set('name',$(this).find('[name=name]').val(),{expires:30});form.ajaxSubmit({error:function(){btn.prop('disabled',false);},success:function(response){$('.form-contact').find(':input').prop('readonly',true);$('.form-contact').find('button').prop('disabled',true);if(response&&typeof bootbox=='object'){var modal=$('#modal-contact.in');if(modal.length){modal.one('hidden.bs.modal',function(){bootbox.alert('Muito Obrigado! Seu contato foi registrado, em breve entraremos em contato.');});modal.modal('hide');} else bootbox.alert('Muito Obrigado! Seu contato foi registrado, em breve entraremos em contato.');window.dispatchEvent(new Event('FORM_SUBMIT_OK'));}}});});$('a.chat').click(function(e){e.preventDefault();window.open($(this).attr('href'),'Chat','height=600, location=no, menubar=no, resizable=no, status=no, toolbar=no, width=400');return false;});if(typeof Cookies=='function') $('#form-contact').find('[name=name]').val(Cookies.get('name')) if(typeof $.fn.mask=='function') $('.phone').mask(maskBehavior,{onKeyPress:function(val,e,field,options){field.mask(maskBehavior.apply({},arguments),options);}});var cc=true;setTimeout(function(){if(cc) $('#talk-with-us').addClass('active');},0);$(document).on('show.bs.modal',function(){$('.modal-dialog').velocity('transition.expandIn');});$(document).on('click','.dismiss-callout',function(e){e.preventDefault();var $twu=$('#talk-with-us');$twu.removeClass();setTimeout(function(){$twu.addClass('secondary');},3000);})});