Number.prototype.formatMoney = function (c, d, t) { var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "." : d, t = t == undefined ? "," : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; 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) : ""); }; (function ($, window) { var theme = { init: function () { theme.header(); theme.resets(); theme.breadcrumbs(); // theme.reviewsSlider(); theme.aboutSwiper(); //theme.sectionInstagram(); var htmlDOM = $('html'); new LazyLoad({ elements_selector: ".lazyload" }); $('.option.support, .support-mob').click(function(){ $('.center-menu-option.support, .shadow-float-menu-option').addClass('active'); $('.nav-mobile').removeClass('active'); }); // setTimeout(function(){ // $('tray-login').on('click','.tray-btn-default' , function(){ // if($('.tray-container.tray-container__identify').is(':visible') && $('.tray-container.tray-container__identify .register').length == 0){ // $('.tray-container.tray-container__identify #tray-login-identify').after('não tenho cadastro'); // } // }); // $('tray-login').on('click','.tray-btn-default' , function(){ // if($('.tray-container.tray-container__identify').is(':visible') && $('.tray-container.tray-container__identify .register').length == 0){ // $('.tray-container.tray-container__identify #tray-login-identify').after('não tenho cadastro'); // } // }); // },4000); $('.tray-btn-default').click(function(){ $('.tray-container.tray-container__identify #tray-login-identify').after('não tenho cadastro'); }); $('.option.account, .login-mob').click(function(){ // $('.center-menu-option.account, .shadow-float-menu-option').addClass('active'); setTimeout(function(){ if($('.tray-container.tray-container__identify').is(':visible') && $('.tray-container.tray-container__identify .register').length == 0){ $('.tray-container.tray-container__identify #tray-login-identify').after('não tenho cadastro'); } },100); $('tray-login').show(); // $('.shadow-float-menu-option').addClass('active'); $('.nav-mobile, .shadow-float-menu-option').removeClass('active'); }); $('.center-menu-option .ico-close, .shadow-float-menu-option').click(function(){ $('.center-menu-option, .shadow-float-menu-option').removeClass('active'); }); $('.float-menu-option .ico-close, .shadow-float-menu-option, .float-menu-option .continue, .nav-mobile .icon-close').click(function(){ $('.float-menu-option, .shadow-float-menu-option, .nav-mobile').removeClass('active'); }); $('.header .menu').click(function(){ $('.nav-mobile').addClass('active'); $('.shadow-float-menu-option').addClass('active'); }); $('.nav-mobile .list-nav > .sub > a').click(function(e){ e.preventDefault(); $(this).closest('.sub').toggleClass('active'); }); $('.open-search').click(function(e){ $('.search-block').addClass('search-active'); $('.shadow-busca').addClass('active'); }); $('.search-block .close, .shadow-busca').click(function(e){ $('.search-block').removeClass('search-active'); $('.shadow-busca').removeClass('active'); }); $('.noticias li').wrapInner('
'); $('.section-reviews .dep_dados').wrap(''); $('.dep_lista li:hidden').remove(); if (htmlDOM.hasClass('page-depoimentos')) { theme.depositions(); } if (htmlDOM.hasClass('page-finalizar_presentes')) { theme.present(); } if (htmlDOM.hasClass('page-politica-de-privacidade')) { $('.site-main > .page-content > .container').removeClass('container'); } if (htmlDOM.hasClass('page-termos-de-uso')) { $('.site-main > .page-content > .container').removeClass('container'); } if (htmlDOM.hasClass('page-politica-de-troca-e-devolucao')) { $('.site-main > .page-content > .container').removeClass('container'); } theme.bannerFull(); theme.slideProduct(); $('.slide-depoimentos .images .item').click(function(){ var verifyDepoimentImg = $(this).attr('data-item'); $('.slide-depoimentos .item').removeClass('active'); $(this).addClass('active'); $('.slide-depoimentos > .item').each(function(){ var verifyDepoiment = $(this).attr('data-item'); if (verifyDepoiment == verifyDepoimentImg){ $(this).addClass('active'); } }); }); // $('body').on('click', '#tray-login-identify', function(){ // setTimeout(function(){ // $('.tray-btn-default').click(function(){ // $('.tray-container.tray-container__identify #tray-login-identify').after('não tenho cadastro'); // }); // },500); // }); }, layLoadCustom: function () { return { listSlide: function () { new LazyLoad({ elements_selector: ".lazyload", callback_loaded: function (element) { var boxLoaderImage = $(element).parents('.box-image'); $(element).addClass('loaded') if (boxLoaderImage.length) { boxLoaderImage.addClass('lazy-end-load'); } } }); } } }, header: function () { $('.footer .title:not(.no-click)').click(function () { $(this).toggleClass('active'); }); $('.sidebar-category .sub-filter').click(function (e) { $(this).toggleClass('active'); }); $('.sidebar-category li.sub .sub-filter').click(function (e) { e.preventDefault(); }); this.scrollHeader(); $(window).resize(function () { theme.scrollHeader(); }); }, scrollHeader: function () { var didScroll, lastScrollTop = 0, delta = 5, navbarHeight = $('.header').outerHeight(), topBar = $('.message-top').length ? $('.message-top').outerHeight() : 0, wrapper = $(".wrapper"); ($(window).scrollTop() > topBar) ? wrapper.addClass("fixed") : wrapper.removeClass("fixed"); $(window).scroll(function () { ($(window).scrollTop() > topBar) ? wrapper.addClass("fixed") : wrapper.removeClass("fixed"); didScroll = true; }); setInterval(function () { if (didScroll) { hasScrolled(); didScroll = false; } }, 250); function hasScrolled() { var st = $(this).scrollTop(); if (Math.abs(lastScrollTop - st) <= delta) { return; } if (st > lastScrollTop && st > navbarHeight) { wrapper.removeClass('show-nav') } else { if (st + $(window).height() < $(document).height()) { wrapper.addClass('show-nav') } } lastScrollTop = st; } }, resets: function () { // busca avancada $('.page-search #Vitrine input[type="image"]').after('') $('.page-search #Vitrine input[type="image"]').remove(); $('.advancedSearchFormBTimg').addClass('botao-commerce'); // trocar senha $('.page-central_senha input[type="image"]').after('').remove(); // panel if (!([ 'page-company', 'page-nossa-historia', 'page-sobre', ].includes($('html').attr('class')))) { $('.col-panel .tablePage, .page-extra .page-content table,.page-extras .page-content table, .board_htm table').wrap('
'); } $('.caixa-cadastro #email_cadastro').attr('placeholder', 'Seu e-mail'); $('.txt-forma-pagamento').each(function () { $(this).text($(this).text().replace(' - Yapay', '')); }); $('#imagem[src*="filtrar.gif"]').after(''); $('#imagem[src*="filtrar.gif"]').remove(); $('input[src*="gerarordem.png"]').after(''); $('input[src*="gerarordem.png"]').remove(); }, bannerFull: function () { var bannerFull = $('.banner-full'); if (bannerFull.length) { var config = bannerFull.data('config'), total = $('.banner-full .swiper-slide').length, paginate = (total > 1) ? { clickable: true, el: '.banner-full .swiper-pagination' } : false; new Swiper('.banner-full .swiper-container', { preloadImages: false, effect: config.fade ? 'fade' : 'slide', navigation: { nextEl: '.banner-full .swiper-arrow-next', prevEl: '.banner-full .swiper-arrow-prev', }, // autoHeight: true, autoplay: { delay: Number(config.time), disableOnInteraction: config.stop }, lazy: { loadPrevNext: true, }, pagination: paginate, loop: (total > 1) }); } new Swiper('.banner .swiper-container', { preloadImages: false, effect: 'fade', autoHeight: true, autoplay: { delay: 4000, disableOnInteraction: false }, loop: true, lazy: { loadPrevNext: true, } }); }, slideProduct: function () { new LazyLoad({ elements_selector: '.list-slide', callback_enter: function (element) { var config = $(element).data('config'), total = element.querySelectorAll('.swiper-slide').length, paginate = (total > 1) ? { clickable: true, el: element.querySelector('.swiper-pagination') } : false, autoplay = config.autoplay ? { delay: Number(config.time), disableOnInteraction: config.stop } : false; new Swiper(element.querySelector('.swiper-container'), { slidesPerView: 2, pagination: paginate, autoplay: autoplay, spaceBetween: 25, autoHeight: true, lazy: { loadPrevNext: false, }, navigation: { nextEl: element.querySelector('.swiper-arrow-next'), prevEl: element.querySelector('.swiper-arrow-prev'), }, loop: config.loop, breakpoints: { 1025: { slidesPerView: 4 }, 800: { slidesPerView: 3, }, 460: { slidesPerView: 2, } }, }); } }); setTimeout(function () { new LazyLoad({ elements_selector: '.section-brands', callback_enter: function (element) { var configs = JSON.parse(element.getAttribute('data-config')), total = element.querySelectorAll('.swiper-slide').length, paginate = (total > 1) ? { clickable: true } : false; new Swiper(element.querySelector('.swiper-container'), { preloadImages: false, slidesPerView: 1, lazy: { loadPrevNext: true, }, autoplay: { delay: configs.time }, navigation: { nextEl: element.querySelector('.swiper-arrow-next'), prevEl: element.querySelector('.swiper-arrow-prev'), }, breakpoints: { 1025: { slidesPerView: 4 }, 800: { slidesPerView: 3 }, 461: { slidesPerView: 2 } } }); } }); }, 50) $('#form-comments #bt-submit-comments').before('').remove(); }, aboutSwiper: function(){ var years = new Swiper('.bg-section-years .swiper-container', { loop: false, // thumbs: { // swiper: contentYears // }, slidesPerView: 'auto', }); var contentYears = new Swiper('.tabs-years .swiper-container', { loop: false, slidesPerView: 'auto', watchSlidesVisibility: true, autoHeight: true, thumbs: { swiper: years }, }); }, image: function (value, element) { typeof element == 'object' ? element = $(element) : void 0; var result = ((element.height() - element.width()) / element.width()) * 100; (result > value) ? element.addClass('vertical') : element.addClass('horizontal'); }, depositions: function () { $('#depoimento a').prepend('
ENVIAR
'); $('.page-content h2:first').appendTo('.depoimentos-modal .append'); $('.page-content h2:last').remove(); $('#comentario_cliente').appendTo('.depoimentos-modal .append'); $('.page-content .container').append('
Deixe seu depoimento
'); $('.botao-commerce.depoimento-event').click(function () { $('.depoimentos-modal').addClass('active'); }); }, present: function () { $('#form_presentes input[type="image"]').prev().html('
Continuar Comprando
'); $('#form_presentes input[type="image"]').wrap('
').after('').remove(); }, breadcrumbs: function () { if (!([ 'page-home', ].includes($('html').attr('class')))) { if (!$('.breadcrumb').length) { $('.page-content > .container').prepend('\ \ ') } } }, joinMessagesForToastify: function (arrayMessages) { arrayMessages = Array.isArray(arrayMessages) ? arrayMessages : [arrayMessages]; theme.toastifyAlert({ text: arrayMessages.join('
'), duration: 6000 }); }, toastifyAlert: function () { var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, urlRedirect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null, counter = 0, intervalToastify = setInterval(function () { if (typeof Toastify === 'function') { clearInterval(intervalToastify); if (typeof config.text === 'undefined' && config.text !== '') { if (urlRedirect) { window.location.href = urlRedirect; } return false; } var toastifyConfig = { text: config.text, duration: config.duration || 3000, close: config.newWindow || true, gravity: config.gravity || "bottom", position: config.position || 'right', backgroundColor: config.backgroundColor || "#3f303d", stopOnFocus: true }; if (typeof config.destination !== 'undefined') { toastifyConfig.destination = config.destination || ''; toastifyConfig.newWindow = config.newWindow || true; } Toastify(toastifyConfig).showToast(); } if (counter >= 50) { clearInterval(intervalToastify); } counter++; }, 200); }, truncate: function (input, size) { if (input.length > size) { return input.substring(0, size) + '...'; } return input; }, sectionInstagram: function () { new LazyLoad({ elements_selector: ".section-instagram", callback_enter: function () { var instagram = $('.section-instagram').data('user'); if(!instagram) return; $.instagramFeed({ 'username': $('.section-instagram').data('user'), 'container': "#container-insta", 'display_profile': false, 'display_biography': false, 'display_gallery': true, 'callback': null, 'styling': false, 'items': 5, 'lazy_load': true, 'image_size': 376, // 'on_error': console.error //Enable for show error }); } }); }, } theme.init(); window.theme = theme; })(jQuery, window);