1Dropzone.autoDiscover = false; 2 3function show_auth_modal(redirect){ 4 5 var redirect_to = ''; 6 if(redirect !== undefined){ 7 redirect_to = '?redirect='+redirect; 8 } 9 var url = window.base_url+'/users/login'+redirect_to; 10 $('#remote-modal').modal('show'); 11 $('#remote-modal .modal-content').html('<div class="panel no-margin-bottom"><div class="panel-body text-center" style="min-height: 200px; line-height: 200px;"><i class="fa fa-spinner spinner"></i></div></div>'); 12 $('#remote-modal .modal-content').load(url); 13 14 $('#remote-modal .modal-dialog').removeClass('modal-lg'); 15 $('#remote-modal .modal-dialog').removeClass('modal-sm'); 16 $('#remote-modal .modal-dialog').removeClass('modal-xs'); 17 if($(this).data('modal-size')){ 18 $('#remote-modal .modal-dialog').addClass($(this).data('modal-size')); 19 } 20 21} 22 23$(document).ready(function($){ 24 25 function onSubmitNewsletterForm(token) { 26 document.getElementById("newsletter-form-modal").submit(); 27 } 28 29 $('.create-lead').submit(function(){ 30 31 var form = $(this); 32 var modal = form.closest('.modal'); 33 var button = $(this).find('button[type=submit]'); 34 var button_text = button.val(); 35 var success_message_title = form.find('.success_message_title').val(); 36 var success_message_body = form.find('.success_message_body').val(); 37 38 $(this).ajaxSubmit({ 39 beforeSubmit: function(formData, jqForm, options){ 40 button.html('<span class="spinner-border spinner-border-sm text-white" role="status" aria-hidden="true"></span>'); 41 }, 42 success: function(responseText, statusText, xhr, $form){ 43 button.val(button_text); 44 modal.modal('hide'); 45 swal(success_message_title, success_message_body, 'success'); 46 } 47 }); 48 49 return false; 50 51 }); 52 53 $('.schedule-vip-subscribe').click(function(e){ 54 55 var button = $(this); 56 var action = $(this).attr('href'); 57 $.post(action, {}, function(response){ 58 var responseText = JSON.parse(response.trim()); 59 if(responseText.message == 'created'){ 60 button.removeClass('btn-dark'); 61 button.addClass('btn-success'); 62 button.html('Presença confirmada <small class="text-white">(clique para cancelar)</small>'); 63 } 64 if(responseText.message == 'deleted'){ 65 button.removeClass('btn-success'); 66 button.addClass('btn-dark'); 67 button.html('Confirmar presença'); 68 } 69 }); 70 71 e.preventDefault(); 72 73 }); 74 75 $('.summernote').summernote({ 76 tabsize: 2, 77 height: 200, 78 toolbar: [ 79 ['font', ['bold', 'italic', 'underline', 'clear']] 80 ] 81 }); 82 83 $('.swiper').each(function(){ 84 85 var autoplay = 0; 86 if($(this).attr('data-autoplay') !== undefined){ 87 var delay = 2000; 88 if($(this).attr('data-delay') !== undefined){ 89 delay = $(this).attr('data-delay'); 90 } 91 autoplay = { 92 delay: delay 93 }; 94 } 95 96 var slidesPerGroup = 1; 97 if($(this).attr('data-slides-per-group') !== undefined){ 98 slidesPerGroup = $(this).attr('data-slides-per-group'); 99 } 100 101 var slidesPerViewMobile = 1; 102 if($(this).attr('data-slides-per-view-mobile') !== undefined){ 103 slidesPerViewMobile = $(this).attr('data-slides-per-view-mobile'); 104 } 105 106 var slidesPerViewMobileLandscape = 1; 107 if($(this).attr('data-slides-per-view-mobile-landscape') !== undefined){ 108 slidesPerViewMobileLandscape = $(this).attr('data-slides-per-view-mobile-landscape'); 109 } 110 111 var slidesPerView = 3.2; 112 if($(this).attr('data-slides-per-view') !== undefined){ 113 slidesPerView = $(this).attr('data-slides-per-view'); 114 } 115 116 var spaceBetween = 10; 117 if($(this).attr('data-space-between') !== undefined){ 118 spaceBetween = parseInt($(this).attr('data-space-between')); 119 } 120 121 var spaceBetweenMobile = 10; 122 if($(this).attr('data-space-between-mobile') !== undefined){ 123 spaceBetweenMobile = parseInt($(this).attr('data-space-between-mobile')); 124 } 125 126 var spaceBetweenMobileLandscape = 10; 127 if($(this).attr('data-space-between-mobile-landscape') !== undefined){ 128 spaceBetweenMobileLandscape = parseInt($(this).attr('data-space-between-mobile-landscape')); 129 } 130 131 var swiper = new Swiper($(this).find('.swiper')[0], { 132 autoplay: autoplay, 133 autoHeight: true, 134 scrollbar: { 135 el: $(this).find('.swiper-scrollbar')[0], 136 draggable: true 137 }, 138 slidesPerView: slidesPerViewMobile, 139 spaceBetween: spaceBetweenMobile, 140 pagination: { 141 el: $(this).find('.swiper-pagination')[0], 142 clickable: true 143 }, 144 navigation: { 145 nextEl: $(this).find('.swiper-button-next')[0], 146 prevEl: $(this).find('.swiper-button-prev')[0] 147 }, 148 breakpoints: { 149 576: { 150 slidesPerView: slidesPerViewMobileLandscape, 151 spaceBetween: spaceBetweenMobileLandscape, 152 slidesPerGroup: slidesPerViewMobileLandscape 153 }, 154 1140: { 155 slidesPerView: slidesPerView, 156 spaceBetween: spaceBetween, 157 slidesPerGroup: slidesPerView 158 }, 159 }, 160 }); 161 162 }); 163 164 if($('.webdoor .swiper')[0]){ 165 var swiper = new Swiper('.webdoor .swiper', { 166 lazy: true, 167 pagination: { 168 el: '.webdoor .swiper-pagination', 169 clickable: true 170 }, 171 autoplay: { 172 delay: 7000, 173 disableOnInteraction: false, 174 }, 175 }); 176 } 177 178 /* 179 if($('.slider-galleries .swiper-container')[0]){ 180 var swiper = new Swiper('.slider-galleries .swiper-container', { 181 slidesPerView: 1.2, 182 spaceBetween: 10, 183 pagination: { 184 el: '.slider-galleries .swiper-pagination', 185 clickable: true 186 }, 187 breakpoints: { 188 1024: { 189 slidesPerView: 6, 190 } 191 } 192 }); 193 } 194 */ 195 196 if($('.slider-works .swiper')[0]){ 197 var swiper = new Swiper('.slider-works .swiper', { 198 slidesPerView: 1.3, 199 spaceBetween: 10, 200 pagination: { 201 el: '.slider-works .swiper-pagination', 202 clickable: true, 203 dynamicBullets: true, 204 }, 205 navigation: { 206 nextEl: '.swiper-button-next', 207 prevEl: '.swiper-button-prev', 208 }, 209 breakpoints: { 210 1024: { 211 slidesPerView: 4, 212 slidesPerGroup: 4 213 } 214 } 215 }); 216 } 217 218 if($('.slider-schedule .swiper')[0]){ 219 var swiper = new Swiper('.slider-schedule .swiper', { 220 slidesPerView: 1.3, 221 spaceBetween: 10, 222 pagination: { 223 el: '.slider-schedule .swiper-pagination', 224 clickable: true, 225 dynamicBullets: true, 226 }, 227 navigation: { 228 nextEl: '.slider-schedule .swiper-button-next', 229 prevEl: '.slider-schedule .swiper-button-prev', 230 }, 231 breakpoints: { 232 1024: { 233 slidesPerView: 4, 234 slidesPerGroup: 4 235 } 236 } 237 }); 238 } 239 240 241 if($('.slider-galleries .swiper')[0]){ 242 var swiper = new Swiper('.slider-galleries .swiper', { 243 slidesPerView: 1.2, 244 spaceBetween: 10, 245 pagination: { 246 el: '.slider-galleries .swiper-pagination', 247 clickable: true, 248 dynamicBullets: true, 249 }, 250 navigation: { 251 nextEl: '.swiper-button-next', 252 prevEl: '.swiper-button-prev', 253 }, 254 breakpoints: { 255 1024: { 256 slidesPerView: 4, 257 slidesPerGroup: 4 258 } 259 } 260 }); 261 } 262 263 if($('.browser_by .swiper')[0]){ 264 var swiper = new Swiper('.browser_by .swiper', { 265 slidesPerView: 1.2, 266 spaceBetween: 10, 267 pagination: { 268 el: '.browser_by .swiper-pagination', 269 clickable: true, 270 dynamicBullets: true, 271 }, 272 breakpoints: { 273 1024: { 274 slidesPerView: 5 275 } 276 } 277 }); 278 } 279 280 if($('.gallery_images .swiper')[0]){ 281 var swiper = new Swiper('.gallery_images .swiper', { 282 pagination: { 283 el: '.gallery_images .swiper-pagination', 284 clickable: true 285 } 286 }); 287 } 288 289 if($('.slider-thumbnails .swiper')[0]){ 290 var swiper = new Swiper('.slider-thumbnails .swiper', { 291 slidesPerView: 3, 292 spaceBetween: 20, 293 pagination: { 294 el: '.slider-thumbnails .swiper-pagination', 295 clickable: true 296 }, 297 }); 298 } 299 300 if($('.slider-dates .swiper')[0]){ 301 var swiper = new Swiper('.slider-dates .swiper', { 302 slidesPerView: 3, 303 spaceBetween: 5, 304 pagination: { 305 el: '.slider-dates .swiper-pagination', 306 clickable: true 307 }, 308 centeredSlides: true 309 }); 310 var index = $('.slider-dates .swiper').find('.nav-link.active').closest('.swiper-slide').index(); 311 swiper.slideTo(index); 312 } 313 314 $('.price-slider').slider({}); 315 $('.price-slider').on("slide", function(slideEvt) { 316 var prices = $('.price-slider').val().split(','); 317 $('.price-slider-min').text(prices[0]); 318 $('.price-slider-max').text(prices[1]); 319 if(prices[1] == 1000000){ 320 $('.price-slider-max').append('+'); 321 } 322 }); 323 324 $('.time').mask('99:00'); 325 $('.discount').mask('99'); 326 $('.cpf').mask('999.999.999-99'); 327 $('.cpf-mask').mask('999.999.999-99'); 328 $('.cnpj-mask').mask('99.999.999/9999-99'); 329 $('.zipcode').mask('99999-999'); 330 $('.phone-mask').mask('(99) 9999-9999?9'); 331 332 $(".only_numbers").keypress(function (e){
333 var charCode = (e.which) ? e.which : e.keyCode; 334 if (charCode > 31 && (charCode < 48 || charCode > 57)) { 335 return false; 336 } 337 }); 338 339 $('[data-toggle="popover"]').popover(); 340 $('[data-toggle="tooltip"]').tooltip(); 341 // $('.data_table').DataTable(); 342 343 $('.open-menu').click(function(){ 344 345 if($(this).is('.opened')){ 346 $(this).removeClass('opened'); 347 $('#main-menu').hide(); 348 $('#top-right-nav').hide(); 349 }else{ 350 $(this).addClass('opened'); 351 $('#main-menu').show(); 352 $('#top-right-nav').show(); 353 } 354 355 }); 356 357 $('.open-filters').click(function(){ 358 if($(this).is('.opened')){ 359 $(this).removeClass('opened'); 360 $('.ordination-options').hide(); 361 $('.search-filters').hide(); 362 }else{ 363 $(this).addClass('opened'); 364 $('.ordination-options').show(); 365 $('.search-filters').show(); 366 } 367 }); 368 369 $('body').on('click', '.open-remote-modal', function(e){ 370 371 var url = $(this).attr('href'); 372 $('#remote-modal').modal('show'); 373 $('#remote-modal .modal-content').html('<div class="panel no-margin-bottom"><div class="panel-body text-center" style="min-height: 400px; line-height: 400px;"><i class="fa fa-2x fa-spinner spinner"></i></div></div>'); 374 $('#remote-modal .modal-content').load(url); 375 376 $('#remote-modal .modal-dialog').removeClass('modal-lg'); 377 $('#remote-modal .modal-dialog').removeClass('modal-sm'); 378 $('#remote-modal .modal-dialog').removeClass('modal-xs'); 379 if($(this).data('modal-size')){ 380 $('#remote-modal .modal-dialog').addClass($(this).data('modal-size')); 381 } 382 383 e.preventDefault(); 384 385 }); 386 387 $('body').on('click', '.open-featured-modal', function(e){ 388 $('.featured-modal-overlay').fadeIn('fast'); 389 $('.featured-modal').addClass('opened'); 390 }); 391 392 $('body').on('click', '.featured-modal-overlay, .featured-modal-close', function(e){ 393 $('.featured-modal-overlay').fadeOut('fast'); 394 $('.featured-modal').removeClass('opened'); 395 }); 396 397 /* 398 $('[data-content-default]').each(function(){ 399 400 setTimeout(function(){ 401 402 var container = $(this); 403 404 var href = $(this).data('content-default'); 405 406 var spinner = '<div class="preloader spinner"><span style="font-size: 30pt;" class="fa fa-spinner"></span></div>' 407 408 container.block({ 409 message: spinner, 410 overlayCSS: { 411 backgroundColor: '#fff', 412 opacity: 0.8, 413 cursor: 'wait' 414 }, 415 css: { 416 border: 0, 417 padding: 0, 418 backgroundColor: 'transparent' 419 } 420 }); 421 422 $.get(href, function(data){ 423 container.replaceWith(data); 424 container.unblock(); 425 }); 426 427 }, 5000); 428 429 }); 430 */ 431 432 $('[data-content-default]').each(function(){ 433 434 var container = $(this); 435 436 var href = $(this).data('content-default'); 437 438 /* 439 container.block({ 440 message: spinner, 441 overlayCSS: { 442 backgroundColor: '#fff', 443 opacity: 0.8, 444 cursor: 'wait' 445 }, 446 css: { 447 border: 0, 448 padding: 0, 449 backgroundColor: 'transparent' 450 } 451 }); 452 */ 453 454 $.get(href, function(data){ 455 setTimeout(function(){ 456 container.replaceWith(data); 457 }, 1000); 458 // container.unblock(); 459 }); 460 461 }); 462 463 $('body').on('click', '.load-more', function(e){ 464 465 var button = $(this); 466 467 /* 468 const searchParams = new URLSearchParams($(this).attr('href')); 469 var page = ''; 470 page = parseInt(searchParams.get('page')) - 1; 471 console.log(page); 472 history.pushState(null, '', '/marketplace/works?page='+page); 473 */ 474 475 button.html('Loading...'); 476 477 $.get($(this).attr('href'), function(data){ 478 button.closest('.row').remove(); 479 $('.ajax-target').append(data); 480 }); 481 482 e.preventDefault(); 483 484 }); 485 486 $('body').on('click', '.ajax-link', function(e){ 487 488 var url = $(this).attr('href'); 489 var target = $($(this).data('target')); 490 var button = $(this); 491 492 target.html('Carregando..'); 493 494 $.get(url, function(data){ 495
496 var delay = 0; 497 if(button.data('ajax-delay')){ 498 delay = button.data('ajax-delay'); 499 } 500 501 setTimeout(function(){ 502 503 target.html(data); 504 505 if(button.data('scroll-to')){ 506 $('html, body').animate({ 507 scrollTop: $(button.data('scroll-to')).offset().top - 100 508 }, 500); 509 } 510 511 }, delay); 512 513 }); 514 515 e.preventDefault(); 516 517 }); 518 519 $("a[href^=\\#]").click(function(e) { 520 e.preventDefault(); 521 522 if($(this).data('toggle') != 'tab' && $(this).attr('data-toggle') != 'collapse'){ 523 var dest = $(this).attr('href'); 524 $('html,body').animate({ scrollTop: $(dest).offset().top - 130 }, 'slow'); 525 } 526 527 }); 528 529 $('.ajax-form-subscription').submit(function(){ 530 531 $(this).ajaxSubmit({ 532 beforeSubmit: function(formData, jqForm, options){ 533 534 $('.subscription-submit').button('loading'); 535 536 }, 537 success: function(responseText, statusText, xhr, $form){ 538 539 $('.newsletter').hide(); 540 $('.newsletter.bg-success').removeClass('hide').fadeIn(); 541 $('.subscription-submit').button('reset'); 542 543 setTimeout(function(){ 544 $('.newsletter input').val(''); 545 $('.newsletter').fadeIn(); 546 $('.newsletter.bg-success').addClass('hide'); 547 }, 4000); 548 549 } 550 }); 551 552 return false; 553 554 }); 555 556 if($('.fill-address-by-zipcode')[0]){ 557 $('.fill-address-by-zipcode .zipcode').blur(function(){ 558 var wrapper = $(this).closest('.fill-address-by-zipcode'); 559 var zipcode = wrapper.find('[name=zipcode]').val(); 560 if(zipcode === undefined){ 561 zipcode = wrapper.find('.zipcode').val(); 562 } 563 wrapper.block({ message: 'Carregando...' }); 564 $.get('https://viacep.com.br/ws/'+zipcode+'/json/', function(response){ 565 wrapper.find('[name=address], .address').val(response.logradouro); 566 wrapper.find('[name=city], .city').val(response.localidade); 567 wrapper.find('[name=state], .state').val(response.uf); 568 wrapper.unblock(); 569 }) 570 .fail(function() { 571 wrapper.unblock(); 572 }); 573 }); 574 } 575 576 if($("div#dropzone-area")[0]){ 577 578 var dropzone_area = $("div#dropzone-area"); 579 var dropzone_area_thumbs = dropzone_area.find('.dropzone-thumbs'); 580 581 var url = $("div#dropzone-area").data('url'); 582 583 var myDropzone = $("div#dropzone-area"); 584 585 myDropzone.dropzone({ 586 url: url, 587 resizeWidth: 1320, 588 resizeQuality: 1.0, 589 acceptedFiles: 'image/*', 590 queuecomplete: function(file){ 591 592 var href = dropzone_area_thumbs.data('url'); 593 594 $.get(href, function(data){ 595 dropzone_area_thumbs.html(data); 596 $(".dz-preview").remove(); 597 }); 598 599 } 600 }); 601 602 } 603 604 /* Work form Save and View */ 605 if($('#work_form')[0]){ 606 $('#work_form').submit(function(){ 607 608 if($('.submit_action').val() == 'save_and_view'){ 609 610 var form = $('#work_form'); 611 612 $(this).ajaxSubmit({ 613 beforeSubmit: function(formData, jqForm, options){ 614 615 var spinner = '<div class="preloader spinner"><span style="font-size: 30pt;" class="fa fa-spinner"></span></div>' 616 617 $(form).block({ 618 message: spinner, 619 overlayCSS: { 620 backgroundColor: '#fff', 621 opacity: 0.8, 622 cursor: 'wait' 623 }, 624 css: { 625 border: 0, 626 padding: 0, 627 backgroundColor: 'transparent' 628 } 629 }); 630 631 form.find('input[type=submit]').button('loading'); 632 633 }, 634 success: function(responseText, statusText, xhr, $form){ 635 636 var response = JSON.parse(responseText); 637 // window.open(response.preview_url, '_blank'); 638 639 setTimeout(function(){ 640 window.location.href = response.preview_url; 641 }, 500); 642 643 } 644 }); 645 646 return false;
647 648 } 649 650 }); 651 } 652 /* End Work form */ 653 654 /* Work Form Submit Action */ 655 if($('.submit_action')[0]){ 656 $('input[data-value]').click(function(){ 657 var submit_action = $(this).data('value'); 658 $('.submit_action').val(submit_action); 659 if(submit_action != 'save_and_publish'){ 660 $(this).closest('form').find('input').prop('required', false); 661 $(this).closest('form').find('textarea').prop('required', false); 662 } 663 }); 664 } 665 /* End Work Form Submit Action */ 666 667 /* Work Form Price Visibility */ 668 if($('.price_visibility')[0]){ 669 $('.price_visibility').change(function(){ 670 var option = $(this).val(); 671 $('.price_visibility_options').hide(); 672 $('.price_visibility_options.'+option).show(); 673 }); 674 } 675 /* End Work Form Price Visibility */ 676 677 /* Work Form Shipping */ 678 /* 679 if($('#work_form')[0]){ 680 $('.shipping').change(function(){ 681 if($(this).val() == 1){ 682 $('.regions').show(); 683 }else{ 684 $('.regions').hide(); 685 } 686 }); 687 } 688 */ 689 /* End Work Form Shipping */ 690 691 /* Work Form Price Dolar */ 692 /* 693 $('.show_price_in_dolar').change(function(){ 694 if($(this).val() == 1){ 695 $('.price_dolar').show(); 696 $('.price_real').hide(); 697 }else{ 698 $('.price_dolar').hide(); 699 $('.price_real').show(); 700 } 701 }); 702 */ 703 704 /* 705 $('.price_dolar').blur(function(){ 706 707 var spinner = '<div class="preloader spinner"><span style="font-size: 30pt;" class="fa fa-spinner"></span></div>' 708 709 $('.price_real').closest('div').block({ 710 message: spinner, 711 overlayCSS: { 712 backgroundColor: '#fff', 713 opacity: 0.8, 714 cursor: 'wait' 715 }, 716 css: { 717 border: 0, 718 padding: 0, 719 backgroundColor: 'transparent' 720 } 721 }); 722 723 var price = $(this).val(); 724 725 if(price > 0){ 726 $.getJSON(window.base_url+'galleries/get_dolar_conversion/'+price+'/JSON', function(response){ 727 if(response.errors == 0){ 728 $('.price_real').val(response.result.value); 729 } 730 $('.price_real').closest('div').unblock(); 731 }); 732 }else{ 733 $('.price_real').closest('div').unblock(); 734 } 735 736 }); 737 $('.price_real').blur(function(){ 738 739 var spinner = '<div class="preloader spinner"><span style="font-size: 30pt;" class="fa fa-spinner"></span></div>' 740 741 $('.price_dolar').closest('div').block({ 742 message: spinner, 743 overlayCSS: { 744 backgroundColor: '#fff', 745 opacity: 0.8, 746 cursor: 'wait' 747 }, 748 css: { 749 border: 0, 750 padding: 0, 751 backgroundColor: 'transparent' 752 } 753 }); 754 755 var price = $(this).val(); 756 757 if(price > 0){ 758 $.getJSON(window.base_url+'galleries/get_real_conversion/'+price+'/JSON', function(response){ 759 if(response.errors == 0){ 760 $('.price_dolar').val(response.result.value); 761 } 762 $('.price_dolar').closest('div').unblock(); 763 }); 764 }else{ 765 $('.price_dolar').closest('div').unblock(); 766 } 767 768 }); 769 */ 770 /* End Work Form Price Dolar */ 771 772 /* Work View */ 773 /* 774 if($('.inner_zoom')[0]){ 775 $('.inner_zoom').elevateZoom({ 776 zoomType: "inner", 777 cursor: "crosshair", 778 zoomWindowFadeIn: 500, 779 zoomWindowFadeOut: 750 780 }); 781 } 782 */ 783 784 $('body').on('click', '.work .thumbnails img', function(){ 785 786 var index = $(this).attr('data-index'); 787 $('.work .current-image .image').hide(); 788 $('.work .current-image .image[data-index='+index+']').show(); 789 790 /* 791 $('.zoomContainer').remove(); 792 793 $('.inner_zoom').elevateZoom({ 794 zoomType: "inner", 795 cursor: "crosshair", 796 zoomWindowFadeIn: 500, 797 zoomWindowFadeOut: 750, 798 refresh: 1 799 }); 800 */ 801 802 803 }); 804 /* End Work View */ 805 806 /* Like */ 807 $('body').on('click', '.like', function(e){ 808 809 var button = $(this); 810 var wrapper = $(this).closest('.link_action'); 811 var url = $(this).attr('href'); 812 813 if(wrapper.is('.active')){ 814 wrapper.removeClass('active'); 815 }else{ 816 wrapper.addClass('active'); 817 } 818 819 $.get(url, function(responseText){ 820 821 var response = JSON.parse(responseText); 822 823 if(response.authorized){ 824 if(response.errors == 0){ 825 if(response.status == 1){ 826 wrapper.addClass('active'); 827 }else{ 828 wrapper.removeClass('active'); 829 } 830 } 831 }else{ 832 login_required(); 833 } 834 835 }); 836 837 e.preventDefault(); 838 839 }); 840 /* End Like */ 841 842 /* Buy */ 843 $('body').on('click', '.buy', function(e){ 844 845 var button = $(this).button('loading'); 846 var url = $(this).attr('href'); 847 848 try { 849 850 $.get(url, function(responseText){ 851 852 var response = JSON.parse(responseText); 853 854 if(response.errors == 0){ 855 856 var url = response.redirect; 857 858 $('#remote-modal').modal('show'); 859 $('#remote-modal .modal-content').html('<div class="panel no-margin-bottom"><div class="panel-body text-center" style="min-height: 200px; line-height: 200px;"><i class="fa fa-spinner spinner"></i></div></div>'); 860 $('#remote-modal .modal-content').load(url); 861 862 $('#remote-modal .modal-dialog').removeClass('modal-lg'); 863 $('#remote-modal .modal-dialog').removeClass('modal-sm'); 864 $('#remote-modal .modal-dialog').removeClass('modal-xs'); 865 if($(this).data('modal-size')){ 866 $('#remote-modal .modal-dialog').addClass($(this).data('modal-size')); 867 } 868 869 $('#remote-modal .modal-dialog').addClass('modal-lg'); 870 871 /* 872 $('.featured-modal-overlay').fadeIn('fast'); 873 $('.featured-modal').addClass('opened'); 874 875 var spinner = '<div class="preloader spinner"><span style="font-size: 30pt;" class="fa fa-spinner"></span></div>' 876 877 $('.featured-modal').block({ 878 message: spinner, 879 overlayCSS: { 880 backgroundColor: '#fff', 881 opacity: 0.8, 882 cursor: 'wait' 883 }, 884 css: { 885 border: 0, 886 padding: 0, 887 backgroundColor: 'transparent' 888 } 889 }); 890 891 $.get($('.featured-modal .feature-modal-ajax-target').data('url'), function(response){ 892 893 $('.featured-modal').unblock(); 894 895 $('.featured-modal .feature-modal-ajax-target').html(response); 896 897 }); 898 */ 899 900 }else{ 901 $('#remote-modal').modal('hide'); 902 swal('Ops', response.message, 'error'); 903 } 904 905 button.button('reset'); 906 907 }); 908 909 }catch(err) { 910 $('#remote-modal').modal('hide'); 911 swal('Ops', 'Houve um erro ao processar a solicitação, por favor tente novamente.', 'error'); 912 button.button('reset'); 913 } 914 915 e.preventDefault(); 916 917 }); 918 /* End Buy */ 919 920 /* Confirm Availability */ 921 $('.confirm_availability').click(function(e){ 922 923 if(confirm('Tem certeza que deseja prosseguir? Essa ação não pode ser desfeita.')){ 924 925 var button = $(this); 926 var url = $(this).attr('href'); 927 var wrapper = $(this).closest('.order_wrapper'); 928 929 button.button('loading'); 930 931 $.get(url, function(responseText){ 932 933 var response = JSON.parse(responseText); 934 935 if(response.errors == 0){ 936 937 wrapper.fadeOut('fast'); 938 939 var url = response.redirect; 940 941 $('#remote-modal').modal('show'); 942 $('#remote-modal .modal-content').html('<div class="panel no-margin-bottom"><div class="panel-body text-center" style="min-height: 200px; line-height: 200px;"><i class="fa fa-spinner spinner"></i></div></div>'); 943 $('#remote-modal .modal-content').load(url); 944 945 $('#remote-modal .modal-dialog').removeClass('modal-lg'); 946 $('#remote-modal .modal-dialog').removeClass('modal-sm'); 947 $('#remote-modal .modal-dialog').removeClass('modal-xs'); 948 if($(this).data('modal-size')){ 949 $('#remote-modal .modal-dialog').addClass($(this).data('modal-size')); 950 } 951 952 } 953 954 button.button('reset'); 955 956 }); 957 958 } 959 960 e.preventDefault(); 961 962 }); 963 /* End Confirm Availability */ 964 965 /* Denied Availability */ 966 $('.denied_availability').click(function(e){ 967 968 if(confirm('Tem certeza que deseja prosseguir? Essa ação não pode ser desfeita.')){ 969 970 var button = $(this); 971 var url = $(this).attr('href'); 972 var wrapper = $(this).closest('.order_wrapper'); 973 974 button.button('loading'); 975 976 $.get(url, function(responseText){ 977 978 var response = JSON.parse(responseText); 979 980 if(response.errors == 0){ 981 982 setTimeout(function(){ 983 wrapper.fadeOut('fast'); 984 swal('Obrigado', 'Status atualizado com sucesso! Não se preocupe, avisaremos ao cliente sobre a situação.', 'success'); 985 button.button('reset'); 986 }, 2000); 987 988 }else{ 989 990 button.button('reset'); 991 992 } 993 994 }); 995 996 } 997 998 e.preventDefault(); 999 1000 }); 1001 /* End Denied Availability */ 1002 1003 /* Accept Offer */ 1004 $('.accept_offer').click(function(e){ 1005 1006 if(confirm('Tem certeza que deseja prosseguir? Essa ação não pode ser desfeita.')){ 1007 1008 var button = $(this); 1009 var url = $(this).attr('href'); 1010 var wrapper = $(this).closest('.offer_wrapper'); 1011 1012 button.button('loading'); 1013 1014 $.get(url, function(responseText){ 1015 1016 var response = JSON.parse(responseText); 1017 1018 if(response.errors == 0){ 1019 1020 setTimeout(function(){ 1021 wrapper.fadeOut('fast');
1022 swal('Obrigado', 'Obrigado, avisaremos ao cliente.', 'success'); 1023 button.button('reset'); 1024 }, 2000); 1025 1026 }else{ 1027 1028 button.button('reset'); 1029 1030 } 1031 1032 }); 1033 1034 } 1035 1036 e.preventDefault(); 1037 1038 }); 1039 /* End Confirm Availability */ 1040 1041 /* Denied Availability */ 1042 $('.decline_offer').click(function(e){ 1043 1044 if(confirm('Tem certeza que deseja prosseguir? Essa ação não pode ser desfeita.')){ 1045 1046 var button = $(this); 1047 var url = $(this).attr('href'); 1048 var wrapper = $(this).closest('.offer_wrapper'); 1049 1050 button.button('loading'); 1051 1052 $.get(url, function(responseText){ 1053 1054 var response = JSON.parse(responseText); 1055 1056 if(response.errors == 0){ 1057 1058 setTimeout(function(){ 1059 wrapper.fadeOut('fast'); 1060 swal('Obrigado', 'Obrigado, avisaremos ao cliente.', 'success'); 1061 button.button('reset'); 1062 }, 2000); 1063 1064 }else{ 1065 1066 button.button('reset'); 1067 1068 } 1069 1070 }); 1071 1072 } 1073 1074 e.preventDefault(); 1075 1076 }); 1077 /* End Denied Availability */ 1078 1079 function login_required(){ 1080 1081 var url = window.base_url+'/users/login?reload=1'; 1082 $('#remote-modal').modal('show'); 1083 $('#remote-modal .modal-content').html('<div class="panel no-margin-bottom"><div class="panel-body text-center" style="min-height: 200px; line-height: 200px;"><i class="fa fa-spinner spinner"></i></div></div>'); 1084 $('#remote-modal .modal-content').load(url); 1085 1086 $('#remote-modal .modal-dialog').removeClass('modal-lg'); 1087 $('#remote-modal .modal-dialog').removeClass('modal-sm'); 1088 $('#remote-modal .modal-dialog').removeClass('modal-xs'); 1089 if($(this).data('modal-size')){ 1090 $('#remote-modal .modal-dialog').addClass($(this).data('modal-size')); 1091 } 1092 1093 } 1094 1095 1096 /* Interactions */ 1097 $('body').on('click', '.switch-interactions', function(e){ 1098 1099 var wrapper = $(this).closest('.like_and_share'); 1100 1101 var icon = $(this).find('i'); 1102 if(icon.hasClass('far')){ 1103 icon.removeClass('far'); 1104 icon.addClass('fa'); 1105 wrapper.addClass('visible'); 1106 }else{ 1107 icon.removeClass('fa'); 1108 icon.addClass('far'); 1109 wrapper.removeClass('visible'); 1110 } 1111 1112 e.preventDefault(); 1113 1114 var action = $(this).attr('href'); 1115 $.get(action, function(response){}); 1116 1117 }); 1118 1119 /* Schedule */ 1120 $('body').on('click', '.schedule', function(e){ 1121 1122 var google_agenda = $(this).attr('data-google-agenda-url'); 1123 1124 var button = $(this); 1125 $(this).toggleClass('active'); 1126 e.preventDefault(); 1127 1128 var action = $(this).attr('href'); 1129 $.get(action, function(response){}); 1130 1131 if(button.is('.active') && google_agenda.length > 0){ 1132 swal({ 1133 title: "Google Agenda", 1134 text: "Deseja adicionar o evento ao Google Agenda?", 1135 // type: "warning", 1136 showCancelButton: true, 1137 confirmButtonColor: "#DD6B55", 1138 confirmButtonText: "Sim, adicionar", 1139 cancelButtonText: "Não, obrigado", 1140 closeOnConfirm: false 1141 }, 1142 function(){ 1143 1144 swal.close(); 1145 window.open(google_agenda, '_blank'); 1146 1147 }); 1148 } 1149 1150 }); 1151 1152 1153 /* Countdown */ 1154 // Set the date we're counting down to 1155 function startCountdown(){ 1156 1157 var date = $('.countdown').attr('data-date'); 1158 // var countDownDate = new Date(date).getTime(); 1159 var countDownDate = moment(date).valueOf(); 1160 1161 var startdate = $('.countdown').attr('data-start-date'); 1162 // var now = new Date(startdate).getTime(); 1163 var now = moment(startdate).valueOf(); 1164 1165 // Update the count down every 1 second 1166 var x = setInterval(function() { 1167 1168 // Find the distance between now and the count down date 1169 var distance = countDownDate - now; 1170 1171 // console.log(distance); 1172 // console.log(countDownDate); 1173 // console.log(now); 1174 1175 if(distance < 0){ 1176 $('.countdown').removeClass('active'); 1177 clearInterval(x); 1178 } 1179 1180 // Time calculations for days, hours, minutes and seconds 1181 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 1182 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 1183 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 1184 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 1185 1186 var day_label = days; 1187 if(days <= 9){ 1188 day_label = '0'+days; 1189 } 1190 if(days < 0){ 1191 day_label = 0; 1192 } 1193 1194 var hour_label = hours; 1195 if(hours <= 9){ 1196 hour_label = '0'+hours; 1197 } 1198 if(hours < 0){ 1199 hour_label = 0; 1200 } 1201 1202 var min_label = minutes; 1203 if(minutes <= 9){ 1204 min_label = '0'+minutes; 1205 } 1206 1207 var seg_label = seconds; 1208 if(seconds <= 9){ 1209 seg_label = '0'+seconds; 1210 } 1211 1212 $('.countdown .day span').html(day_label); 1213 $('.countdown .hour span').html(hour_label); 1214 $('.countdown .min span').html(min_label); 1215 $('.countdown .seg span').html(seg_label); 1216 1217 now = now + 1000; 1218 1219 }, 1000); 1220 1221 setTimeout(function(){ 1222 $('.countdown').addClass('active'); 1223 }, 1000); 1224 } 1225 1226 1227 if($('.countdown')[0]){ 1228 var countdown_status = window.localStorage.getItem('countdown'); 1229 if(countdown_status !== 'closed'){ 1230 startCountdown(); 1231 } 1232 } 1233 1234 $('.countdown .close').click(function(){ 1235 window.localStorage.setItem('countdown', 'closed'); 1236 $('.countdown').removeClass('active'); 1237 }); 1238 /* End Countdown */ 1239 1240 /* Schedule Hours */ 1241 if($('.schedules.unique')[0]){ 1242 $('.schedules.unique').find('input[type=checkbox]').change(function(){ 1243 $('.schedules input[type=checkbox]').prop('checked', false); 1244 $(this).prop('checked', true); 1245 }); 1246 } 1247 /* End Schedule Hours */ 1248 1249 /* Menu Fixed */ 1250 // if($(window).width() > 992){ 1251 $(window).scroll(function(){ 1252 if($(this).scrollTop() > 40){ 1253 $('body').addClass('header-fixed'); 1254 }else{ 1255 $('body').removeClass('header-fixed'); 1256 } 1257 }); 1258 // } 1259 /* End Menu Fixed */ 1260 1261 $('.hello-window .close').click(function(e){ 1262 var type = $(this).attr('data-type'); 1263 window.localStorage.setItem('whatsapp_close_'+type, 1); 1264 $(this).closest('.hello-window').remove(); 1265 e.stopPropagation(); 1266 }); 1267 1268 var whatsapp_close_type = $('.hello-window .close').attr('data-type'); 1269 var whatsapp_close = window.localStorage.getItem('whatsapp_close_'+whatsapp_close_type); 1270 if(whatsapp_close != 1){ 1271 $('.whatsapp.float .hello-window').removeClass('d-none'); 1272 } 1273 1274 $('.content-text .read-more').click(function(){ 1275 var wrapper = $(this).closest('.content-text'); 1276 wrapper.find('.content-text-full').removeClass('d-none'); 1277 wrapper.find('.content-text-short').addClass('d-none'); 1278 }); 1279 1280 $('.content-text .read-less').click(function(){ 1281 var wrapper = $(this).closest('.content-text'); 1282 wrapper.find('.content-text-full').addClass('d-none'); 1283 wrapper.find('.content-text-short').removeClass('d-none'); 1284 }); 1285 1286});
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.