PageSourceSearch

https://www.surpreendastore.com/js/ljvt_v3/principal/conteudos_din…=d2070eb2639cb8c9378f28ae7dbfe1eb7eebb896

js surpreendastore.com collected 2026-09-27 00:51:57 UTC 39,087 bytes, 1,166 lines download raw bytes

1/////////////////////////////////////////////////// YOUTUBE API ////////////////////////////////////////////////////////
2/*
3var scriptUrl = 'https:\/\/www.youtube.com\/s\/player\/cfa9e7cb\/www-widgetapi.vflset\/www-widgetapi.js';window['yt_embedsEnableHouseBrandAndYtCoexistence'] =  true ;try{var ttPolicy=window.trustedTypes.createPolicy("youtube-widget-api",{createScriptURL:function(x){return x}});scriptUrl=ttPolicy.createScriptURL(scriptUrl)}catch(e){}var YT;if(!window["YT"])YT={loading:0,loaded:0};var YTConfig;if(!window["YTConfig"])YTConfig={"host":"https://www.youtube.com"};
4if(!YT.loading){YT.loading=1;(function(){var l=[];YT.ready=function(f){if(YT.loaded)f();else l.push(f)};window.onYTReady=function(){YT.loaded=1;for(var i=0;i<l.length;i++)try{l[i]()}catch(e$0){}};YT.setConfig=function(c){for(var k in c)if(c.hasOwnProperty(k))YTConfig[k]=c[k]};var a=document.createElement("script");a.type="text/javascript";a.id="www-widgetapi-script";a.src=scriptUrl;a.async=true;var c=document.currentScript;if(c){var n=c.nonce||c.getAttribute("nonce");if(n)a.setAttribute("nonce",n)}var b=
5  document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)})()};
6*/
7
8/////////////////////////////////////////////////// TOPO MOBILE ////////////////////////////////////////////////////////
9function busca_produto_mobile()
10{
11  var nome_produto = jQuery('.inputMobileBusca').val();
12  if(nome_produto.length) {
13    var buscaProdutoUrl =  BASE_URL + 'busca-busca_produtos?';
14    var obj = {
15      nome_produto : nome_produto
16    }
17
18    buscaProdutoUrl += $.param(obj);
19    location.href = buscaProdutoUrl;
20  }
21}
22jQuery(document).ready(function()
23{
24  jQuery('.inputMobileBusca').on('keypress',function(e) {
25    if(e.which == 13)
26    {
27      busca_produto_mobile()
28    }
29  });
30  //jQuery('.iconeMobileBusca').click(function()
31  jQuery('body').on('click', '.iconeMobileBusca', function()
32  {
33    busca_produto_mobile();
34  });
35
36
37
38  //jQuery('.mobileCategoria').click(function()
39  jQuery('body').on('click', '.mobileCategoria', function()
40  {
41    jQuery('.mobileOverflowOutsideCategoria').addClass('mobileOverflowOutsideCategoriaAberto');
42  });
43  //jQuery('.mobileOverflowOutsideCategoria').click(function(event)
44  jQuery('body').on('click', '.mobileOverflowOutsideCategoria', function(event)
45  {
46    if(jQuery(event.target).is('.mobileOverflowOutsideCategoria'))
47    {
48      jQuery('.mobileOverflowOutsideCategoria').removeClass('mobileOverflowOutsideCategoriaAberto');
49
50    }
51  });
52  //jQuery('.mobileItemCategoriaSeta').click(function()
53  jQuery('body').on('click', '.mobileItemCategoriaSeta', function()
54  {
55    var categoria_encontrar = jQuery(this).closest(".mobileItemOfCategoria");
56    console.log(categoria_encontrar);
57    if(categoria_encontrar.hasClass('mobileItemOfCategoriaAberta'))
58    {
59      categoria_encontrar.removeClass('mobileItemOfCategoriaAberta');
60    }
61    else {
62      categoria_encontrar.addClass('mobileItemOfCategoriaAberta');
63    }
64  });
65});
66
67
68////////////////////////////////////////////////// TOPO CARRINHO ///////////////////////////////////////////////////////
69/**
70 * Created by BRUNO on 23/05/17.
71 */
72
73/*FUNCAO QUE REMOVE ITEM DO CARRINHO PELO TOPO*/
74
75var topoCarrinhoModule = (function($){
76  var _removeItemCarrinho = function (value)
77  {
78    var uniqid = value.item.uniqid;
79
80    var confirmFunc = new confirmDialog(function(){
81      $.ajax({
82        url: BASE_URL + 'checkout-ajax_excluir_produto_carrinho',
83        data: {uniqid : uniqid },
84
85        success: function(resp) {
86          console.log(resp);
87          if(resp.sucesso) {
88            topoCarrinho_config.vr_total_preco = resp.sucesso.dados_carrinho.total_produtos.vr_total_preco;
89            topoCarrinho_config.qtd_produto = resp.sucesso.dados_carrinho.total_produtos.qtd_total_prod;
90            topoCarrinho_arr_itens.splice(value.index, 1);
91            if(typeof carrinhoScope !== "undefined")
92            {
93              carrinhoScope.checkout = resp.sucesso;
94            }
95            if($('#btnFrete').length > 0)
96            {
97              $('#btnFrete').click();
98            }
99            topoCarrinhoatualizaIndicadorQtdCarrinho();
100            topoCarrinhoatualizaIndicadorPrecoCarrinho();
101            if(typeof atualiza_resumo_carrinho !== "undefined")
102            {
103              atualiza_resumo_carrinho();
104            }
105          }
106        },
107
108        error: function(resp) {
109          console.log(resp);
110        }
111      })
112    });
113    confirmFunc.create('Tem certeza que deseja remover este produto?');
114  };
115  var _tipoCarrinhoAlteraQuantidadeProduto = function(sucesso)
116  {
117    if(typeof topoCarrinho_config != "undefined" && topoCarrinho_arr_itens != "undefined") {
118      topoCarrinho_config.qtd_produto = sucesso.dados_checkout.dados_carrinho.total_produtos.qtd_total_prod;
119      topoCarrinho_config.vr_total_preco = sucesso.dados_checkout.dados_carrinho.total_produtos.vr_total_preco;
120
121      //ATUALIZA CARRINHO
122      //limpa array
123      topoCarrinho_arr_itens.splice(0, topoCarrinho_arr_itens.length);
124      //atualiza array
125      for(var i=0; i < sucesso.dados_checkout.dados_carrinho.produtos_carrinho.length; i++)
126      {
127        topoCarrinho_arr_itens.push(sucesso.dados_checkout.dados_carrinho.produtos_carrinho[i]);
128      }
129    }
130
131  };
132
133  return {
134    removeItemCarrinho: function(el, value) {
135      _removeItemCarrinho(value);
136    },
137    tipoCarrinhoAlteraQuantidadeProduto : function (sucesso)
138    {
139      _tipoCarrinhoAlteraQuantidadeProduto(sucesso);
140    }
141  }
142
143  function topoCarrinhoatualizaIndicadorQtdCarrinho()
144  {
145    if(typeof carrinhoModule !=="undefined")
146    {
147      carrinhoModule.atualizaIndicadorQtdCarrinho();
148    }
149  }
150
151  function topoCarrinhoatualizaIndicadorPrecoCarrinho()
152  {
153    if(typeof carrinhoModule !== "undefined")
154    {
155      carrinhoModule.atualizaIndicadorPrecoCarrinho();
156    }
157
158  }
159});
160
161var triggaEventosCarrinho = function(resp)
162{
163  if (!resp.hasOwnProperty('sucesso')) return;
164
165  var data = resp.sucesso;
166  if (typeof fbq === 'function' && !data.produto_ja_adicionado) {
167    fbq('track', 'AddToCart', {
168      content_ids: [data.id_loja_produto],
169      content_type: 'product',
170      content_name: data.nome_produto,
171      value: data.vr_preco,
172      currency: 'BRL'
173    });
174  }
175}
176
177$(function() {
178  topoCarrinhoModule = topoCarrinhoModule;
179});
180
181/////////////////////////////////////////////// LISTAGEM DE PRODUTOS ///////////////////////////////////////////////////
182(function ($) {
183  $(document).off('click');
184  $(document).on('click', 'div.botaoComprarProduto', function (e) {
185    e.preventDefault();
186    e.stopPropagation();
187    var id_loja_produto = $(this).closest('.boxItemListagem').attr('attr-id-loja-produto');
188    var link_produto = $(this.closest('.boxItemListagem')).attr('attr-link-produto');
189    var qtd_minima_venda = $(this).closest('.boxItemListagem').attr('attr-qtd-minima-venda');
190
191    if (!(flg_desativa_venda_rapida_mobile == 1 && jQuery.browser.mobile) && qtd_minima_venda < 2 && flg_venda_rapida == 1) {
192      compra_rapida = 1;
193      $.ajax({
194        url: BASE_URL + 'produto-ajax_retorna_partial_subprodutos',
195        data: {
196          id_loja_produto: id_loja_produto
197        },
198        dataType: 'json',
199        // async: false,
200        beforeSend: function () {
201          processandoDialog.create();
202        },
203        success: function (resp) {
204          if (resp.sucesso && resp.sucesso.partial) {
205            $('#contentModalSubprodutos').css('display', 'none').html(resp.sucesso.partial).modal({
206              fadeDuration: 250,
207              fadeDelay: 0.3
208            });
209          }
210          else {
211
212            $.ajax({
213              url: BASE_URL + 'checkout-ajax_adiciona_produto_checkout',
214              data: {
215                id_loja_produto: id_loja_produto,
216                ids_subprodutos: {},
217                qtd_prod: 1
218              },
219              beforeSend: function () {
220                processandoDialog.create();
221              },
222              complete: function () {
223                //processandoDialog.remove();
224              },
225              success: function (resp) {
226                if (resp.sucesso) {
227                  atualiza_resumo_carrinho();
228                  if (typeof triggaEventosCarrinho === 'function') {
229                    triggaEventosCarrinho(resp);
230                  }
231                  if (flg_venda_rapida_modal_sucesso == true) {
232                    $("#contentModalFinalizarCompraRapida").css({ width: '600px', height: '150px', display: 'none' })
233                      .load(BASE_URL + 'checkout-ajax_retorna_partial_compra_rapida_carrinho', function () {
234                        $(this).modal();
235                      });
236                  }
237                }
238                else {
239                  //processandoDialog.remove();
240                  location.href = link_produto;
241                }
242              },
243              error: function (resp) {
244                console.log(resp);
245              }
246            });
247          }
248        },
249        complete: function () {
250          //processandoDialog.remove();
251        }
252      });
253    }
254    else {
255      location.href = link_produto;
256    }
257
258  })
259})(jQuery);
260
261//LISTAGEM EM LINHA
262//FUNÇÃO RESPONSAVEL POR:
263// - Determinar a altura da listagem em linha de acordo com a altura do elemento da listagem
264// - Inserir as respectivas ordens de cada elemento
265// - Aplicar a distancia necessária para suavizar o efeito de transição
266function verificaListagemLinha() {
267  $('.elementoListagemLinha').each(function (i, obj) {
268    $(this).children('.boxItemListagem:first-child').addClass('referencia');
269
270    var alturaContainer = $(this).height();
271    var qtdItensListagem = $(this).children('.boxItemListagem').length;
272    var larguraItemListagem = $(this).children('.referencia').outerWidth(true);
273    var larguraQtdItens = larguraItemListagem * qtdItensListagem;
274    var larguraConteudoListagem = $(this).parent('.elementoListagem').width();
275
276    $(this).parent('.elementoListagem').css('overflow', 'hidden');
277
278    $(this).parent('.elementoListagem').css('height', alturaContainer + 2); // + 2, pois algumas listagens possuem bordas, outlines e/ou box-shadow
279
280    $(this).children('.controlaListagem').remove();
281
282    if (larguraQtdItens > larguraConteudoListagem) {
283      $(this).children('.boxItemListagem:first-child').addClass('recebeEfeito');
284
285      for (u = 1; u <= qtdItensListagem; u++) {
286        $(this).children('.boxItemListagem').eq(u - 1).css('order', u);
287      }
288
289      $(this).css('left', -larguraItemListagem);
290
291      if (qtdItensListagem <= 5) {
292        $(this).parent('.elementoListagem').css('max-width', larguraItemListagem * 4);
293      }
294
295      // Move a listagem para a esquerda, uma vez, para exibir o primeiro 
295item corretamente
296      $(this).css("left", "+=" + larguraItemListagem);
297      var numItemListagem = $(this).children('.boxItemListagem').length;
298      var itemFocado = $(this).siblings('.setaEsquerdaListagemLinha');
299      setTimeout(function () {
300        setaEsquerda(itemFocado, larguraItemListagem, numItemListagem);
301      }, 300);
302
303      //$(this).parent('.elementoListagem').removeClass('tipoAlinhamentoElementoEsquerda tipoAlinhamentoElementoCentralizado tipoAlinhamentoElementoDireita');
304    }
305    else {
306      $(this).css({ 'left': '0', 'width': '100%' });
307      $(this).siblings('.setaListagemLinha').hide();
308    }
309
310
311
312    /* if ( qtdItensListagem < 5 > 3  )
313     {
314         $(this).parent('.elementoListagem ').css('width',larguraItemListagem * 2);
315     }
316
317     if ( qtdItensListagem < 4 > 2  )
318     {
319         $(this).parent('.elementoListagem ').css('width',larguraItemListagem);
320     }
321
322     if ( qtdItensListagem == 2  )
323     {
324
325     }
326
327     if ( qtdItensListagem == 1  )
328     {
329         $(this).parent('.elementoListagem ').css('width',larguraItemListagem);
330         $(this).css('left','0');
331         $(this).siblings('.setaListagemLinha').hide();
332     }*/
333  });
334}
335
336//Função responsável pela rolagem para a direita da listagem de produtos em linha
337function setaDireita(seta, distancia, qtd) {
338  $(seta).siblings('.elementoListagemLinha').children('.boxItemListagem').each(function (i, obj) {
339    var ordem = $(this).css('order');
340
341
342    if (ordem <= qtd) {
343      $(this).css('order', '-=1');
344    }
345    if (ordem == 1) {
346      $(this).css('order', qtd);
347    }
348  });
349
350  $(seta).siblings('.elementoListagemLinha').css('left', -distancia);
351  $(seta).parent('.elementoListagem').removeClass('emProgresso');
352
353
354  if ($(seta).siblings('.elementoListagemLinha').children('.recebeEfeito').next().length == 0) {
355    $(seta).siblings('.elementoListagemLinha').children('.recebeEfeito').removeClass('recebeEfeito');
356    $(seta).siblings('.elementoListagemLinha').children('.boxItemListagem:first-child').addClass('recebeEfeito');
357  }
358  else {
359    $(seta).siblings('.elementoListagemLinha').children('.recebeEfeito').removeClass('recebeEfeito').next().addClass('recebeEfeito');
360  }
361
362
363}
364
365//Função responsável pela rolagem para a esquerda da listagem de produtos em linha
366function setaEsquerda(seta, distancia, qtd) {
367  $(seta).siblings('.elementoListagemLinha').children('.boxItemListagem').each(function (i, obj) {
368    var ordem = $(this).css('order');
369    if (ordem <= qtd) {
370      $(this).css('order', '+=1');
371    }
372    if (ordem == qtd) {
373      $(this).css('order', '1');
374    }
375  });
376
377  $(seta).siblings('.elementoListagemLinha').css('left', -distancia);
378  $(seta).parent('.elementoListagem').removeClass('emProgresso');
379
380
381  if ($(seta).siblings('.elementoListagemLinha').children('.recebeEfeito').prev().length == 0) {
382    $(seta).siblings('.elementoListagemLinha').children('.recebeEfeito').removeClass('recebeEfeito');
383    $(seta).siblings('.elementoListagemLinha').children('.boxItemListagem:last-child').addClass('recebeEfeito');
384  }
385  else {
386    $(seta).siblings('.elementoListagemLinha').children('.recebeEfeito').removeClass('recebeEfeito').prev().addClass('recebeEfeito');
387  }
388}
389
390//Função responsável pelo SLIDER para a direita da listagem de produtos em linha
391function setaDireitaSlider(seta, distancia, qtd) {
392  $(seta).children('.boxItemListagem').each(function (i, obj) {
393    var ordem = $(this).css('order');
394    if (ordem <= qtd) {
395      $(this).css('order', '+=1');
396    }
397    if (ordem == qtd) {
398      $(this).css('order', '1');
399    }
400  });
401
402  $(seta).css('left', -distancia);
403  $(seta).parent('.elementoListagem').removeClass('emProgresso');
404
405  if ($(seta).children('.recebeEfeito').prev().length == 0) {
406    $(seta).children('.recebeEfeito').removeClass('recebeEfeito');
407    $(seta).children('.boxItemListagem:last-child').addClass('recebeEfeito');
408  }
409  else {
410    $(seta).children('.recebeEfeito').removeClass('recebeEfeito').prev().addClass('recebeEfeito');
411  }
412}
413
414//Função responsável pelo SLIDER para a esquerda da listagem de produtos em linha
415function setaEsquerdaSlider(seta, distancia, qtd) {
416
417  $(seta).children('.boxItemListagem').each(function (i, obj) {
418    var ordem = $(this).css('order');
419    if (ordem <= qtd) {
420      $(this).css('order', '-=1');
421    }
422    if (ordem == 1) {
423      $(this).css('order', qtd);
424    }
425  });
426
427  $(seta).css('left', -distancia);
428  $(seta).parent('.elementoListagem').removeClass('emProgresso');
429
430  if ($(seta).children('.recebeEfeito').next().length == 0) {
431    $(seta).children('.recebeEfeito').removeClass('recebeEfeito');
432    $(seta).children('.boxItemListagem:first-child').addClass('recebeEfeito');
433  }
434  else {
435    $(seta).children('.recebeEfeito').removeClass('recebeEfeito').next().addClass('recebeEfeito');
436  }
437}
438
439// Função responsável por controlar a largura dos itens de cada listagem ( à direita e centralizada )
440//
441// Dependendo da quantidade de itens em uma listagem, haverão dois comportamentos diferentes
442// 1ª Condição: Caso haja quebra de linha na listagem, ou seja, mais produtos que uma linha comporta:
443// A largura do primeiro item da listagem será usada como referência para ser distribuida para os outros itens como largura máxima
444//
445// 2ª Condição: Caso não haja quebra de linha, ou seja, a quantidade de produtos é comportada pela linha:
446// A largura do primeiro item será utilizada como referência, mas também receberá seu  próprio valor como largura máxima juntamente com os outros itens da listagem
447function larguraItemAlinhadoDireitaCentro() {
448  $('.elementoListagem.tipoAlinhamentoElementoDireita, .elementoListagem.tipoAlinhamentoElementoCentralizado').each(function () {
449    var larguraReferencia = $(this).find('.boxItemListagem:first-child').outerWidth();
450    var alturaReferencia = $(this).find('.boxItemListagem:first-child').outerHeight();
451    var alturaContainer = $(this).children('.containerListagem').height();
452
453    // Simula uma altura de itens da listagem com duas linhas
454    var alturaDuplicada = alturaReferencia * 2;
455    var elem = $(this);
456
457    if (alturaContainer > alturaDuplicada) {
458      $(this).find('.boxItemListagem:not(:first-child)').css('max-width', larguraReferencia);
459      $(this).find('.boxItemListagem:first-child').removeAttr('style');
460    }
461    else {
462      $(this).find('.boxItemListagem').css('max-width', larguraReferencia);
463    }
464
465    setTimeout(function () {
466      elem.find('.controlaListagem').hide();
467      elem.children('.containerListagem').css({ 'opacity': '1', 'transition': 'opacity 0.15s' });
468    }, 150);
469  });
470
471  // Aplica o efeito de opacidade na div da tela de busca
472  // Esta aplicação é necessária, pois, na tela de busca, foi necessário remover o efeito de opacidade da listagem que estava dificultando a exibição no momento que o ajax_filtra_produtos rodava
473  setTimeout(function () {
474    if ($('.conteudoListagemProdutosBusca.buscaLjvtV3').length != 0) {
475      $('.conteudoListagemProdutosBusca.buscaLjvtV3 .elementoListagem').css('opacity', '1');
476      $('.gifCarregandoListagem').css('opacity', '0');
477    }
478  }, 150);
479}
480
481$(function () {
482
483  setTimeout(function () {
484    larguraItemAlinhadoDireitaCentro();
485  }, 50);
486
487  //Função que verifica se o item da listagem NÃO é de compra rápida e redireciona para a tela do produto específico clicado
488  $('#template').on('click', '.itemProdutoListagem', function () {
489    var link_produto = $(this).children('.conteudoItemListagem').attr('attr-link-produto');
490    if ($(this).children('.conteudoItemListagem').is(":last-child")) {
491      location.href = link_produto;
492    }
493  });
494
495  //LISTAGEM EM LINHA
496  // Chama a função principal da listagem em linha
497  setTimeout(function () {
498    verificaListagemLinha();
499  }, 300);
500
501  //Seta Direita
502  $('body').on('click', '.setaDireitaListagemLinha ', function () {
503    $(this).parent('.elementoListagem').addClass('emProgresso');
504
505    var larguraItemListagem = $(this).siblings('.elementoListagemLinha').children('.boxItemListagem').outerWidth(true);
506    $(this).siblings('.elementoListagemLinha').animate({ "left": '-=' + larguraItemListagem }, 300);
507
508    var numItemListagem = $(this).siblings('.elementoListagemLinha').children('.boxItemListagem').length;
509    var itemFocado = $(this);
510    setTimeout(function () {
511      setaDireita(itemFocado, larguraItemListagem, numItemListagem);
512    }, 400);
513  });
514
515  //Seta Esquerda
516  $('body').on('click', '.setaEsquerdaListagemLinha ', function () {
517    $(this).parent('.elementoListagem').addClass('emProgresso');
518
519    var larguraItemListagem = $(this).siblings('.elementoListagemLinha').children('.boxItemListagem').outerWidth(true);
520    $(this).siblings('.elementoListagemLinha').animate({ "left": '+=' + larguraItemListagem }, 300);
521
522    var numItemListagem = $(this).siblings('.elementoListagemLinha').children('.boxItemListagem').length;
523    var itemFocado = $(this);
524    setTimeout(function () {
525      setaEsquerda(itemFocado, larguraItemListagem, numItemListagem);
526    }, 400);
527  });
528
529  // Deslizar para a Direita ( rolar para a esquerda )
530  $('.elementoListagemLinha').on('swiperight', function () {
531    $(this).parent('.elementoListagem').addClass('emProgresso');
532
533    var numItemListagem = $(this).children('.boxItemListagem').length;
534    var itemFocado = $(this);
535    setTimeout(function () {
536      setaDireitaSlider(itemFocado, larguraItemListagem, numItemListagem);
537    }, 400);
538
539    var larguraItemListagem = $(this).children('.boxItemListagem').outerWidth(true);
540    $(this).animate({ "left": '+=' + larguraItemListagem }, 300);
541    $(this).siblings('.indicadorSliderMobile').css('opacity', '0');
542  });
543
544  // Deslizar para a Esquerda ( rolar para a esquerda )
545  $('.elementoListagemLinha').on('swipeleft', function () {
546    $(this).parent('.elementoListagem').addClass('emProgresso');
547
548    var numItemListagem = $(this).children('.boxItemListagem').length;
549    var itemFocado = $(this);
550    setTimeout(function () {
551      setaEsquerdaSlider(itemFocado, larguraItemListagem, numItemListagem);
552    }, 400);
553
554    var larguraItemListagem = $(this).children('.boxItemListagem').outerWidth(true);
555    $(this).animate({ "left": '-=' + larguraItemListagem }, 300);
556    $(this).siblings('.indicadorSliderMobile').css('opacity', '0');
557  });
558
559  $('body').on('click', '.emProgresso ', function (e) {
560    return false;
561  });
562
563});
564
565$(window).resize(function () {
566  larguraItemAlinhadoDireitaCentro();
567});
568
569// update resumo carrinho
570var atualiza_resumo_carrinho = function () {
571
572  $.ajax({
573    url: BASE_URL + 'ajax/ajax_resumo_carrinho',
574    dataType: 'json',
575    type: 'get',
576    beforeSend: function () {
577      //processandoDialog.remove();
578      //processandoDialog.create();
579    },
580    success: function (data) {
581      console.log(data);
582      /*     $('.boxItensCarrinho').html(data.html_traduzido);
583          $('.carrinhoReduzidoQtd').text(data.total_qtd + ' ITENS');
584          $('.contadorResumoCarrinho').text(data.total_qtd);
585          $('.carrinhoReduzidoPreco').text('R$ ' + data.total_valor);*/
586      if (typeof topoCarrinhoItens != "undefined") {
587        topoCarrinhoItens.topoCarrinho_arr_itens = data.carrinho.produtos_carrinho;
588      }
589      if (typeof topoCarrinho_config != "undefined") {
590        topoCarrinho_config.vr_total_preco = data.carrinho.total_produtos.vr_total_preco;
591        topoCarrinho_config.qtd_produto = data.carrinho.total_produtos.qtd_total_prod;
592        topoCarrinho_config.text_itens_carrinho = data.carrinho.total_produtos.qtd_total_prod > 1?' Itens':' Item';
593      }
594
595      if (typeof data.carrinho.dados_barra_frete_gratis != "undefined") {
596          seta_progresso_frete_gratis(data.carrinho.dados_barra_frete_gratis.percentual_barra_frete_gratis);
597          setTimeout(function(){
598            $('.textosProgresso .valor').text('R$ '+data.carrinho.dados_barra_frete_gratis.diferenca_frete_manual_gratis_formatado);
599          },300);
600      }
601
602      if (typeof data.carrinho.dados_aplicativo_cashback != "undefined") {
603          $('.boxInfoCashback p').html(data.carrinho.dados_aplicativo_cashback.texto_cashback);
604      }
605
606      if (typeof data.carrinho.metas_ativas != "undefined") {
607          console.log(data.carrinho.metas_ativas);
608          $.each(data.carrinho.metas_ativas, function(key, value) {
609            var id_meta = value.id_loja_meta_brinde;
610            $('.boxItemMeta[attr-id_meta="'+id_meta+'"] p').html(value.texto_progresso_meta);
611            if (value.flg_meta_conquistada) {
612              $('.boxItemMeta[attr-id_meta="'+id_meta+'"]').addClass('metaConquistada vibrar');
613            } else {
614              $('.boxItemMeta[attr-id_meta="'+id_meta+'"]').removeClass('metaConquistada vibrar');
615            }
616          });
617      }
618
619      //Atualiza os itens na listagem de produtos
620      if (typeof data.carrinho.produtos_carrinho != "undefined") {
621          $('.boxItemListagem').removeClass('produtoInseridoCarrinho');
622          $.each(data.carrinho.produtos_carrinho, function(key, value) {
623              var id_produto = value.id_loja_produto;
624              $('.boxItemListagem[attr-id-loja-produto="'+id_produto+'"]').addClass('produtoInseridoCarrinho');
625          });
626      }
627
628      var qtd_carrinho = data.total_qtd;
629      var texto_qtd = qtd_carrinho == '1' || qtd_carrinho == '0' ? ' Item' : ' Itens';
630      $('.contadorResumoCarrinho').text(data.total_qtd);
631      $('.carrinhoReduzidoPreco').text('R$ ' + data.total_valor);
632
633      if( data.total_qtd > 1 ) {
634        $('.cart-update-text-itens').text(' Itens');
635      } else {
636        $('.cart-update-text-itens').text(' Item');
637      }
638
639      $('.cart-update-topo-carrinho').attr('attr-qtd_carrinho', qtd_carrinho);
640    }
641  });
642};
643
644
645
646/////////////////////////////////////////// CACHE E CONTEÚDOS DINÂMICOS ////////////////////////////////////////////////
647var UpdateCachedData = (function () {
648
649  'use strict';
650
651  /**
652   * Create the Constructor object
653   */
654  var Constructor = function () {
655
656    //
657    // Variables
658    //
659
660    var publicAPIs = {};
661
662    /**
663     * Atualiza o box de afiliados
664     *
665     * @param affiliateData
666     */
667    var updateAffiliateData = function (affiliateData) {
668      var $boxAfiliado = $('.cached-info-affiliate');
669      if ($boxAfiliado.length === 0) return;
670
671      if (affiliateData.length > 0) {
672        $boxAfiliado.replaceWith(affiliateData);
673      } else {
674        $boxAfiliado.remove();
675      }
676    };
677
678
679    var updateAcabouComprar = function (acabouComprar) {
680      var $boxAcabouComprar = $('.boxVitrineFlutuante');
681      if ($boxAcabouComprar.length === 1) return;
682
683      jQuery('body').append(acabouComprar);
684    };
685
686    /**
687     * Atualiza box de login do topo
688     *
689     * @param topLoginData
690     */
691    var updateTopLoginData = function (topLoginData) {
692
693      if (!topLoginData) return;
694
695      var $topoLoginElement = $('.cached-info-top-login');
696      if ($topoLoginElement.length) {
697        $topoLoginElement.replaceWith(topLoginData);
698      }
699    };
700
701    var updateWelcomeData = function (clientName) {
702
703      var $cacheBemVindo = $('.cache-bem-vindo');
704      if ($cacheBemVindo.length) {
705        if (clientName) {
706          var html = $cacheBemVindo.data('logado');
707          if (html.indexOf('{{ nome }}') > -1) {
708            html = html.replace(new RegExp("{{ nome }}", 'g'), clientName);
709          }
710
711          if (html.indexOf('{{nome}}') > -1) {
712            html = html.replace(new RegExp("{{nome}}", 'g'), clientName);
713          }
714          $cacheBemVindo.html(html);
715        } else {
716          $cacheBemVindo.html($cacheBemVindo.data('deslogado'));
717        }
718      }
719
720      var $cacheBemVindoIcon = $('.cache-bem-vindo-icon');
721      if ($cacheBemVindoIcon.length) {
722        $cacheBemVindoIcon
723            .removeClass($cacheBemVindoIcon.data('logado'))
724            .removeClass($cacheBemVindoIcon.data('deslogado'));
725        if (clientName) {
726          $cacheBemVindoIcon.addClass($cacheBemVindoIcon.data('logado'));
727        } else {
728          $cacheBemVindoIcon.addClass($cacheBemVindoIcon.data('deslogado'));
729        }
730      }
731    };
732
733    var updateLoginArea = function (areaLoginData) {
734
735      if (!areaLoginData) return;
736      for (var areaLoginItem in areaLoginData) {
737        var $areaLoginElement = $('[attr-id-loja-tema-conteudo="' + areaLoginItem + '"]');
738        if ($areaLoginElement.length) {
739          $areaLoginElement.replaceWith(areaLoginData[areaLoginItem]);
740        }
741      }
742      // $areaLoginElement.replaceWith(areaLoginData);
743    };
744
745    /**
746     * Atualiza o conteúdo do box de carrinho
747     *
748     * @param cartData
749     */
750    var updateCartData = function (cartData) {
751      var textoItensCarrinho = cartData.total_qtd <= 1?' Item':' Itens';
752      $('.cart-update-qtd').text(cartData.total_qtd + textoItensCarrinho);
753      $('.cart-update-qtd-somente-qtd').text(cartData.total_qtd);
754      $('.cart-update-preco').text('R$ ' + cartData.total_valor);
755      if( cartData.total_qtd > 1 ) {
756        $('.cart-update-text-itens').text(' Itens');
757      } else {
758        $('.cart-update-text-itens').text(' Item');
759      }
760    };
761
762    /**
763     * Atualiza os itens das listagens que estão no carrinho
764     *
765     * @param cartData
766     */
767    var updateCartProductsList = function (cartData) {
768      $.each(cartData.carrinho.produtos_carrinho, function(key, value) {
769          var id_produto = value.id_loja_produto;
770          $('.boxItemListagem[attr-id-loja-produto="'+id_produto+'"]').addClass('produtoInseridoCarrinho');
771      });
772    };
773
774    /**
775     * Atualiza resumo do carrinho
776     *
777     * @param topResumeCartData
778     * @param cartData
779     */
780    var updateTopResumeCartData = function (topResumeCartData, cartData) {
781      if ($(".containerGenericoCarrinhoTopo").length === 0) return;
782      if (typeof topoCarrinhoItens === 'undefined') return;
783      if (typeof rivets === 'undefined') return;
784
785      $('.cart-update-topo-carrinho').replaceWith(topResumeCartData);
786
787      topoCarrinhoItens.topoCarrinho_arr_itens = cartData.carrinho.produtos_carrinho;
788      topoCarrinho_config.qtd_produto = cartData.total_qtd;
789      topoCarrinho_config.vr_total_preco = cartData.total_valor_raw;
790      rivets.bind(
791          $(".containerGenericoCarrinhoTopo"),
792          {
793            topoCarrinhoItens: topoCarrinhoItens,
794            topoCarrinho_config: topoCarrinho_config,
795            topoCarrinhoModule: topoCarrinhoModule
796          }
797      );
798    };
799
800    /**
801     * Atualiza os conteúdos dinâmicos
802     * @param data
803     */
804    var update = function (data, options) {
805      if (data.hasOwnProperty('affiliate')) {
806        updateAffiliateData(data.affiliate);
807      }
808      if (data.hasOwnProperty('acabou_comprar')) {
809        updateAcabouComprar(data.acabou_comprar);
810      }
811      if (data.hasOwnProperty('flg_pagina_inicial')) {
812        if (data.flg_pagina_inicial == '1') {
813          var cookieName = "passouPrePagina";
814          var cookieValue = document.cookie.match('(^|[^;]+)\\s*' + cookieName + '\\s*=\\s*([^;]+)');
815          if (cookieValue) {
816            cookieValue = cookieValue.pop();
817          }
818
819          if ((window.self === window.top)) {
820            if (cookieValue) {
821
822            } else {
823              if( $('body').hasClass('home') ) {
824                $('body, html').css('overflow', 'hidden');
825                window.scrollTo({
826                  top: 0
827                });
828                jQuery('.prePagina').hide().fadeIn(200);
829              }
830            }
831          } else {
832            console.log("Página está dentro de iframe, então nao carregar pre pagina");
833          }
834        }
835      }
836
837      if (data.hasOwnProperty('topLogin')) {
838        updateTopLoginData(data.topLogin);
839      }
840
841      if (data.hasOwnProperty('clientName')) {
842        updateWelcomeData(data.clientName);
843      }
844
845      if (data.hasOwnProperty('areaLogin') && options.areaLogin) {
846        updateLoginArea(data.areaLogin);
847      }
848
849      if (data.hasOwnProperty('cartData')) {
850        updateCartData(data.cartData);
851        updateTopResumeCartData(data.topCartResume, data.cartData);
852        updateCartProductsList(data.cartData);
853      }
854
855      $('.iframePopUp:not(.iframePopUpEsqueciMinhaSenha)').magnificPopup({
856        type: 'iframe'
857      });
858
859      $('.iframePopUpDuvida, .iframePopUpEsqueciMinhaSenha').magnificPopup({
860        type: 'iframe',
861        callbacks: {
862          open: function() {
863            $('.mfp-content').addClass('modalDuvida');
864            $('.mfp-iframe-holder .mfp-content').css('opacity','1');
865          },
866        },
867      });
868    };
869
870    var show = function() {
871      $('.boxSaudacaoDinamica, .carrinhoReduzidoQtd, .loginPedidosDinamico, .containerGenericoCarrinhoTopo, .contadorResumoCarrinho, .carrinhoReduzidoPreco, .iconeDinamicoLogin, .bem-vindo p:last-child, .bem-vindo span').css('opacity', '1');
872      $('.cached-info-top-login, .cart-update-qtd, .cart-update-qtd-somente-qtd, .cart-update-topo-carrinho, .update-area-login-container, .cache-bem-vindo, .cache-bem-vindo-icon').css('opacity', '1');
873
874      if ($('.cached-info-affiliate').length) {
875        $('.cached-info-affiliate').fadeIn('fast');
876      }
877    };
878
879    /**
880     * Another public method
881     */
882    publicAPIs.init = function (options) {
883
884
885
886      if (!options.hasCache) {
887        // show();
888        // return;
889      }
890
891      var $areaLogin = $('.update-area-login-container');
892      options.areaLogin = $areaLogin.length > 0;
893      this.options = options;
894
895      if (typeof param_local_login !== 'undefined') {
896        options.param_local_login = param_local_login;
897      }
898
899      options.origin = location.href;
900
901          //coloca no options informações de processamento da loja
902          var performanceData = null;
903          try {
904            if (window.performance && window.performance.getEntriesByType) {
905              var performanceEntries = performance.getEntriesByType("navigation");
906              if (performanceEntries && performanceEntries.length) {
907                var currentUrl = window.location.href;
908                var navigationTiming = performanceEntries[0];
909                var pageLoadTime = navigationTiming.loadEventEnd - navigationTiming.fetchStart;
910                var dnsLookupTime = navigationTiming.domainLookupEnd - navigationTiming.domainLookupStart;
911                var tcpConnectionTime = navigationTiming.connectEnd - navigationTiming.connectStart;
912                var serverProcessingTime = navigationTiming.responseEnd - navigationTiming.requestStart;
913                var domLoadingTime = navigationTiming.domContentLoadedEventEnd - navigationTiming.fetchStart;
914                var pageRenderingTime = navigationTiming.loadEventStart - navigationTiming.domContentLoadedEventEnd;
915
916                performanceData = {
917                  desc_performance_log_url: currentUrl,
918                  desc_performance_log_page_load: pageLoadTime,
919                  desc_performance_log_dns_lookup: dnsLookupTime,
920                  desc_performance_log_tcp: tcpConnectionTime,
921                  desc_performance_log_processing: serverProcessingTime,
922                  desc_performance_log_dom_load: domLoadingTime,
923                  desc_performance_log_rendering: pageRenderingTime,
924                  desc_performance_log_apl:x_enviroment
925                };
926              }
927
928            }
929
930          } catch (error) {
931            console.log(error);
932          }
933          options.loadInfo = performanceData;
934          //testa se ta na tela de produto
935          if (typeof id_loja_produto !== 'undefined' && id_loja_produto !== null && id_loja_produto !== '') {
936            options.id_loja_produto = id_loja_produto;
937          }
938          else
939          {
940            options.id_loja_produto = 0;
941          }
942
943          if (typeof data_agora !== 'undefined')
944          {
945            options.data_agora = data_agora;
946          }
947
948          $.ajax({
949            url: BASE_URL + '/ajax/ajax_cache',
950            dataType: 'json',
951            data: options,
952            type: 'post',
953            async: true,
954            xhrFields: {
955              withCredentials: true
956            },
957            beforeSend: function () {
958              processandoDialog.remove();
959            },
960            success: function (data) {
961              update(data, options);
962              processandoDialog.remove();
963            },
964            complete: function () {
965              show();
966            }
967          });
968
969
970    };
971
972
973    //
974    // Return the Public APIs
975    //
976
977    return publicAPIs;
978
979  };
980
981
982  return Constructor;
983})();
984
985
986/////////////////////////////////////////// Google analytics 4 ////////////////////////////////////////////////
987const LJVTGA4 = (function () {
988
989  /**
990   * Disparado quando usuário efetua o login
991   *
992   * @return void
993   */
994  function login() {
995    if (typeof gtag4 !== 'undefined') {
996      gtag4("event", "login", {
997        method: "Formulário de Login"
998      });
999    }
1000  }
1001
1002  /**
1003   * Disparado quando usuário efetua uma compra
1004   *
1005   * @param array data
1006   * @return void
1007   */
1008  function purchase(data) {
1009    // TODO
1010    if (typeof gtag4 !== 'undefined') {
1011      gtag4("event", "purchase", data);
1012    }
1013  }
1014
1015  /**
1016   * Disparado quando usuário efetua uma busca
1017   *
1018   * @param array data
1019   * @return void
1020   */
1021  function search(search_term) {
1022    if (typeof gtag4 !== 'undefined') {
1023      gtag4("event", "search", {
1024        search_term: search_term
1025      });
1026    }
1027  }
1028
1029  /**
1030   * Disparado quando usuário seleciona uma forma de pagamento
1031   *
1032   * @param array data
1033   * @return void
1034   */
1035  function addPaymentInfo(data) {
1036    if (typeof gtag4 !== 'undefined') {
1037      gtag4("event", "add_payment_info", data);
1038    }
1039  }
1040
1041  /**
1042   * Disparado quando usuário seleciona uma forma de frete
1043   *
1044   * @param array data
1045   * @return void
1046   */
1047  function addShippingInfo(data) {
1048    if (typeof gtag4 !== 'undefined') {
1049      gtag4("event", "add_shipping_info", data);
1050    }
1051  }
1052
1053  /**
1054   * Disparado quando usuário adiciona um item ao carrinho
1055   *
1056   * @param array data
1057   * @return void
1058   */
1059  function addToCart(data) {
1060    if (typeof gtag4 !== 'undefined') {
1061      gtag4("event", "add_to_cart", data);
1062    }
1063  }
1064
1065  /**
1066   * Disparado quando usuário inicia o processo de checkout
1067   *
1068   * @param array data
1069   * @return void
1070   */
1071  function beginCheckout(data) {
1072    if (typeof gtag4 !== 'undefined') {
1073      gtag4("event", "begin_checkout", data);
1074    }
1075  }
1076
1077  /**
1078   * Disparado quando usuário efetua o cadastro ou registra na newsletter
1079   *
1080   * @param array data
1081   * @return void
1082   */
1083  function generateLead() {
1084    if (typeof gtag4 !== 'undefined') {
1085      gtag4("event", "generate_lead");
1086    }
1087  }
1088
1089  /**
1090   * Disparado quando usuário remove um item do carrinho
1091   *
1092   * @param array data
1093   * @return void
1094   */
1095  function removeFromCart(data) {
1096    if (typeof gtag4 !== 'undefined') {
1097      gtag4("event", "remove_from_cart", data);
1098    }
1099  }
1100
1101  /**
1102   * Disparado quando usuário visualiza os itens no carrinho
1103   *
1104   * @param array data
1105   * @return void
1106   */
1107  function viewCart(data) {
1108    if (typeof gtag4 !== 'undefined') {
1109      gtag4("event", "view_cart", data);
1110    }
1111  }
1112
1113  /**
1114   * Disparado quando usuário visualiza um produto
1115   *
1116   * @param array data
1117   * @return void
1118   */
1119  function viewItem(data) {
1120    if (typeof gtag4 !== 'undefined') {
1121      gtag4("event", "view_item", data);
1122    }
1123  }
1124
1125  function formataProdutosCarrinhoGA4(produtos_carrinho)
1126  {
1127    produtos_carrinho = produtos_carrinho || [];
1128    var itemsGA4 = [];
1129    for (var i = 0; i < produtos_carrinho.length; i++) {
1130      var produto = produtos_carrinho[i];
1131      var codigo = produto.desc_codigo_manual.length > 0 ? produto.desc_codigo_manual : produto.id_loja_produto;
1132      var discount = 0.00;
1133      if (produto.vr_preco_de > 0) {
1134        discount = produto.vr_preco - produto.vr_preco_de;
1135      }
1136
1137      var item = {
1138        item_id: codigo,
1139        item_name: produto.nome_produto,
1140        discount: discount,
1141        index: i,
1142        item_brand: produto.desc_marca,
1143        price: produto.vr_preco,
1144        quantity: produto.qtd_prod
1145      };
1146      itemsGA4.push(item);
1147    }
1148
1149    return itemsGA4;
1150  }
1151
1152  return {
1153    login,
1154    purchase,
1155    search,
1156    addPaymentInfo,
1157    addShippingInfo,
1158    addToCart,
1159    beginCheckout,
1160    generateLead,
1161    removeFromCart,
1162    viewCart,
1163    viewItem,
1164    formataProdutosCarrinhoGA4
1165  };
1166})();

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.