1if (window.location.href == "https://refugiosurbanos.com.br/") { 2 window.location.href = 'https://refugiosurbanos.com.br/imoveis'; 3 console.log('redirecionou'); 4} 5$(function () { 6 7 var $cepContato = $('form.wpcf7-form input[name="cep"]'); 8 9 if ($cepContato.length) { 10 var camposEndereco = 'input[name="logradouro"], input[name="numero"], input[name="complemento"], input[name="bairro"]'; 11 var bloquearCamposEndereco = function ($form, bloquear) { 12 $form.find(camposEndereco).prop('readonly', bloquear); 13 }; 14 15 if ($.fn.mask) { 16 $cepContato.mask('00000-000'); 17 } 18 19 $cepContato.each(function () { 20 bloquearCamposEndereco($(this).closest('form'), true); 21 }); 22 23 $cepContato.on('input', function () { 24 var $form = $(this).closest('form'); 25 var cep = $(this).val().replace(/\D/g, ''); 26 27 bloquearCamposEndereco($form, cep.length !== 8); 28 }); 29 30 $cepContato.on('blur', function () { 31 var $form = $(this).closest('form'); 32 var cep = $(this).val().replace(/\D/g, ''); 33 34 if (cep.length !== 8) { 35 bloquearCamposEndereco($form, true); 36 return; 37 } 38 39 bloquearCamposEndereco($form, false); 40 41 $.getJSON('https://viacep.com.br/ws/' + cep + '/json/', function (endereco) { 42 if (endereco.erro) { 43 return; 44 } 45 46 $form.find('input[name="logradouro"]').val(endereco.logradouro || ''); 47 $form.find('input[name="bairro"]').val(endereco.bairro || ''); 48 }); 49 }); 50 } 51 52 var $formVendaImovel = $('div[id^="wpcf7-f2816"] form.wpcf7-form'); 53 if ($formVendaImovel.length && $.fn.mask) { 54 $formVendaImovel.find('input[name="ddd"]').mask('00'); 55 56 var telefoneVendaMask = function (val) { 57 return val.replace(/\D/g, '').length === 9 ? '000000000' : '000000009'; 58 }; 59 60 $formVendaImovel.find('input[name="telefone"]').mask(telefoneVendaMask, { 61 onKeyPress: function (val, e, field, options) { 62 field.mask(telefoneVendaMask.apply({}, arguments), options); 63 } 64 }); 65 } 66 67/* 68 if (window.location.href.includes("/imoveis/")) { 69 $('.wpcf7-tel').mask('(00) 00000-0000'); 70 $('form.wpcf7-form').on('submit', function() { 71 $('.wpcf7-tel').val($('.wpcf7-tel').cleanVal()); 72 }); 73 } 74*/ 75 76 $('.btn-scroll-link').click(function (e) { 77 e.preventDefault(); 78 let id = $(this).attr('href'); 79 let posicao = $(id).offset().top - 200; 80 $('html, body').animate({ 81 scrollTop: posicao 82 }, 1000); 83 }); 84 85 $('#barra-idiomas a').click(function () { 86 let idioma = $(this).data('idioma'); 87 $('#lista-corretores-idioma').hide(); 88 $('#modal-idiomas').modal('show'); 89 $('#modal-idiomas .modal-body .intro').html('Aguarde...'); 90 $.post(ajaxurl, { 91 action: 'obter_corretores_idioma', 92 idioma 93 }, function (resposta) { 94 $('#modal-idiomas .modal-body .intro').html(resposta.intro); 95 $('#lista-corretores-idioma').html(resposta.corretores); 96 $('#lista-corretores-idioma').fadeIn(); 97 }, 'json'); 98 }); 99 100 $('.filtro-cidade').change(function () { 101 102 let cidade = $(this).val(); 103 104 if (cidade != '') { 105 106 let target_filtro = '#imoveis'; 107 let litoral_norte = $('input[name="litoral-norte"]'); 108 109 if (cidade == 'litoral-norte') { 110 litoral_norte.val(true); 111 } else { 112 litoral_norte.val(false); 113 } 114 115 if ($(this).parents('#imoveis').length == 0) { 116 target_filtro = '#modal_filtro'; 117 } 118 filtrar_imoveis(false, target_filtro); 119 $.post(ajaxurl, { 120 action: 'obter_bairros_cidade', 121 cidade 122 }, function (resposta) { 123 $('.relacao-bairros-filtro .checkbox').html(resposta); 124 }, 'html'); 125 126 } 127 128 });
129 130 131 132 133 $('.filtro_status a').click(function () { 134 $('.filtro_status li').removeClass('ativo'); 135 $(this).parent().addClass('ativo'); 136 137 var status = $(this).attr('data-status'); 138 var id_corretor = $(this).attr('data-corretor'); 139 $('#imoveis_relacionados #imoveis').hide('fast'); 140 141 $('#loader').fadeIn(); 142 $.post(ajaxurl, { 143 action: 'busca_imoveis', 144 status: status, 145 id_corretor: id_corretor 146 147 }, function (resposta) { 148 149 if ($('#paginador-corretor').length > 0) { 150 $('#paginador-corretor').remove(); 151 } 152 $('#loader').fadeOut(); 153 $('#imoveis_relacionados #imoveis .row').html(resposta); 154 $('#imoveis_relacionados #imoveis').show('fast'); 155 }); 156 157 }); 158 159 $('#select_corretores, #select_projetos').change(function () { 160 var url = $(this).val(); 161 document.location = url; 162 }); 163 164 $('.slider_preco').slider({ 165 'tooltip': 'hide' 166 }); 167 168 $('.slider_diaria').slider({ 169 'tooltip': 'hide' 170 }); 171 172 $('.slider_area').slider({ 173 'tooltip': 'hide' 174 }); 175 176 $('body').on("slide", ".slider_area", function (slideEvt) { 177 $('.faixa_area_vl1').text(slideEvt.value[0]); 178 if (slideEvt.value[1] == 450) { 179 $('.faixa_area_vl2').text(slideEvt.value[1] + '+'); 180 } else { 181 $('.faixa_area_vl2').text(slideEvt.value[1]); 182 } 183 }); 184 185 $('body').on("change", ".slider_area", function (slideEvt) { 186 $('.faixa_area_vl1').text(slideEvt.value.newValue[0]); 187 if (slideEvt.value.newValue[1] == 450) { 188 $('.faixa_area_vl2').text(slideEvt.value.newValue[1] + '+'); 189 } else { 190 $('.faixa_area_vl2').text(slideEvt.value.newValue[1]); 191 } 192 }); 193 194 $('body').on("slide", ".slider_preco", function (slideEvt) { 195 $('.faixa_valor_vl1').text(slideEvt.value[0].formatMoney(0, ',', '.')); 196 if (slideEvt.value[1] == 5000000) { 197 $('.faixa_valor_vl2').text(slideEvt.value[1].formatMoney(0, ',', '.') + '+'); 198 } else { 199 $('.faixa_valor_vl2').text(slideEvt.value[1].formatMoney(0, ',', '.')); 200 } 201 202 }); 203 204 $('body').on("slide", ".slider_diaria", function (slideEvt) { 205 $('.faixa_valor_vl1').text(slideEvt.value[0].formatMoney(0, ',', '.')); 206 if (slideEvt.value[1] == 50000) { 207 $('.faixa_valor_vl2').text(slideEvt.value[1].formatMoney(0, ',', '.') + '+'); 208 } else { 209 $('.faixa_valor_vl2').text(slideEvt.value[1].formatMoney(0, ',', '.')); 210 } 211 212 }); 213 214 $('body').on("change", ".slider_preco", function (slideEvt) { 215 $('.faixa_valor_vl1').text(slideEvt.value.newValue[0].formatMoney(0, ',', '.')); 216 if (slideEvt.value[1] == 5000000) { 217 $('.faixa_valor_vl2').text(slideEvt.value.newValue[1].formatMoney(0, ',', '.') + '+'); 218 } else { 219 $('.faixa_valor_vl2').text(slideEvt.value.newValue[1].formatMoney(0, ',', '.')); 220 } 221 222 }); 223 224 $('.slider_quartos').slider({ 225 'tooltip': 'hide' 226 }); 227 $('body').on("slide", ".slider_quartos", function (slideEvt) { 228 $('.quartos_vl1').text(slideEvt.value[0]); 229 $('.quartos_vl2').text(slideEvt.value[1]); 230 }); 231 232 $('body').on("change", ".slider_quartos", function (slideEvt) { 233 $('.quartos_vl1').text(slideEvt.value.newValue[0]); 234 $('.quartos_vl2').text(slideEvt.value.newValue[1]); 235 }); 236 237 $('.slider_suites').slider({ 238 'tooltip': 'hide' 239 }); 240 $('body').on("slide", ".slider_suites", function (slideEvt) { 241 $('.suites_vl1').text(slideEvt.value[0]); 242 $('.suites_vl2').text(slideEvt.value[1]); 243 }); 244 $('body').on("change", ".slider_suites", function (slideEvt) { 245 $('.suites_vl1').text(slideEvt.value.newValue[0]); 246 $('.suites_vl2').text(slideEvt.value.newValue[1]); 247 }); 248 249 $('.slider_banheiros').slider({ 250 'tooltip': 'hide' 251 });
252 $('body').on("slide", ".slider_banheiros", function (slideEvt) { 253 $('.banheiros_vl1').text(slideEvt.value[0]); 254 $('.banheiros_vl2').text(slideEvt.value[1]); 255 }); 256 $('body').on("change", ".slider_banheiros", function (slideEvt) { 257 $('.banheiros_vl1').text(slideEvt.value.newValue[0]); 258 $('.banheiros_vl2').text(slideEvt.value.newValue[1]); 259 }); 260 261 $('.slider_vagas').slider({ 262 'tooltip': 'hide' 263 }); 264 $('body').on("slide", ".slider_vagas", function (slideEvt) { 265 $('.vagas_vl1').text(slideEvt.value[0]); 266 $('.vagas_vl2').text(slideEvt.value[1]); 267 }); 268 $('body').on("change", ".slider_vagas", function (slideEvt) { 269 $('.vagas_vl1').text(slideEvt.value.newValue[0]); 270 $('.vagas_vl2').text(slideEvt.value.newValue[1]); 271 }); 272 273 $('#imoveis').on('slideStop', '.slider_quartos, .slider_suites, .slider_banheiros, .slider_vagas, .slider_preco, .slider_area', function () { 274 $('.campo_paginacao').val(1); 275 filtrar_imoveis(false, '#imoveis'); 276 }); 277 278 $('#modal_filtro').on('slideStop', '.slider_quartos, .slider_suites, .slider_banheiros, .slider_vagas, .slider_preco, .slider_area', function () { 279 $('.campo_paginacao').val(1); 280 filtrar_imoveis(false, '#modal_filtro'); 281 }); 282 283 $('#filtro_cenarios').on('slideStop', '.slider_diaria', function () { 284 $('.campo_paginacao').val(1); 285 filtrar_cenarios(false); 286 }); 287 288 $('#imoveis #filtro_geral_imoveis').on('change', '.checkbox input', function () { 289 $('.campo_paginacao').val(1); 290 filtrar_imoveis(false, '#imoveis'); 291 }); 292 293 $('#modal_filtro #filtro_geral_imoveis .checkbox input').change(function () { 294 $('.campo_paginacao').val(1); 295 filtrar_imoveis(false, '#modal_filtro'); 296 }); 297 298 $('#filtro_cenarios .checkbox input').change(function () { 299 $('.campo_paginacao').val(1); 300 filtrar_cenarios(false); 301 }); 302 303 $('#paginador').on('click', 'a', function () { 304 if (!$(this).hasClass('wait')) { 305 $('.campo_paginacao').val($(this).attr('data-page')); 306 $(this).addClass('wait'); 307 $(this).text('Carregando mais imóveis...'); 308 309 if (verificarParametroURL('refugios-do-mar')) { 310 let refugios_do_mar = $('input[name="refugios-do-mar"]'); 311 refugios_do_mar.val(true); 312 } 313 314 var container = $(window).width() <= 480 ? '#modal_filtro' : '#imoveis'; 315 316 filtrar_imoveis(true, container); 317 318 } 319 }); 320 321 $('body').on('click', '#paginador_bairro a', function () { 322 if (!$(this).hasClass('wait')) { 323 var pagina = $(this).attr('data-page'); 324 var bairro = $(this).attr('data-bairro'); 325 $(this).addClass('wait'); 326 $(this).text('Carregando mais imóveis...'); 327 $('#loader').fadeIn(); 328 $.post(ajaxurl, { 329 action: 'filtro_bairros', 330 pagina: pagina, 331 bairro: bairro, 332 }, function (resposta) { 333 $('#paginador_bairro').remove(); 334 $('#imoveis').append(resposta); 335 $('#loader').fadeOut(); 336 }); 337 } 338 }); 339 340 $('body').on('click', '#paginador-projetos a', function () { 341 if (!$(this).hasClass('wait')) { 342 var pagina = $(this).attr('data-page'); 343 $(this).addClass('wait'); 344 $(this).text('Carregando mais projetos...'); 345 $('#loader').fadeIn(); 346 $.post(ajaxurl, { 347 action: 'filtro_projetos', 348 pagina: pagina 349 }, function (resposta) { 350 $('#paginador-projetos').remove(); 351 $('#lista-projetos').append(resposta); 352 $('#loader').fadeOut(); 353 }); 354 } 355 }); 356 357 /*$(document).scroll(function(){ 358 if( $('body').hasClass('post-type-archive-imovel') ){ 359 if($(window).scrollTop() + $(window).height() >
359 $(document).height() - 150) { 360 $('#paginador a').trigger('click'); 361 } 362 } 363 });*/ 364 365 if ($('.ssba.ssba-wrap') && $(document).width() < 500) { 366 var html = '<a class="whatsapp_share" href="whatsapp://send?text=' + encodeURIComponent(document.URL) + '" target="_blank"><img src="http://www.refugiosurbanos.com.br/wp-content/uploads/2016/05/ico_whatsapp.png"></a>'; 367 $(html).insertAfter(".ssba.ssba-wrap .ssba_google_share"); 368 } 369 370 // $(document).scroll(function () { 371 // if (!$('body').hasClass('page-template-imovel-impressao')) { 372 // if ($(document).scrollTop() > 175) { 373 // $('header').addClass('fixed'); 374 // $('header .collapse').removeClass('in'); 375 // $('body').css('margin-top', '175px'); 376 // $('header').css('margin-left', -($('header').width() / 2)); 377 // } else { 378 // $('header').removeClass('fixed'); 379 // $('body').css('margin-top', '0'); 380 // $('header').css('margin-left', 'auto'); 381 // } 382 // } 383 // }); 384 385 let lastScrollTop = 0; 386 387 $(document).scroll(function () { 388 if (!$('body').hasClass('page-template-imovel-impressao')) { 389 let currentScrollTop = $(this).scrollTop(); 390 391 if (currentScrollTop > lastScrollTop && currentScrollTop > 175) { 392 // Rolando para baixo 393 $('header').hide(); // Esconde o header 394 } else if (currentScrollTop < lastScrollTop) { 395 // Rolando para cima 396 $('header').slideDown(); // Mostra o header 397 398 // Adiciona a classe fixed apenas ao rolar para cima 399 if (currentScrollTop > 175) { 400 $('header').addClass('fixed'); 401 $('header .collapse').removeClass('in'); 402 $('body').css('margin-top', '175px'); 403 $('header').css('margin-left', -($('header').width() / 2)); 404 } 405 } 406 407 lastScrollTop = currentScrollTop; // Atualiza a última posição do scroll 408 409 // Remove a classe fixed se o scroll estiver acima de 175 410 if (currentScrollTop <= 175) { 411 $('header').removeClass('fixed'); 412 $('body').css('margin-top', '0'); 413 $('header').css('margin-left', 'auto'); 414 } 415 } 416 }); 417 418 419 420 $('#modal-embed-video').on('hidden.bs.modal', function () { 421 $('#modal-embed-video iframe').attr('src', $('#modal-embed-video iframe').attr('src')); 422 }); 423 424 $('body').on('click', '.btn-favorito:not(.carregando), .bt-favorito-topo:not(.carregando), .bt-favoritar-single:not(.carregando)', function (e) { 425 e.preventDefault(); 426 427 var $this = $(this); 428 429 $this.addClass('carregando'); 430 431 $.post(ajaxurl, { 432 action: 'favoritar', 433 post_id: $(this).attr('data-id') 434 }, function (resposta) { 435 if (resposta == 1) { 436 $this.toggleClass('active'); 437 var num_favoritos = parseInt($('.btn-favoritos .badge').text()); 438 if ($this.hasClass('active')) { 439 num_favoritos++; 440 } else { 441 num_favoritos--; 442 } 443 444 if ($this.hasClass('bt-favorito-topo') || $this.hasClass('bt-favoritar-single')) { 445 var link_topo = $('.bt-favorito-topo'); 446 var link_single = $('.bt-favoritar-single'); 447 448 var icone = link_topo.find('i'); 449 if ($this.hasClass('active')) { 450 link_topo.addClass('active'); 451 link_single.addClass('active'); 452 icone.removeClass('glyphicon-star-empty'); 453 icone.addClass('glyphicon-star'); 454 link_single.find('span').text('remover dos'); 455 } else { 456 link_topo.removeClass('active'); 457 link_single.removeClass('active'); 458 icone.removeClass('glyphicon-star'); 459 icone.addClass('glyphicon-star-empty'); 460 link_single.find('span').text('adicionar aos'); 461 } 462 } 463 464 $('.btn-favoritos .badge').text(num_favoritos); 465 } 466 $this.removeClass('carregando'); 467 }); 468 });
469 470 $('body').on('submit', '#alerta-inteligente', function (e) { 471 472 e.preventDefault(); 473 474 var $this = $(this); 475 476 $('#loader').fadeIn(); 477 $.post(ajaxurl, { 478 action: 'alerta_inteligente', 479 dados: $('#imoveis #filtro_geral_imoveis form').serialize(), 480 nome: $('#resultado-nome').val(), 481 email: $('#resultado-email').val() 482 }, function (resposta) { 483 $('#loader').fadeOut(); 484 $('.ico-alerta').addClass('enviado'); 485 }); 486 487 }); 488 489 $('#bt-go-up').click(function () { 490 $('html, body').animate({ 491 scrollTop: 0 492 }, 800); 493 }); 494 495 $('.casa-predio article a').hover(function () { 496 var altura_titulo = $(this).find('h3').height(); 497 $(this).find('h3').css('margin-top', -(altura_titulo / 2)); 498 }); 499 500 $('.bt-favorito-topo').hover(function () { 501 if ($(this).hasClass('active')) 502 return false; 503 var icone = $(this).find('i') 504 if (icone.hasClass('glyphicon-star-empty')) { 505 icone.removeClass('glyphicon-star-empty'); 506 icone.addClass('glyphicon-star'); 507 } else { 508 icone.addClass('glyphicon-star-empty'); 509 icone.removeClass('glyphicon-star'); 510 } 511 }, function () { 512 if ($(this).hasClass('active')) 513 return false; 514 var icone = $(this).find('i') 515 if (icone.hasClass('glyphicon-star-empty')) { 516 icone.removeClass('glyphicon-star-empty'); 517 icone.addClass('glyphicon-star'); 518 } else { 519 icone.addClass('glyphicon-star-empty'); 520 icone.removeClass('glyphicon-star'); 521 } 522 }); 523 524 $('body').on('click', '#paginador-sacadas a', function () { 525 if (!$(this).hasClass('wait')) { 526 var pagina = $(this).attr('data-page'); 527 var corretor = $(this).attr('data-corretor'); 528 var categoria = $(this).attr('data-categoria'); 529 $(this).addClass('wait'); 530 $(this).text('Carregando mais sacadas...'); 531 $('#loader').fadeIn(); 532 $.post(ajaxurl, { 533 action: 'paginacao_sacadas', 534 pagina: pagina, 535 corretor: corretor, 536 categoria: categoria 537 }, function (resposta) { 538 $('#paginador-sacadas').remove(); 539 $('#lista_sacadas').append(resposta); 540 $('#loader').fadeOut(); 541 }); 542 } 543 }); 544 545 $('body').on('click', '#paginador-predios-casas a', function () { 546 if (!$(this).hasClass('wait')) { 547 var pagina = $(this).attr('data-page'); 548 var tipo = $(this).attr('data-tipo'); 549 var busca = $(this).attr('data-busca'); 550 $(this).addClass('wait'); 551 $(this).text('Carregando...'); 552 $('#loader').fadeIn(); 553 $.post(ajaxurl, { 554 action: 'paginacao_predios_casas', 555 pagina: pagina, 556 tipo: tipo, 557 busca: busca 558 }, function (resposta) { 559 $('#paginador-predios-casas').remove(); 560 $('#lista_predios_casas').append(resposta); 561 $('#loader').fadeOut(); 562 }); 563 } 564 }); 565 566 $('body').on('click', '#paginador-inspiracoes a', function () { 567 if (!$(this).hasClass('wait')) { 568 var pagina = $(this).attr('data-page'); 569 var max_pages = $(this).attr('data-maxpages'); 570 var categoria = $(this).attr('data-categoria'); 571 $(this).addClass('wait'); 572 $(this).text('Carregando...'); 573 $('#loader').fadeIn(); 574 $.post(ajaxurl, { 575 action: 'paginacao_inspiracoes', 576 pagina: pagina, 577 categoria: categoria 578 }, function (resposta) { 579 580 let proxima_pagina = parseInt(pagina) + 1; 581 582 $('#paginador-inspiracoes a').attr('data-page', proxima_pagina); 583 $('#paginador-inspiracoes a').removeClass('wait'); 584 $('#paginador-inspiracoes a').text('Carregar mais'); 585 586 if (proxima_pagina > max_pages) { 587 $('#paginador-inspiracoes').remove(); 588 } 589 590 $('#lista_inspiracoes').append(resposta); 591 window.parsePinBtns(); 592 $('#loader').fadeOut(); 593 }); 594 } 595 });
596 597 if ($(document).find('#timeline-predios-casas').length > 0) { 598 var tipo = $('#timeline-predios-casas').attr('data-tipo'); 599 $('#loader').fadeIn(); 600 $.post(ajaxurl, { 601 action: 'timeline_predios_casas', 602 tipo: tipo 603 }, function (data) { 604 $("#timeline-predios-casas > div").albeTimeline(data, { 605 effect: "zoomIn", 606 showMenu: false, 607 formatDate: 1 608 }); 609 $('#loader').fadeOut(); 610 }, 'json'); 611 612 /*$('#timeline-predios-casas > div').bind('mousewheel', function (event) { 613 event.preventDefault(); 614 var scrollLeft = this.scrollLeft; 615 this.scrollLeft = (scrollLeft + ((event.deltaY * event.deltaFactor) * -1)); 616 //console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta); 617 });*/ 618 619 $('body').on('click', '#timeline-predios-casas h4, #timeline-predios-casas img, #timeline-predios-casas p', function () { 620 var url = $(this).parents('article').find('a').attr('href'); 621 document.location = url; 622 }); 623 } 624 625 $('body').on('click', '.paginador-arquitetura a', function () { 626 var botao = $(this).parent(); 627 var lista = $(this).parents('.lista-arquitetura'); 628 if (!$(this).hasClass('wait')) { 629 var pagina = $(this).attr('data-page'); 630 var arquitetura = $(this).attr('data-arquitetura'); 631 $(this).addClass('wait'); 632 $(this).text('Carregando...'); 633 $('#loader').fadeIn(); 634 $.post(ajaxurl, { 635 action: 'paginacao_arquitetura', 636 pagina: pagina, 637 arquitetura: arquitetura 638 }, function (resposta) { 639 $(botao).remove(); 640 $(lista).append(resposta); 641 $('#loader').fadeOut(); 642 }); 643 } 644 }); 645 646 $('body').on('click', '#paginador-bairro a', function () { 647 if (!$(this).hasClass('wait')) { 648 var pagina = $(this).attr('data-page'); 649 var bairro = $(this).attr('data-bairro'); 650 $(this).addClass('wait'); 651 $(this).text('Carregando...'); 652 $('#loader').fadeIn(); 653 $.post(ajaxurl, { 654 action: 'paginacao_bairro', 655 pagina: pagina, 656 bairro: bairro 657 }, function (resposta) { 658 $('#paginador-bairro').remove(); 659 $('.lista-bairro').append(resposta); 660 $('#loader').fadeOut(); 661 }); 662 } 663 }); 664 665 $('body').on('click', '#paginador-corretor a', function () { 666 if (!$(this).hasClass('wait')) { 667 var pagina = $(this).attr('data-page'); 668 var corretor = $(this).attr('data-corretor'); 669 var status = $(this).attr('data-status'); 670 $(this).addClass('wait'); 671 $(this).text('Carregando...'); 672 $('#loader').fadeIn(); 673 $.post(ajaxurl, { 674 action: 'paginacao_corretor', 675 pagina: pagina, 676 corretor: corretor, 677 status: status 678 }, function (resposta) { 679 $('#paginador-corretor').remove(); 680 $('.lista-corretor').append(resposta); 681 $('#loader').fadeOut(); 682 }); 683 } 684 }); 685 686 $('body').on('click', '#paginador-cenarios a', function () { 687 if (!$(this).hasClass('wait')) { 688 var pagina = $(this).attr('data-page'); 689 $(this).addClass('wait'); 690 $(this).text('Carregando...'); 691 $('#loader').fadeIn(); 692 $.post(ajaxurl, { 693 action: 'filtro_cenarios', 694 pagina: pagina, 695 dados: $('#filtro_cenarios form').serialize() 696 }, function (resposta) { 697 var paginacao = $(resposta).filter('#paginador-cenarios'); 698 var imoveis = $(resposta).filter('#retorno_imoveis'); 699 $('#paginador-cenarios').html(''); 700 $('#imoveis > .row').append($(imoveis).html()); 701 $('#paginador-cenarios').html($(paginacao).html()); 702 $('#loader').fadeOut(); 703 }); 704 } 705 });
706 707 $('body').on('click', '#paginador-depoimentos a', function () { 708 if (!$(this).hasClass('wait')) { 709 var pagina = $(this).attr('data-page'); 710 var imovel = $(this).attr('data-imovel') ? $(this).attr('data-imovel') : ''; 711 $(this).addClass('wait'); 712 $(this).text('Carregando...'); 713 $('#loader').fadeIn(); 714 $.post(ajaxurl, { 715 action: 'paginacao_depoimentos', 716 pagina: pagina, 717 imovel: imovel 718 }, function (resposta) { 719 $('#paginador-depoimentos').remove(); 720 $('#lista-depoimentos').append(resposta); 721 $('#loader').fadeOut(); 722 }); 723 } 724 }); 725 726 if ($(window).width() <= 768) { 727 $(".dropdown-toggle.visible-xs").click(function () { 728 if ($(this).parent().find('.dropdown-menu').css('display') == 'block') { 729 $(this).parent().find('.dropdown-menu').slideUp(); 730 } else { 731 $('.dropdown-menu').slideUp(); 732 $(this).parent().find('.dropdown-menu').slideDown(); 733 } 734 }); 735 } 736 737 $('.check-comparar').change(function () { 738 var val = $(this).val(); 739 if ($(this).is(':checked')) { 740 $('#form_comparar').append('<input type="hidden" name="comparar[]" value="' + val + '" />'); 741 } else { 742 $('#form_comparar').find('input[value=' + val + ']').remove(); 743 } 744 745 if ($('.check-comparar:checked').length > 1) { 746 $('.header-comparar a').removeClass('disabled'); 747 } else { 748 $('.header-comparar a').addClass('disabled'); 749 } 750 }); 751 752 var favoritos = getCookie('refugios_favoritos'); 753 754 //if (favoritos == '[]' || !favoritos) { 755 if (!favoritos || favoritos === '[]') { 756 favoritos = []; 757 $('.btn-favoritos .badge').text(0); 758 } else { 759 favoritos = favoritos.replaceAll('"', ''); 760 favoritos = favoritos.replaceAll('[', ''); 761 favoritos = favoritos.replaceAll(']', ''); 762 favoritos = favoritos.split(','); 763 $('.btn-favoritos .badge').text(favoritos.length); 764 } 765 766 767 if ($('.btn-favorito').length > 0) { 768 $('.btn-favorito').each(function (i, v) { 769 var id_imovel = $(v).attr('data-id'); 770 if (favoritos.indexOf(id_imovel) != -1) { 771 $(v).addClass('active'); 772 } else { 773 $(v).removeClass('active'); 774 } 775 }); 776 } 777 778 $('#filtro_geral_imoveis_alerta form').submit(function (e) { 779 e.preventDefault(); 780 var dados = $(this).serialize(); 781 $.post(ajaxurl, { 782 action: 'criar_alerta', 783 formulario: dados 784 }, function (retorno) { 785 $('#filtro_geral_imoveis_alerta .retorno').fadeIn(); 786 $('#filtro_geral_imoveis_alerta .form').fadeOut(); 787 }); 788 }); 789 790 $('#filtro_geral_imoveis_alerta .retorno .btn').click(function () { 791 $('#filtro_geral_imoveis_alerta .retorno').fadeOut(); 792 $('#filtro_geral_imoveis_alerta .form').fadeIn(); 793 }); 794 795 if (!$('body').hasClass('logged-in')) { 796 $("img").mousedown(function (e) { 797 e.preventDefault(); 798 }); 799 800 // this will disable right-click on all images 801 $("img").on("contextmenu", function (e) { 802 return false; 803 }); 804 } 805 806 if (jQuery('.carrossel-podcasts').length) { 807 let largura_slide = $(document).width() < 765 ? ($('.carrossel-podcasts').width() - 20) / 2 : ($('.carrossel-podcasts').width() - 40) / 3; 808 let margin_slide = $(document).width() <= 465 ? 0 : 20; 809 largura_slide = $(document).width() <= 465 ? $('.carrossel-podcasts').width() : largura_slide; 810 811 jQuery('.carrossel-podcasts').bxSlider({ 812 slideWidth: largura_slide, 813 minSlides: 1, 814 maxSlides: 3, 815 slideMargin: margin_slide, 816 moveSlides: 1, 817 pager: false, 818 nextText: '>', 819 prevText: '<', 820 touchEnabled: false 821 }); 822 823 } 824 825 $('#categorias_mobile_sacadas').change(function () { 826 let url = $(this).val(); 827 document.location = url; 828 });
829 830}); 831 832$(window).load(function () { 833 $('.bxslider, .single-post .gallery').bxSlider({ 834 pagerCustom: '#bx-pager' 835 }); 836 837 jQuery('#carrossel-thumbs2 #bx-pager').bxSlider({ 838 slideWidth: 120, 839 minSlides: 2, 840 maxSlides: 7, 841 slideMargin: 2, 842 pager: false, 843 nextText: '>', 844 prevText: '<', 845 autoStart: false 846 }); 847 848 jQuery('#carrossel-thumbs #bx-pager').bxSlider({ 849 slideWidth: 120, 850 minSlides: 2, 851 maxSlides: 7, 852 slideMargin: 2, 853 pager: false, 854 nextText: '>', 855 prevText: '<', 856 autoStart: false 857 }); 858 /*$('.bxslider, .single-post .gallery').css('display', 'none');*/ 859 $('.bxslider, .single-post .gallery').css('visibility', 'visible'); 860 $('.bxslider, .single-post .gallery').css('max-height', 'initial'); 861 $('.bxslider, .single-post .gallery').fadeIn(500); 862 /*$('#carrossel-thumbs').css('display', 'none'); 863 $('#carrossel-thumbs').css('visibility', 'visible'); 864 $('#carrossel-thumbs').css('max-height', 'initial'); 865 $('#carrossel-thumbs').fadeIn(500);*/ 866}); 867 868Number.prototype.formatMoney = function (c, d, t) { 869 var n = this, 870 c = isNaN(c = Math.abs(c)) ? 2 : c, 871 d = d == undefined ? "." : d, 872 t = t == undefined ? "," : t, 873 s = n < 0 ? "-" : "", 874 i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", 875 j = (j = i.length) > 3 ? j % 3 : 0; 876 return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); 877}; 878 879 880function filtrar_imoveis(append, container) { 881 882 883 //var action = document.location.href.indexOf('imoveis-teste') > 0 ? 'filtro_imoveis_novo' : 'filtro_imoveis'; 884 var action = 'filtro_imoveis_novo'; 885 886 $('#loader').fadeIn(); 887 $.post(ajaxurl, { 888 action: action, 889 dados: $(container + ' #filtro_geral_imoveis form').serialize() 890 }, function (resposta) { 891 var scroll = $(window).scrollTop(); 892 $('#imoveis > .row').fadeOut(function () { 893 var paginacao = $(resposta).filter('#paginador'); 894 var imoveis = $(resposta).filter('#retorno_imoveis'); 895 /*var form_action = imoveis.find('.wpcf7-form').attr('action'); 896 form_action = form_action.replace('/wp-admin/admin-ajax.php', '/imoveis/'); 897 imoveis.find('.wpcf7-form').attr('action', form_action);*/ 898 $(resposta).filter('#paginador').remove(); 899 console.log(paginacao); 900 if (append) { 901 $(this).append($(imoveis).html()); 902 } else { 903 $(this).html($(imoveis).html()); 904 $('.campo_paginacao').val(1); 905 } 906 $('#paginador').html($(paginacao).html()); 907 908 909 910 if (paginacao.length == 0) { 911 $('#paginador').hide(); 912 } else { 913 $('#paginador').show(); 914 } 915 if ($('.campo_paginacao').val() == 1) { 916 $(document).scrollTop($('h1').offset().top); 917 } 918 919 $(this).fadeIn(function () { 920 $('.thumb-galery').bxSlider({ 921 'pager': false, 922 'touchEnabled': false, 923 'infiniteLoop': false, 924 'hideControlOnEnd': true, 925 'onSlideBefore': function (e, velho, novo) { 926 if (velho == 4 && novo == 0) { 927 //$(e).find('a').trigger('click'); 928 var a = $(e).find('a'); 929 window.open(a[0].href); 930 } 931 } 932 }); 933 $(window).scrollTop(scroll); 934 }); 935 $('#loader').fadeOut(); 936 }); 937 }); 938} 939 940function filtrar_cenarios(append) { 941 942 $('#loader').fadeIn(); 943 $.post(ajaxurl, { 944 action: 'filtro_cenarios', 945 dados: $('#filtro_cenarios form').serialize() 946 }, function (resposta) { 947 $('#imoveis > .row').fadeOut(function () { 948 var paginacao = $(resposta).filter('#paginador-cenarios'); 949 var imoveis = $(resposta).filter('#retorno_imoveis'); 950 $(resposta).filter('#paginador-cenarios').remove(); 951 console.log(imoveis); 952 if (append) { 953 $(this).append($(imoveis).html()); 954 } else { 955 $(this).html($(imoveis).html()); 956 } 957 $('#paginador-cenarios').html($(paginacao).html()); 958 $(this).fadeIn(); 959 $('#loader').fadeOut(); 960 }); 961 });
962} 963 964function imovel_contato() { 965 $('.imovel-mensagem-ok, .imovel-mensagem').toggle(); 966} 967 968function getCookie(cname) { 969 var name = cname + "="; 970 var decodedCookie = decodeURIComponent(document.cookie); 971 var ca = decodedCookie.split(';'); 972 for (var i = 0; i < ca.length; i++) { 973 var c = ca[i]; 974 while (c.charAt(0) == ' ') { 975 c = c.substring(1); 976 } 977 if (c.indexOf(name) == 0) { 978 return c.substring(name.length, c.length); 979 } 980 } 981 return ""; 982} 983 984function setCookie(cname, cvalue, exdays) { 985 var d = new Date(); 986 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 987 var expires = "expires=" + d.toUTCString(); 988 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 989} 990 991String.prototype.replaceAll = function (search, replacement) { 992 var target = this; 993 return target.split(search).join(replacement); 994}; 995 996jQuery(document).on('click', '.wpcf7-submit', function (e) { 997 if (jQuery('.ajax-loader').hasClass('is-active')) { 998 e.preventDefault(); 999 return false; 1000 } 1001}); 1002 1003 1004function verificarParametroURL(parametro) { 1005 const queryString = window.location.search; 1006 const params = new URLSearchParams(queryString); 1007 return params.has(parametro); 1008} 1009 1010$(function () { 1011 setTimeout(function () { 1012 if ($(window).width() < 465) { 1013 return; 1014 } 1015 $.each($('#main-menu .dropdown-menu'), function (i, v) { 1016 if (!$(v).hasClass('bairros-sp--list')) { 1017 $(v).css('left', ($(v).width() / 2) * -1); 1018 $(v).css('margin-left', '50%'); 1019 } else { 1020 1021 1022 1023 1024 var widthDocument = $(document).width(); 1025 var widthContainer = $(".container").width(); 1026 var widthFirstItemMenu = $("#menus > li").first().width(); 1027 var widthOutContainer = ((widthDocument - widthContainer) / 2) ; 1028 widthOutContainer = widthOutContainer + 28; 1029 1030 $(v).css('margin-left', '-' + widthOutContainer - widthFirstItemMenu + 'px'); 1031 1032 1033 // console.log('Document: ' + widthDocument); 1034 // console.log('-'); 1035 // console.log('Container: ' + widthContainer); 1036 // console.log('_________'); 1037 // console.log('Total: ' + (widthContainer - widthDocument)); 1038 1039 // console.log(' / 2'); 1040 // console.log('Total: ' + (widthContainer - widthDocument / 2 )); 1041 1042 1043 } 1044 }); 1045 }, 500) 1046}); 1047 1048 1049// const mouseEvent = e => { 1050// if (!e.toElement && !e.relatedTarget) { 1051// document.removeEventListener('mouseout', mouseEvent); 1052// if(!getCookie('modal-abandono')){ 1053// PUM.open(203407); 1054// } 1055// } 1056// }; 1057 1058 1059 1060 1061// function getCookie(name) { 1062// const value = `; ${document.cookie}`; 1063// const parts = value.split(`; ${name}=`); 1064// if (parts.length === 2) return parts.pop().split(';').shift(); 1065// } 1066 1067// const mouseEvent = e => { 1068// if (!e.toElement && !e.relatedTarget) { 1069// document.removeEventListener('mouseout', mouseEvent); 1070// if (!getCookie('submitted')) { 1071// PUM.open(203407); 1072// setCookie('usersession', 'true', '1'); 1073// } else if (!getCookie('usersession')) { 1074// PUM.open(203407); 1075// } 1076// } 1077// }; 1078 1079// document.addEventListener('mouseout', mouseEvent); 1080 1081function getCookie(name) { 1082 const value = `; ${document.cookie}`; 1083 const parts = value.split(`; ${name}=`); 1084 if (parts.length === 2) return parts.pop().split(';').shift(); 1085} 1086 1087const mouseEvent = e => { 1088 if (!e.toElement && !e.relatedTarget) { 1089 document.removeEventListener('mouseout', mouseEvent); 1090 if (!getCookie('submitted') && !getCookie('usersession')) { 1091 PUM.open(203407); // Abre o popup 1092 setCookie('usersession', 'true', 24); 1093 } 1094 } 1095}; 1096 1097document.addEventListener('mouseout', mouseEvent); 1098 1099 1100 1101// $(document).ready(function(){ 1102 1103// $('.single-imovel .wpcf7-form').on('submit', function(e) { 1104// e.preventDefault(); 1105 1106// console.log('CLIQUE'); 1107 1108// $('.single-imovel button.btn-padrao').hide(); 1109 1110// var form = $(this); 1111// var actionUrl = form.attr('action'); 1112 1113// $.ajax({
1114// type: 'POST', 1115// url: actionUrl, 1116// data: form.serialize(), 1117// success: function(response) { 1118 1119// console.log(response); 1120 1121// if (response.includes('sucesso')) { 1122 1123// setTimeout(function() { 1124// $('.single-imovel button.btn-padrao').show(); 1125// }, 2000); 1126 1127// } else { 1128// //$('.wpcf7-response-output').html('Erro ao enviar a mensagem. Tente novamente.').css('visibility', 'visible'); 1129// console.log('nao enviado'); 1130// } 1131// }, 1132// error: function(xhr, status, error) { 1133// console.error('Erro na requisição', error); 1134// $('.wpcf7-response-output').html('Erro ao enviar a mensagem. Tente novamente.').css('visibility', 'visible'); 1135// } 1136// }); 1137// }); 1138// }) 1139 1140 1141$(document).ready(function () { 1142 var whatsappBtn = $('.ssbp-whatsapp.ssbp-btn'); 1143 1144 if (whatsappBtn.length) { 1145 var currentHref = whatsappBtn.attr('href'); 1146 if (currentHref && currentHref.includes('text=')) { 1147 var shareURL = currentHref.split('text=')[1]; 1148 var isMobile = /Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent); 1149 1150 var whatsappBase = isMobile 1151 ? 'https://api.whatsapp.com/send?text=' 1152 : 'https://web.whatsapp.com/send?text='; 1153 1154 whatsappBtn.attr('href', whatsappBase + shareURL); 1155 } 1156 } 1157});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.