PageSourceSearch

https://www.albasbalasdecoco.com/carrega_css/carrega_conteudo_js/N…=/script20260928225048.js

js albasbalasdecoco.com collected 2026-09-29 01:51:05 UTC 13,084 bytes, 376 lines download raw bytes

1// Função responsável por organizar a exibição das categorias no topo.
2// Esta função pega a distancia da primeira categoria até o topo da página e compara com as outras categorias.
3// TODA categoria que não possuir a mesma distancia para o topo igual à primeira, será oculta.
4function verificaQuebraCategoriasTopo(){
5    //corrige problema .top sem existir elemento
6    if($('.elementoTopo .boxCategorias li').length > 0) {
7        $('.elementoTopo .boxCategorias').each(function(i, obj) {
8            var categoriaTopoDistance = $(this).children('li:first-child').offset().top;
9            $('.elementoTopo .boxCategorias > li').each(function(){
10                var alturaElementoAtual = $(this).offset().top;
11
12                if ( alturaElementoAtual > categoriaTopoDistance )
13                {
14                    $(this).css('visibility','hidden');
15                    $(this).addClass('itemInvisivel');
16                    $(this).removeClass('itemVisivel');
17                }
18                else
19                {
20                    $(this).css('visibility','visible');
21                    $(this).removeClass('itemInvisivel');
22                    $(this).addClass('itemVisivel');
23                }
24            });
25        });
26    }
27}
28
29//Função responsavel por localizar as duas últimas categorias visíveis e aplicar a classe que realiza a inversão da exibição das categorias
30function aberturaTopoCategoriaInvertida()
31{
32    $('.elementoTopo .itemInvisivel').prevAll().removeClass('subCategoriasInvertidas');
33
34    $('.elementoTopo .itemInvisivel').prevAll().removeClass('subCategoriasInvertidas');
35    $('.itemVisivel').last().prevAll().removeClass('subCategoriasInvertidas');
36    $('.itemVisivel').last().addClass('subCategoriasInvertidas');
37    $('.itemVisivel').last().prev().addClass('subCategoriasInvertidas');
38
39    $('.itemInvisivel').removeClass('subCategoriasInvertidas');
40}
41
42$(function(){
43    // Chamada da função que organiza a exibição das categorias
44    verificaQuebraCategoriasTopo();
45    aberturaTopoCategoriaInvertida();
46    $(window).resize(function(){
47        // Chamada da função que organiza a exibição das categorias
48        verificaQuebraCategoriasTopo();
49        aberturaTopoCategoriaInvertida();
50    });
51
52    //TOPO 5 -> Insere a classe, utilizada na versao mobile, que possui a função de exibir o conteúdo dos menus do topo
53    $('.estiloTopo5').on('click', '.itemMenuTopo', function(a){
54        $(this).toggleClass('itemMenuTopoAberto');
55        $(this).siblings('.itemMenuTopo').removeClass('itemMenuTopoAberto');
56        a.stopPropagation();
57
58        //TOPO 5 -> Retira a classe de exibição de conteúdo do topo ao clicar fora
59        $('body').on('click', function(){
60            $('.estiloTopo5 .itemMenuTopo').removeClass('itemMenuTopoAberto');
61        });
62    });
63
64    $('.conteudoMenuTopo').on('click', function(z){
65        z.stopPropagation();
66    });
67    /*$('.estiloTopo5').on('hover', '.boxTopoLogin', function(b){
68        $(this).addClass('itemMenuTopoAberto');
69        $(this).siblings('.itemMenuTopo').removeClass('itemMenuTopoAberto');
70        b.stopPropagation();
71    });
72
73    $('.estiloTopo5').on('hover', '.boxTopoCarrinho', function(c){
74        $(this).siblings('.itemMenuTopo').removeClass('itemMenuTopoAberto');
75        c.stopPropagation();
76    });*/
77
78    //Regras Modal "Esqueci minha senha"
79    $('.iframePopUpEsqueciMinhaSenha').attr('href', BASE_URL  + 'login-esqueci_minha_senha/');
80    $('.iframePopUp:not(.iframePopUpEsqueciMinhaSenha)').magnificPopup({
81        type: 'iframe'
82    });
83
84
85
86    $(document).on('load', function(){
87
88    });
89
90    //Verifica a altura e largura da imagem e testa se é quadrada.
91    //Caso positivo, ajusta o topo para que o logotipo tenha 200x200 pixels
92    /*
93    var img = $(".imgLogoTopo");
94    $("<img>").attr("src", $(img).attr("src")).load(function(){
95        var altura = this.width;
96        var largura = this.height;
97        var subtracao = altura - largura;
98
99        if( subtracao == 0 && altura >= 200 && largura >= 200)
100        {
101            $('.elementoTopo').addClass('logoQuadrado');
102        }
103        //alert("Original width=" + largura + ", " + "Original height=" + altura);
104
105    });
106    */
107});
108/**
109 * Created by BRUNO on 23/05/17.
110 */
111
112/*FUNCAO QUE REMOVE ITEM DO CARRINHO PELO TOPO*/
113
114var topoCarrinhoModule = (function($){
115    var _removeItemCarrinho = function (value)
116    {
117        var uniqid = value.item.uniqid;
118
119        var confirmFunc = new confirmDialog(function(){
120            $.ajax({
121                url: BASE_URL + 'checkout-ajax_excluir_produto_carrinho',
122                data: {uniqid : uniqid },
123
124                success: function(resp) {
125                    console.log(resp);
126                    if(resp.sucesso) {
127                        topoCarrinho_config.vr_total_preco = resp.sucesso.dados_carrinho.total_produtos.vr_total_preco;
128                        topoCarrinho_config.qtd_produto = resp.sucesso.dados_carrinho.total_produtos.qtd_total_prod;
129                        topoCarrinho_arr_itens.splice(value.index, 1);
130                        if(typeof carrinhoScope !== "undefined")
131                        {
132                            carrinhoScope.checkout = resp.sucesso;
133                        }
134                        if($('#btnFrete').length > 0)
135                        {
136                            $('#btnFrete').click();
137                        }
138                        topoCarrinhoatualizaIndicadorQtdCarrinho();
139                        topoCarrinhoatualizaIndicadorPrecoCarrinho();
140                        if(typeof atualiza_resumo_carrinho !== "undefined")
141                        {
142                            atualiza_resumo_carrinho();
143                        }
144                    }
145                },
146
147                error: function(resp) {
148                    console.log(resp);
149                }
150            })
151        });
152        confirmFunc.create('Tem certeza que deseja remover este produto?');
153    };
154    var _tipoCarrinhoAlteraQuantidadeProduto = function(sucesso)
155    {
156        if(typeof topoCarrinho_config != "undefined" && topoCarrinho_arr_itens != "undefined") {
157            topoCarrinho_config.qtd_produto = sucesso.dados_checkout.dados_carrinho.total_produtos.qtd_total_prod;
158            topoCarrinho_config.vr_total_preco = sucesso.dados_checkout.dados_carrinho.total_produtos.vr_total_preco;
159
160            //ATUALIZA CARRINHO
161            //limpa array
162            topoCarrinho_arr_itens.splice(0, topoCarrinho_arr_itens.length);
163            //atualiza array
164            for(var i=0; i < sucesso.dados_checkout.dados_carrinho.produtos_carrinho.length; i++)
165            {
166                topoCarrinho_arr_itens.push(sucesso.dados_checkout.dados_carrinho.produtos_carrinho[i]);
167            }
168        }
169
170    };
171
172    return {
173        removeItemCarrinho: function(el, value) {
174            _removeItemCarrinho(value);
175        },
176        tipoCarrinhoAlteraQuantidadeProduto : function (sucesso)
177        {
178            _tipoCarrinhoAlteraQuantidadeProduto(sucesso);
179        }
180    }
181
182    function topoCarrinhoatualizaIndicadorQtdCarrinho()
183    {
184        if(typeof carrinhoModule !=="undefined")
185        {
186            carrinhoModule.atualizaIndicadorQtdCarrinho();
187        }
188    }
189
190    function topoCarrinhoatualizaIndicadorPrecoCarrinho()
191    {
192        if(typeof carrinhoModule !== "undefined")
193        {
194            carrinhoModule.atualizaIndicadorPrecoCarrinho();
195        }
196
197    }
198});
199
200var triggaEventosCarrinho = function(resp)
201{
202    if (!resp.hasOwnProperty('sucesso')) return;
203
204    var data = resp.sucesso;
205    if (typeof fbq === 'function' && !data.produto_ja_adicionado) {
206        fbq('track', 'AddToCart', {
207            content_ids: [data.id_loja_produto],
208            content_type: 'product',
209            content_name: data.nome_produto,
210            value: data.vr_preco,
211            currency: 'BRL'
212        });
213    }
214}
215
216$(function() {
217    topoCarrinhoModule = topoCarrinhoModule;
218});
219
220
221$(function () {
222    // Fecha busca quando click fora
223    $(document).click(function(e) {
224        if (e.target.className != 'boxBuscaExpandida'
225            && e.target.className != 'inputBuscaCabecalho inputBusca') {
226            $(".boxBuscaExpandida").hide();
227        }
228    });
229
230    $('.inputBusca').keyup(function () {
231        buscaProdutosModule.buscaProdutos(this.value, this, this);
232    });
233
234    $('body').on('click', '.buscaProdutosGet', function(){
235        buscaProdutosModule.buscaProdutosGET($(this).parent().find('.inputBusca').val(), this);
236        //Foca no input, caso não tenha nada digitado
237        if ($(this).closest('.elementoTopo').length) {
238            if( $('.elementoTopo .inputBusca').val().length == 0 ) {
239                $('.elementoTopo .inputBusca').focus();
240            }
241        } else {
242            if( $(this).parent().find('.inputBusca').val().length == 0 ) {
243                $(this).parent().find('.inputBusca').focus();
244            }
245        }
246    });
247    /*
248    $('.buscaProdutosGet').click(function () {
249        buscaProdutosModule.buscaProdutosGET($(this).parent().find('.inputBusca').val(), this);
250    });
251    */
252
253    $('.botaoBuscaReduzido').click(function () {
254        buscaProdutosModule.buscaProdutosGET($(this).parent().find('.inputTextBusca').val(), this);
255    });
256
257
258    $('.inputBusca, .inputTextBusca').keypress(function (e) {
259        if (e.which == 13) {
260            buscaProdutosModule.buscaProdutosGET(this.value, this);
261        }
262    });
263});
264$(function() {
265    $('.desc_email_newsletter').keyfilter(/[a-z0-9.@_-]/i);
266
267    // utilizei o "each" no form, para que a validação funcione quando houver mais de um elemento newsletter na loja
268    $('.formNewsletter').each( function(){
269        var form = $(this);
270        form.validate({
271            rules: {
272                desc_email_newsletter: {
273                    required: true,
274                    email: true
275                }
276            },
277            messages: {
278                desc_email_newsletter: {
279                    required: "Campo e-mail obrigatório",
280                    email: "E-mail inválido"
281                }
282            },
283            errorClass: "inputError",
284            errorPlacement: function(error, element) {
285                element.attr("placeholder", error.text());
286            },
287            submitHandler: function(form) {
288
289            }
290        });
291    });
292
293   /*
294   $(".formNewsletter").validate({
295        rules: {
296            desc_email_newsletter: {
297                required: true,
298                email: true
299            }
300        },
301        messages: {
302            desc_email_newsletter: {
303                required: "Campo e-mail obrigatório",
304                email: "E-mail inválido"
305            }
306        },
307        errorClass: "inputError",
308        errorPlacement: function(error, element) {
309            element.attr("placeholder", error.text());
310        },
311        submitHandler: function(form) {
312
313        }
314    });
315    */
316
317    $(".botaoCadastrarNewsletterConteudo").click(function(){
318
319        if (!$(this).parents('.elementoNewsletter').find(".formNewsletter").valid())
320        {
321            return false;
322        }
323        var desc_email = $(this).parents('.elementoNewsletter').find('.desc_email_newsletter').val();
324        var elem_newsletter = $(this).parents('.elementoNewsletter');
325        var acao_email = "I";
326        if(typeof $(this).parents('.elementoNewsletter').find('input[attr-radio=acao]:checked').val() != "undefined")
327        {
328            acao_email = $(this).parents('.elementoNewsletter').find('input[attr-radio=acao]:checked').val();
329        }
330
331        $.ajax({
332            url: BASE_URL+"ajax-ajax_newsletter",
333            data: { desc_email : desc_email, acao: acao_email },
334            type: "post",
335            dataType:"json",
336            success: function(resp) {
337                if(resp.sucesso)
338                {
339                    elem_newsletter.find('.desc_email_newsletter').val('');
340                    $(this).parents('.elementoNewsletter').find('.boxNewsletterDentro').html(resp.sucesso);
341                    if(acao_email == 'I')
342                    {
343                        okDialogGeral.create('E-mail cadastrado com sucesso!');
344                    }
345                    else if( acao_email == 'R' )
346                    {
347                        okDialogGeral.create('E-mail removido com sucesso!');
348                    }
349
350                    if (typeof LJVTGA4 !== 'undefined') {
351                      LJVTGA4.generateLead();
352                    }
353                }
354                else
355                if (resp.ja_existe)
356                {
357                    okDialogGeral.create("E-mail já cadastrado!");
358                }
359                else
360                if(resp.nao_encontrado)
361                {
362                    okDialogGeral.create("E-mail não encontrado!");
363                }
364            },
365            complete: function(){}
366        });
367
368        return false;
369    });
370
371    $('.desc_email_newsletter').focusout(function() {
372        $(this).closest('.formNewsletter').valid();
373    });
374});
375
376

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.