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}); 264function logar(desc_email1,desc_senha,logaMobile,logaTopo) 265{ 266 $.ajax({ 267 url: BASE_URL+"login-ajax_valida_area_login", 268 data: { desc_email1 : desc_email1, desc_senha: desc_senha , cookies_enabled : navigator.cookieEnabled}, 269 type: "post", 270 dataType:"json", 271 success: function(resp) { 272 processandoDialog.remove(); 273 274 if(resp.sucesso) 275 { 276 // Evento do GA4 277 if (typeof LJVTGA4 !== 'undefined') { 278 LJVTGA4.login(); 279 } 280 281 // Ãcone dinâmico do Topo 5 - Topo 7 282 $('.iconeDinamicoLogin').removeClass('icon-unlocked icon-key').addClass('icon-icone_usuariologado_cx_geral'); 283 284 // Topos que possuem o texto "Meus pedidos" - Topo 2, Topo 3 285 $('.loginPedidosDinamico > :first-child').html('Meus pedidos'); 286
287 $('.bem-vindo p:last-child').html(resp.desc_nome); 288 289 // Topos que possuem o "Seja bem vindo, "nome cliente" - Topo 1, Topo 4, Topo 16 290 $('.boxSaudacaoDinamica > span').html(resp.desc_nome); 291 292 okDialogGeral.create('Login efetuado com sucesso. Seja bem vindo!'); 293 294 $('.conteudoAreaLogin').parent().html(resp.sucesso); 295 $('.topoConteudoAreaLoginLjvtv3').parent().html(resp.sucesso_topo_ljvt_v3); 296 297 if(flg_preco_apos_login == "1") { 298 window.location.reload(); 299 } 300 301 $('.erroLogarAreaLogin').css("display","none"); 302 303 if(logaMobile != undefined && logaMobile != null && logaMobile != "") { 304 logaMobile(); 305 } 306 } else { 307 308 309 if(logaTopo == true) { 310 311/* okDialogGeral.create('Login e/ou senha inválidos.'); 312 $('#desc_email1Topo, #desc_senhaTopo').css("border-bottom","1px solid #d52b2e"); 313 $('.okButton a').click(function(){ 314 $('#_customDialog').hide(); 315 $('body').removeClass('_bodydialogModal'); 316 });*/ 317 318 } else { 319 320 console.log(resp); 321 $('.erroLogarAreaLogin').css("display","flex"); 322 $('.containerCampoCaixaLateral .inputTextLateral').css("border-bottom","1px solid #d52b2e"); 323 if (resp == 401) { 324 okDialogGeral.create('Seu cadastro está sob análise. Em breve entraremos em contato.'); 325 $('.erroLogarAreaLogin').html("Cadastro sob análise"); 326 } else { 327 okDialogGeral.create('Login e/ou senha inválidos.'); 328 $('.erroLogarAreaLogin').html("Login e/ou senha inválidos."); 329 } 330 //$('.ajaxOkConteudo .icon-icone_check_modal').addClass('icon-icone_alerta_modal_geral').removeClass('icon-icone_check_modal'); 331 $('.ajaxOkConteudo .icon-icone_check_modal').addClass('icon-icone_alerta_modal_geral fa-triangle-exclamation fa-solid').removeClass('icon-icone_check_modal fa-clipboard-check'); 332 $('.ajaxOkConteudo .icon-icone_alerta_modal_geral').css({'font-size':'40px', 'margin-bottom':'10px', 'text-align':'center', 'color':'#FFA800' }); 333 } 334 } 335 336 if(resp.sucesso_topo) { 337/* $('.boxLoginCarrinhoTopoTema:not(.carrinhoTopo)').replaceWith(resp.sucesso_topo); 338 $('.boxLoginCarrinhoTopoTema').addClass('active');*/ 339 340 } else if(resp.bem_vindo) { 341 $('.bem-vindo').html(resp.bem_vindo); 342 343 } else if(resp.conteudo_minha_conta_mobile) { 344 $('.boxNavegacaoMinhaConta').after(resp.conteudo_minha_conta_mobile); 345 } 346 347 //atualiza_resumo_carrinho(); 348 }, 349 complete: function(){} 350 }); 351 352 return false; 353} 354 355$(function() { 356 357 $('.descEmail1').keyfilter(/[a-z0-9.@_-]/i); 358 $('.descSenha').keyfilter(/^\S*$/i); 359 360 var rules = { 361 desc_email1: { required: true, email: true }, 362 desc_senha: { required: true } 363 }; 364 365 $(".formLogin").each(function() { 366 $(this).validate({ 367 rules: rules, 368 messages: { 369 desc_email1: { 370 required: "Campo e-mail obrigatório", 371 email: "E-mail inválido" 372 }, 373 desc_senha: { 374 required: "Campo senha obrigatório" 375 } 376 }, 377 errorClass: "inputError", 378 errorPlacement: function(error, element) { 379 element.attr("placeholder", error.text()); 380 }, 381 submitHandler: function(form) { 382 // Handle form submission here 383 } 384 }); 385 }); 386 387 // usa trim para eliminar espaços 388 $('.descEmail1').on('keyup mouseup blur', function(){ 389 $(this).val($.trim($(this).val())); 390 $(this).valid(); 391 }); 392 393 //$(".descEmail1, .descSenha").keypress(function(e) { 394 $('.descEmail1, .descSenha').on('keypress', function(e){ 395 if(e.which == 13) { 396 $(this).closest('.boxLogin').find('.botaoEntrarLogin').click(); 397 } 398 }); 399
400 //$('.descEmail1, .descSenha').focusout(function() { 401 $('.descEmail1, .descSenha').on('focusout', function(){ 402 $(this).valid(); 403 }); 404 405 $('.descEmail1, .descSenha').keypress(function(e){ //fazer login quando apertar enter 406 if(e.which == 13){//Enter key pressed 407 $('#botaoEntrarLogin').click();//Trigger search button click event 408 } 409 }); 410 411 412 // verifica se login e senha da caixa lateral estão vazios e/ou incompletos 413 //- Cond 1. Campos vazios -> mostra o erro na validação antes da Função de Login 414 //- Cond 2. Campo de e-mail com erro e senha preenchida ou não -> mostra o erro na validação antes da Função de Login 415 //- Cond 3. Estando os campos corretamente preenchidos, a função de login é chamada 416 //$(".botaoEntrarLogin").click(function(){ 417 $('body').on('click', '.botaoEntrarLogin > input', function(){ 418 $descEmail1 = $(this).closest('section').find('.descEmail1'); 419 $descSenha = $(this).closest('section').find('.descSenha'); 420 421 if( ($descEmail1.val().length == 0) && ($descSenha.val().length == 0)) { 422 $descEmail1.valid(); 423 $descSenha.valid(); 424 } 425 else if( ($descEmail1.hasClass("inputError")) && 426 ($descEmail1.val().length > 0) && 427 ($descSenha.val().length > 0) || 428 ($descSenha.val().length == 0) ){ 429 430 $descEmail1.valid(); 431 $descSenha.valid(); 432 } 433 else { 434 var email = $descEmail1.val(), 435 senha = $descSenha.val(); 436 437 logar(email,senha); 438 } 439 }); 440 441 $(".botaoEntrarLogin").click(function(){ 442 $descEmail1 = $(this).closest('section').find('.descEmail1'); 443 $descSenha = $(this).closest('section').find('.descSenha'); 444 445 if( ($descEmail1.val().length == 0) && ($descSenha.val().length == 0)) { 446 $descEmail1.valid(); 447 $descSenha.valid(); 448 } 449 else if( ($descEmail1.hasClass("inputError")) && 450 ($descEmail1.val().length > 0) && 451 ($descSenha.val().length > 0) || 452 ($descSenha.val().length == 0) ){ 453 454 $descEmail1.valid(); 455 $descSenha.valid(); 456 } 457 else { 458 var email = $descEmail1.val(), 459 senha = $descSenha.val(); 460 461 logar(email,senha); 462 } 463 }); 464 465 466 $(".boxBotaoVerSenhaInput.topoLogin").click(function(){ 467 if ($(this).hasClass('ativo')) { 468 $(this).removeClass('ativo'); 469 $(this).siblings('[name="desc_senha"]').attr('type', 'password'); 470 } else { 471 $(this).addClass('ativo'); 472 $(this).siblings('[name="desc_senha"]').attr('type', 'text'); 473 } 474 }); 475}); 476 477
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.