`; $('.buy-together-container').append(plus_icon); } } let review_module = $('.reviews_list'); if(review_module.length){ reviewRestructure(review_module); } const IS_LOGIN_PAGE = $('.page-account-login').length; if(IS_LOGIN_PAGE){ } const IS_CATEGORY_PAGE = $('.page-product-category').length; if(IS_CATEGORY_PAGE){ moveCategoryContentTop(); if(screen_size>=1024){ moveCategoryBreadCrumb(); } } let filter_button = $('#filter-button-side'); filter_button.on('click', function(){ $('body').toggleClass('open_filter'); $('#column-left').toggleClass('open_filter_column'); }); }); function moveDescription(){ let description = $('.product-description-content'); if(screen_size>=1024){ let image_container = $('.product-single .product-image'); if(description.length){ description.insertAfter(image_container); } } else { let product_data = $('#product'); let description = $('.product-description'); if(description.length){ let description_details = ` DETALHES DO PRODUTO
`; $(description_details).insertAfter(product_data); $('.product-description-mobile').find('.description_container').append(description); $('.product-description-content').remove(); } } let product_info = $('#product'); let breadcrumb = $('.breadcrumb'); product_info.prepend(breadcrumb); } function reviewRestructure(review_module){ review_module.owlCarousel('destroy'); review_module.owlCarousel({ margin:16, loop:true, navText: ['', ''], dots:false, nav:true, responsive:{ 0:{ items:1, }, 600:{ items:2, }, 700:{ items:3, }, 1000:{ items:4, } } }); let items = review_module.find('.item'); items.each(function(index, item){ let tamanho_original = item.querySelector('.review-text').scrollHeight; let tamanho_renderizado = item.querySelector('.review-text').clientHeight; /*Necessário o '-2' por diferença de line heights entre browsers q variam entre 1 e 2 */ const MSG_RENDERIZADA_MENOR_QUE_TAMANHO_ORIGINAL = (tamanho_original - 2) > tamanho_renderizado; if(MSG_RENDERIZADA_MENOR_QUE_TAMANHO_ORIGINAL){ createReviewButtons(item, true); } else{ createReviewButtons(item); } }); } function createReviewButtons(item, has_see_more=false){ let product_url = $(item).find('.review-link a').attr('href'); let buttons_container = ``; $(item).append(buttons_container); } function seeMoreReview(element){ let item = element.closest('.item'); item.classList.toggle('see_more'); if(item.classList.contains('see_more')){ element.textContent = 'VER MENOS'; } else { element.textContent = 'VER MAIS'; } } function moveCategoryContentTop(){ let content_top = $('.layout-content-top'); let category_info_content = $('.category-information-content'); content_top.insertAfter(category_info_content); } function moveCategoryBreadCrumb(){ let breadcrumb = $('.breadcrumb'); let category_content = $('.category-content'); category_content.prepend(breadcrumb); } /**/ $(document).ready(function() { $('.buy-toghether-buy-btn #button-cart').removeClass('button-cart'); $('.buy-toghether-buy-btn #button-cart').off('click'); $('.buy-toghether-buy-btn #button-cart').click(function() { if (!$('.buy-together-check').hasClass('text-success')) { $('.buy-together-check').click(); } $('.product-buy-button-content .button-cart').click(); }); }); /**/ $('.product-buy-button-content #button-cart').click(function() { openDrawerCart('button-cart-product'); $('#modal-cart, .modal-backdrop').remove(); }); $(document).ready(function() { $('.page-product-product ul.breadcrumb li').has('a').last().addClass('last-link'); let buttonScrollThumbnails = ``; $(buttonScrollThumbnails).appendTo('.page-product-product .product-single .product-image'); $(".button-scroll-thumbnails-container .button-scroll-thumbnails-content").click(function() { var $thumbnails = $(".product-thumbnails"); var scrollHeight = $thumbnails[0].scrollHeight; var scrollTop = $thumbnails.scrollTop(); var containerHeight = $thumbnails.outerHeight(); if (scrollTop + containerHeight >= scrollHeight) { $thumbnails.animate({ scrollTop: 0 }, 200); } else { $thumbnails.animate({ scrollTop: '+=350' }, 200); } }); var hasVerticalScroll = function(element) { return $(element).prop('scrollHeight') > $(element).height(); }; if (!(hasVerticalScroll('.page-product-product .product-single .product-thumbnails'))) { $('.button-scroll-thumbnails-container').css({ 'display': 'none' }); } $(document).ready(function() { $('#carousel0 .owl-stage-outer .owl-stage .owl-item').each(function() { let title = $(this).find("img").attr('title'); $(this).append(`${title}
`); }); }); let reviewHtmlModal = ``; $('#product .product-rating .rating').on('click', () => { let reviewCountHtml = $('#product .product-rating .rating .product-review-count').html().includes('Avaliações'); if (reviewCountHtml) { $(reviewHtmlModal).appendTo('.page-product-product'); let reviewContent = `${$('.products-review-content').html()}
`; $('.products-review-container').append($(reviewContent).html()); document.body.style.overflow = 'hidden'; $('.content-review-laroche').fadeIn(); }; }); $(document).on('click', '.backdrop-review-laroche', function(event) { if (!$(event.target).closest('.content-review-laroche').length) { $('.backdrop-review-laroche').fadeOut(); document.body.style.overflow = ''; } }); $(document).on('click', '.products-review-content-header-svg, #review-links #write-comment-link', function() { $('.backdrop-review-laroche').fadeOut(); document.body.style.overflow = ''; }); let loginHtmlContent = `RÁPIDO FÁCIL SEGURO
`; $(loginHtmlContent).insertBefore('.page-account-login .section-content .login-box #form-password'); let htmlContactFooter = ``; $(htmlContactFooter).insertBefore('.footer-contact-content li.phones-contact.footer-whatsapp'); $('li.phones-contact.footer-whatsapp').prepend('WHATSAPP ATENDIMENTO:'); $('.page-product-search .toolbar-shop').prependTo('.page-product-search .filter-side-btn-container'); $('.page-product-search .filter-side-btn-container').attr('style', 'display: flex !important'); $('.page-product-search .toolbar-shop').attr('style', 'display: flex !important'); $('.page-footer .page-footer-list li a[title="Blog"]').attr({ 'href': 'https://blog.calcadoslaroche.com.br/', 'target':'_blank' }); $('#products-related.owl-carousel').owlCarousel('destroy'); $('#products-related.owl-carousel').owlCarousel({ dots: false, nav: false, loop: true, margin: 10, responsive: { 0: { items: 2.5 }, 600: { items: 2.5 }, 1000: { items: 4 } } }); }); /*FTE-11028/11048*/ $(function(){ if($('.product-kit').length){ let plus_icon = $(``); plus_icon.insertAfter('.product-kit .product-kit-content .product-item:first-child'); } }); /*Fim FTE-11028/11048*/ if (screen.width > 1200) { $(` `).insertBefore('.page-header-search'); } else { $(``).prependTo('.page-header-support'); } /*FTE-11779*/ function copyCoupon() { const couponText = document.getElementById("coupon").innerText; navigator.clipboard.writeText(couponText).then(() => { alert("Cupom copiado: " + couponText); }).catch(err => console.error("Erro ao copiar", err)); } /*fim FTE-11779*/ /*FTE-11837*/ $(function () { if (screen.width < 1199) { let touchStartX = 0; let touchEndX = 0; $(document).on("touchstart", function (event) { touchStartX = event.originalEvent.touches[0].clientX; }); $(document).on("touchend", function (event) { touchEndX = event.originalEvent.changedTouches[0].clientX; if (touchEndX - touchStartX > 100) { closeDrawer('page-header-cart'); } }); } }); /*FIM - FTE-11837*/
